/* 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. */
{
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()
or the physical input file name (foo.s) and not the file name
specified in the most recent .loc directive (eg foo.h). */
loc = current;
-
- /* 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;
}
else if (debug_type != DEBUG_DWARF2)
return;
dwarf2_where (&loc);
dwarf2_gen_line_info (frag_now_fix () - size, &loc);
+ dwarf2_consume_line_info ();
+}
+
+/* Called after the current line information has been either used with
+ dwarf2_gen_line_info or saved with a machine instruction for later use.
+ This resets the state of the line number information to reflect that
+ it has been used. */
+
+void
+dwarf2_consume_line_info (void)
+{
+ /* Unless we generate DWARF2 debugging information for each
+ assembler line, we only emit one line symbol for one LOC. */
+ if (debug_type != DEBUG_DWARF2)
+ dwarf2_loc_directive_seen = FALSE;
current.flags &= ~(DWARF2_FLAG_BASIC_BLOCK
| DWARF2_FLAG_PROLOGUE_END
if (debug_type == DEBUG_DWARF2)
dwarf2_where (&loc);
else
- {
- loc = current;
- loc_directive_seen = FALSE;
- }
+ loc = current;
loc.flags |= DWARF2_FLAG_BASIC_BLOCK;
- current.flags &= ~(DWARF2_FLAG_BASIC_BLOCK
- | DWARF2_FLAG_PROLOGUE_END
- | DWARF2_FLAG_EPILOGUE_BEGIN);
-
+ dwarf2_consume_line_info ();
dwarf2_gen_line_info_1 (label, &loc);
}
/* If we see two .loc directives in a row, force the first one to be
output now. */
- if (loc_directive_seen)
+ if (dwarf2_loc_directive_seen && debug_type != DEBUG_DWARF2)
dwarf2_emit_insn (0);
filenum = get_absolute_expression ();
}
demand_empty_rest_of_line ();
- loc_directive_seen = TRUE;
+ dwarf2_loc_directive_seen = TRUE;
}
void