This is the mail archive of the binutils@sourceware.org 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]

[PATCH] export dwarf2 loc_directive_seen flag


I'm about to submit a patch to clean up the way the Xtensa port of GAS handles line numbers. It will be similar to the ia64 port. (I'm sending it separately to make it easier for someone to review and approve this piece of it.)

One issue is that the loc_directive_seen flag is not exported from dwarf2dbg.c. The ia64 port handles this by overriding the .loc directive function and keeping its own local copies of that flag. It would be a whole lot cleaner to just use the flag from dwarf2dbg.c. I don't know the ia64 port very well to know if this would also be useful there -- overriding the directive function may be just as good for ia64 -- but I'd like this for my Xtensa patch.

Would it be OK to export it as a global variable?

Here's a patch to do that. It is relative to my previous patch, but I can adjust that as needed. An alternative would be to keep the flag static and add an accessor function to return its value.

gas/
	* dwarf2dbg.h (dwarf2_loc_directive_seen): New.
	* dwarf2dbg.c (loc_directive_seen): Make external and rename to...
	(dwarf2_loc_directive_seen): ...this.
	(dwarf2_emit_insn, dwarf2_consume_line_info)
	(dwarf2_emit_label, dwarf2_directive_loc): Use new name.
--- dwarf2dbg.h.orig	2007-11-13 11:30:26.000000000 -0800
+++ dwarf2dbg.h	2007-11-13 11:30:05.000000000 -0800
@@ -79,6 +79,10 @@
 /* Should be called for each code label.  */
 extern void dwarf2_emit_label (symbolS *);
 
+/* True when we've seen a .loc directive recently.  Used to avoid
+   doing work when there's nothing to do.  */
+bfd_boolean dwarf2_loc_directive_seen;
+
 /* True when we're supposed to set the basic block mark whenever a label
    is seen.  Unless the target is doing Something Weird, just call 
    dwarf2_emit_label.  */
--- dwarf2dbg.c.orig	2007-11-13 11:31:03.000000000 -0800
+++ dwarf2dbg.c	2007-11-13 11:30:12.000000000 -0800
@@ -173,7 +173,7 @@
 
 /* TRUE when we've seen a .loc directive recently.  Used to avoid
    doing work when there's nothing to do.  */
-static bfd_boolean loc_directive_seen;
+bfd_boolean dwarf2_loc_directive_seen;
 
 /* TRUE when we're supposed to set the basic block mark whenever a
    label is seen.  */
@@ -365,7 +365,7 @@
 {
   struct dwarf2_line_info loc;
 
-  if (loc_directive_seen)
+  if (dwarf2_loc_directive_seen)
     {
       /* Use the last location established by a .loc directive, not
 	 the value returned by dwarf2_where().  That calls as_where()
@@ -394,7 +394,7 @@
   /* Unless we generate DWARF2 debugging information for each
      assembler line, we only emit one line symbol for one LOC.  */
   if (debug_type != DEBUG_DWARF2)
-    loc_directive_seen = FALSE;
+    dwarf2_loc_directive_seen = FALSE;
 
   current.flags &= ~(DWARF2_FLAG_BASIC_BLOCK
 		     | DWARF2_FLAG_PROLOGUE_END
@@ -421,7 +421,7 @@
   else
     {
       loc = current;
-      loc_directive_seen = FALSE;
+      dwarf2_loc_directive_seen = FALSE;
     }
 
   loc.flags |= DWARF2_FLAG_BASIC_BLOCK;
@@ -582,7 +582,7 @@
 
   /* If we see two .loc directives in a row, force the first one to be
      output now.  */
-  if (loc_directive_seen && debug_type != DEBUG_DWARF2)
+  if (dwarf2_loc_directive_seen && debug_type != DEBUG_DWARF2)
     dwarf2_emit_insn (0);
 
   filenum = get_absolute_expression ();
@@ -691,7 +691,7 @@
     }
 
   demand_empty_rest_of_line ();
-  loc_directive_seen = TRUE;
+  dwarf2_loc_directive_seen = TRUE;
 }
 
 void

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