This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: MIPS/dwarf-2: gas patches


I took Matt Green's patch and expanded on it for a little while.  With
corresponding GCC changes, GDB seems to work; testsuite results are not
excellent, but not abyssmal.  Are these OK to commit?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2002-06-06  Daniel Jacobowitz  <drow@mvista.com>

	Based on patch from Matt Green:
	* config/obj-elf.h (ECOFF_DEBUGGING): Make configurable.
	* config/tc-mips.c (s_mips_file): Renamed from s_file.
	(s_mips_loc): New function.
	(mips_nonecoff_pseudo_table): Call them.
	(append_insn): Call dwarf2_emit_insn.

Index: gas/config/obj-elf.h
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.h,v
retrieving revision 1.15
diff -u -p -u -p -r1.15 obj-elf.h
--- gas/config/obj-elf.h	8 Aug 2001 13:11:58 -0000	1.15
+++ gas/config/obj-elf.h	7 Jun 2002 01:06:04 -0000
@@ -51,7 +51,7 @@ extern int alpha_flag_mdebug;
 #ifdef MIPS_STABS_ELF
 #define ECOFF_DEBUGGING 0
 #else
-#define ECOFF_DEBUGGING 1
+#define ECOFF_DEBUGGING (debug_type == DEBUG_ECOFF)
 #endif /* MIPS_STABS_ELF */
 #endif /* TC_MIPS */
 
Index: tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.138
diff -u -p -u -r1.138 tc-mips.c
--- tc-mips.c	6 Jun 2002 16:38:01 -0000	1.138
+++ tc-mips.c	7 Jun 2002 01:33:49 -0000
@@ -37,6 +37,7 @@
 
 #include "opcode/mips.h"
 #include "itbl-ops.h"
+#include "dwarf2dbg.h"
 
 #ifdef DEBUG
 #define DBG(x) printf x
@@ -760,7 +761,8 @@ static void s_mips_frame PARAMS ((int));
 static void s_mips_mask PARAMS ((int));
 static void s_mips_stab PARAMS ((int));
 static void s_mips_weakext PARAMS ((int));
-static void s_file PARAMS ((int));
+static void s_mips_file PARAMS ((int));
+static void s_mips_loc PARAMS ((int));
 static int mips16_extended_frag PARAMS ((fragS *, asection *, long));
 static const char *mips_isa_to_str PARAMS ((int));
 static const char *mips_cpu_to_str PARAMS ((int));
@@ -893,10 +895,10 @@ static const pseudo_typeS mips_nonecoff_
   {"end", s_mips_end, 0},
   {"endb", s_ignore, 0},
   {"ent", s_mips_ent, 0},
-  {"file", s_file, 0},
+  {"file", s_mips_file, 0},
   {"fmask", s_mips_mask, 'F'},
   {"frame", s_mips_frame, 0},
-  {"loc", s_ignore, 0},
+  {"loc", s_mips_loc, 0},
   {"mask", s_mips_mask, 'R'},
   {"verstamp", s_ignore, 0},
   { NULL, NULL, 0 },
@@ -2010,11 +2012,19 @@ append_insn (place, ip, address_expr, re
     }
 
   if (! mips_opts.mips16)
-    md_number_to_chars (f, ip->insn_opcode, 4);
+    {
+      md_number_to_chars (f, ip->insn_opcode, 4);
+#ifdef OBJ_ELF
+      dwarf2_emit_insn (4);
+#endif
+    }
   else if (*reloc_type == BFD_RELOC_MIPS16_JMP)
     {
       md_number_to_chars (f, ip->insn_opcode >> 16, 2);
       md_number_to_chars (f + 2, ip->insn_opcode & 0xffff, 2);
+#ifdef OBJ_ELF
+      dwarf2_emit_insn (4);
+#endif
     }
   else
     {
@@ -2024,6 +2034,9 @@ append_insn (place, ip, address_expr, re
 	  f += 2;
 	}
       md_number_to_chars (f, ip->insn_opcode, 2);
+#ifdef OBJ_ELF
+      dwarf2_emit_insn (ip->use_extend ? 4 : 2);
+#endif
     }
 
   /* Update the register mask information.  */
@@ -13306,14 +13319,34 @@ get_number ()
 }
 
 /* The .file directive; just like the usual .file directive, but there
-   is an initial number which is the ECOFF file index.  */
+   is an initial number which is the ECOFF file index.  In the non-ECOFF
+   case .file implies DWARF-2.  */
 
 static void
-s_file (x)
+s_mips_file (x)
      int x ATTRIBUTE_UNUSED;
 {
-  get_number ();
-  s_app_file (0);
+  if (ECOFF_DEBUGGING)
+    {
+      get_number ();
+      s_app_file (0);
+    }
+  else
+    {
+      dwarf2_directive_file (0);
+    }
+}
+
+/* The .loc directive, implying DWARF-2.  */
+
+static void
+s_mips_loc (x)
+     int x ATTRIBUTE_UNUSED;
+{
+  if (!ECOFF_DEBUGGING)
+    {
+      dwarf2_directive_loc (0);
+    }
 }
 
 /* The .end directive.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]