re PR bootstrap/48400 (powerpc-apple-darwin9 fails to bootstrap at revision 171824)
authorRichard Henderson <rth@redhat.com>
Fri, 1 Apr 2011 20:23:00 +0000 (13:23 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 1 Apr 2011 20:23:00 +0000 (13:23 -0700)
PR 48400
* dwarf2out.c (dwarf2out_source_line): Disable discriminators
in strict mode before dwarf4.  Re-order tests to early out
before switching sections.

From-SVN: r171852

gcc/ChangeLog
gcc/dwarf2out.c

index 1f03c10..d5733e0 100644 (file)
@@ -1,3 +1,10 @@
+2011-04-01  Richard Henderson  <rth@redhat.com>
+
+       PR 48400
+       * dwarf2out.c (dwarf2out_source_line): Disable discriminators
+       in strict mode before dwarf4.  Re-order tests to early out
+       before switching sections.
+
 2011-04-01  Nathan Froyd  <froydnj@codesourcery.com>
 
        * config/h8300/constraints.md: New file.
index 50d9429..b299bc7 100644 (file)
@@ -22132,21 +22132,40 @@ dwarf2out_source_line (unsigned int line, const char *filename,
   if (debug_info_level < DINFO_LEVEL_NORMAL || line == 0)
     return;
 
-  switch_to_section (current_function_section ());
-
-  /* If requested, emit something human-readable.  */
-  if (flag_debug_asm)
-    fprintf (asm_out_file, "\t%s %s:%d\n", ASM_COMMENT_START, filename, line);
+  /* The discriminator column was added in dwarf4.  Simplify the below
+     by simply removing it if we're not supposed to output it.  */
+  if (dwarf_version < 4 && dwarf_strict)
+    discriminator = 0;
 
   table = cur_line_info_table;
   file_num = maybe_emit_file (lookup_filename (filename));
 
+  /* ??? TODO: Elide duplicate line number entries.  Traditionally,
+     the debugger has used the second (possibly duplicate) line number
+     at the beginning of the function to mark the end of the prologue.
+     We could eliminate any other duplicates within the function.  For
+     Dwarf3, we ought to include the DW_LNS_set_prologue_end mark in
+     that second line number entry.  */
+  /* Recall that this end-of-prologue indication is *not* the same thing
+     as the end_prologue debug hook.  The NOTE_INSN_PROLOGUE_END note,
+     to which the hook corresponds, follows the last insn that was 
+     emitted by gen_prologue.  What we need is to preceed the first insn
+     that had been emitted after NOTE_INSN_FUNCTION_BEG, i.e. the first
+     insn that corresponds to something the user wrote.  These may be
+     very different locations once scheduling is enabled.  */
+
   if (0 && file_num == table->file_num
       && line == table->line_num
       && discriminator == table->discrim_num
       && is_stmt == table->is_stmt)
     return;
 
+  switch_to_section (current_function_section ());
+
+  /* If requested, emit something human-readable.  */
+  if (flag_debug_asm)
+    fprintf (asm_out_file, "\t%s %s:%d\n", ASM_COMMENT_START, filename, line);
+
   if (DWARF2_ASM_LINE_DEBUG_INFO)
     {
       /* Emit the .loc directive understood by GNU as.  */