PATCH: Fix stabs for mips

H . J . Lu hjl@lucon.org
Tue Jun 11 13:54:00 GMT 2002


Please ignore my last patch. This one seems ok. I'd like to use the new
gas with the existing gcc binary.


H.J.
-------------- next part --------------
2002-06-11  H.J. Lu <hjl@gnu.org>

	* dwarf2dbg.h (dwarf2_directive_file): Return char *.

	* dwarf2dbg.c (dwarf2_directive_file): Return filename.

	* config/tc-mips.c (s_mips_file): Call new_logical_line for the
	first dwarf .file directive.

--- gas/config/tc-mips.c.stabs	Sat Jun  8 20:36:18 2002
+++ gas/config/tc-mips.c	Tue Jun 11 13:40:56 2002
@@ -13372,13 +13372,26 @@ static void
 s_mips_file (x)
      int x ATTRIBUTE_UNUSED;
 {
+  static int first_file_directive;
+
   if (ECOFF_DEBUGGING)
     {
       get_number ();
       s_app_file (0);
     }
   else
-    dwarf2_directive_file (0);
+    {
+      char *filename;
+
+      filename = dwarf2_directive_file (0);
+      /* For the first .file directive we see, we don't know for sure
+	 it is dwarf or stabs. We do both.  */
+      if (! first_file_directive)
+	{
+	  first_file_directive = 1;
+	  new_logical_line (filename, -1);
+	}
+    }
 }
 
 /* The .loc directive, implying DWARF-2.  */
--- gas/dwarf2dbg.c.stabs	Thu May 23 08:22:30 2002
+++ gas/dwarf2dbg.c	Tue Jun 11 13:22:34 2002
@@ -346,7 +346,7 @@ get_filenum (filename)
 
 /* Handle the .file directive.  */
 
-void
+char *
 dwarf2_directive_file (dummy)
      int dummy ATTRIBUTE_UNUSED;
 {
@@ -359,7 +359,7 @@ dwarf2_directive_file (dummy)
   if (*input_line_pointer == '"')
     {
       s_app_file (0);
-      return;
+      return NULL;
     }
 
   num = get_absolute_expression ();
@@ -369,13 +369,13 @@ dwarf2_directive_file (dummy)
   if (num < 1)
     {
       as_bad (_("file number less than one"));
-      return;
+      return NULL;
     }
 
   if (num < (int) files_in_use && files[num].filename != 0)
     {
       as_bad (_("file number %ld already allocated"), (long) num);
-      return;
+      return NULL;
     }
 
   if (num >= (int) files_allocated)
@@ -393,6 +393,8 @@ dwarf2_directive_file (dummy)
   files[num].filename = filename;
   files[num].dir = 0;
   files_in_use = num + 1;
+
+  return filename;
 }
 
 void
--- gas/dwarf2dbg.h.stabs	Fri Mar  9 11:16:40 2001
+++ gas/dwarf2dbg.h	Tue Jun 11 12:20:12 2002
@@ -36,7 +36,7 @@ struct dwarf2_line_info {
 /* Implements the .file FILENO "FILENAME" directive.  FILENO can be 0
    to indicate that no file number has been assigned.  All real file
    number must be >0.  */
-extern void dwarf2_directive_file PARAMS ((int dummy));
+extern char *dwarf2_directive_file PARAMS ((int dummy));
 
 /* Implements the .loc FILENO LINENO [COLUMN] directive.  FILENO is
    the file number, LINENO the line number and the (optional) COLUMN


More information about the Binutils mailing list