]> gcc.gnu.org Git - gcc.git/commitdiff
dbxout.c (dbxout_source_line): Add is_stmt parameter.
authorCary Coutant <ccoutant@google.com>
Wed, 17 Jun 2009 23:54:40 +0000 (23:54 +0000)
committerCary Coutant <ccoutant@gcc.gnu.org>
Wed, 17 Jun 2009 23:54:40 +0000 (16:54 -0700)
* dbxout.c (dbxout_source_line): Add is_stmt parameter.
Change caller.
* debug.c (struct gcc_debug_hooks): Change placeholder for
source_line hook.
(debug_nothing_int_charstar_int): Replaced by...
(debug_nothing_int_charstar_int_bool): ...this.
* debug.h (struct gcc_debug_hooks): Add is_stmt parameter to
source_line prototype.
(debug_nothing_int_charstar_int): Replaced by...
(debug_nothing_int_charstar_int_bool): ...this.
* defaults.h (SUPPORTS_DISCRIMINATOR): New constant.
* dwarf2out.c (dwarf2out_source_line): Add is_stmt parameter.
Output is_stmt operand when necessary.
* final.c (last_is_stmt): New variable.
(final_start_function): Initialize last_is_stmt.
(final_scan_insn): Pass is_stmt to source_line debug hook.
(notice_source_line): Add is_stmt parameter.
* sdbout.c (sdbout_source_line): Add is_stmt parameter.
* vmsdbgout.c (vmsdbgout_source_line): Add is_stmt parameter.
Change callers.
* xcoffout.c (xcoffout_source_line): Add is_stmt parameter.
* xcoffout.h (xcoffout_source_line): Add is_stmt parameter.

From-SVN: r148635

gcc/ChangeLog
gcc/dbxout.c
gcc/debug.c
gcc/debug.h
gcc/defaults.h
gcc/dwarf2out.c
gcc/final.c
gcc/sdbout.c
gcc/vmsdbgout.c
gcc/xcoffout.c
gcc/xcoffout.h

index 9bcafa2f7585d65019ecd7fa7b29ad0ed3c839c6..5b02ed1de95ae04d73835c984295a09658d126d4 100644 (file)
@@ -1,3 +1,28 @@
+2009-06-17  Cary Coutant  <ccoutant@google.com>
+
+       * dbxout.c (dbxout_source_line): Add is_stmt parameter.
+       Change caller.
+       * debug.c (struct gcc_debug_hooks): Change placeholder for
+       source_line hook.
+       (debug_nothing_int_charstar_int): Replaced by...
+       (debug_nothing_int_charstar_int_bool): ...this.
+       * debug.h (struct gcc_debug_hooks): Add is_stmt parameter to
+       source_line prototype.
+       (debug_nothing_int_charstar_int): Replaced by...
+       (debug_nothing_int_charstar_int_bool): ...this.
+       * defaults.h (SUPPORTS_DISCRIMINATOR): New constant.
+       * dwarf2out.c (dwarf2out_source_line): Add is_stmt parameter.
+       Output is_stmt operand when necessary.
+       * final.c (last_is_stmt): New variable.
+       (final_start_function): Initialize last_is_stmt.
+       (final_scan_insn): Pass is_stmt to source_line debug hook.
+       (notice_source_line): Add is_stmt parameter.
+       * sdbout.c (sdbout_source_line): Add is_stmt parameter.
+       * vmsdbgout.c (vmsdbgout_source_line): Add is_stmt parameter.
+       Change callers.
+       * xcoffout.c (xcoffout_source_line): Add is_stmt parameter.
+       * xcoffout.h (xcoffout_source_line): Add is_stmt parameter.
+
 2009-06-17  Ian Lance Taylor  <iant@google.com>
 
        * expr.c (struct move_by_pieces_d): Rename from move_by_pieces.
index 17fdf6efed188a9e0a6feceed58db05fe46ab4c1..ffb2ac2ef7b0aafad8275f0d3ad294b8f4ccb2b6 100644 (file)
@@ -333,7 +333,7 @@ static void dbxout_handle_pch (unsigned);
 /* The debug hooks structure.  */
 #if defined (DBX_DEBUGGING_INFO)
 
-static void dbxout_source_line (unsigned int, const char *, int);
+static void dbxout_source_line (unsigned int, const char *, int, bool);
 static void dbxout_begin_prologue (unsigned int, const char *);
 static void dbxout_source_file (const char *);
 static void dbxout_function_end (tree);
@@ -1265,7 +1265,7 @@ dbxout_begin_prologue (unsigned int lineno, const char *filename)
   /* pre-increment the scope counter */
   scope_labelno++;
 
-  dbxout_source_line (lineno, filename, 0);
+  dbxout_source_line (lineno, filename, 0, true);
   /* Output function begin block at function scope, referenced 
      by dbxout_block, dbxout_source_line and dbxout_function_end.  */
   emit_pending_bincls_if_required ();
@@ -1277,7 +1277,8 @@ dbxout_begin_prologue (unsigned int lineno, const char *filename)
 
 static void
 dbxout_source_line (unsigned int lineno, const char *filename,
-                    int discriminator ATTRIBUTE_UNUSED)
+                    int discriminator ATTRIBUTE_UNUSED,
+                    bool is_stmt ATTRIBUTE_UNUSED)
 {
   dbxout_source_file (filename);
 
index c8e80a841c164dd726236e1727a79edcdb813cea..df69fd5eb8236b74d2bda31896b89a9d14369845 100644 (file)
@@ -34,7 +34,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
   debug_nothing_int_int,                /* begin_block */
   debug_nothing_int_int,                /* end_block */
   debug_true_const_tree,                /* ignore_block */
-  debug_nothing_int_charstar_int,       /* source_line */
+  debug_nothing_int_charstar_int_bool,  /* source_line */
   debug_nothing_int_charstar,           /* begin_prologue */
   debug_nothing_int_charstar,           /* end_prologue */
   debug_nothing_int_charstar,           /* end_epilogue */
@@ -104,9 +104,10 @@ debug_nothing_int_charstar (unsigned int line ATTRIBUTE_UNUSED,
 }
 
 void
-debug_nothing_int_charstar_int (unsigned int line ATTRIBUTE_UNUSED,
-                               const char *text ATTRIBUTE_UNUSED,
-                               int discriminator ATTRIBUTE_UNUSED)
+debug_nothing_int_charstar_int_bool (unsigned int line ATTRIBUTE_UNUSED,
+                                    const char *text ATTRIBUTE_UNUSED,
+                                    int discriminator ATTRIBUTE_UNUSED,
+                                    bool is_stmt ATTRIBUTE_UNUSED)
 {
 }
 
index 8f76aff04a443aed18f3c462e4b87da0480bde32..de525fec2cd065d5127f4de38231498fd8fcf80a 100644 (file)
@@ -61,11 +61,10 @@ struct gcc_debug_hooks
 
   /* Record a source file location at (FILE, LINE, DISCRIMINATOR).  */
   void (* source_line) (unsigned int line, const char *file,
-                        int discriminator);
+                        int discriminator, bool is_stmt);
 
   /* Called at start of prologue code.  LINE is the first line in the
-     function.  This has been given the same prototype as source_line,
-     so that the source_line hook can be substituted if appropriate.  */
+     function.  */
   void (* begin_prologue) (unsigned int line, const char *file);
 
   /* Called at end of prologue code.  LINE is the first line in the
@@ -142,7 +141,8 @@ extern const struct gcc_debug_hooks *debug_hooks;
 extern void debug_nothing_void (void);
 extern void debug_nothing_charstar (const char *);
 extern void debug_nothing_int_charstar (unsigned int, const char *);
-extern void debug_nothing_int_charstar_int (unsigned int, const char *, int);
+extern void debug_nothing_int_charstar_int_bool (unsigned int, const char *,
+                                                 int, bool);
 extern void debug_nothing_int (unsigned int);
 extern void debug_nothing_int_int (unsigned int, unsigned int);
 extern void debug_nothing_tree (tree);
index b41f60366d507afd03b795ab083844a8a92e59a5..a4b870ef45f5a04026ced431c40d618dbfaf9d09 100644 (file)
@@ -255,6 +255,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #endif
 #endif
 
+/* This determines whether or not we support the discriminator
+   attribute in the .loc directive.  */
+#ifndef SUPPORTS_DISCRIMINATOR
+#ifdef HAVE_GAS_DISCRIMINATOR
+#define SUPPORTS_DISCRIMINATOR 1
+#else
+#define SUPPORTS_DISCRIMINATOR 0
+#endif
+#endif
+
 /* This determines whether or not we support link-once semantics.  */
 #ifndef SUPPORTS_ONE_ONLY
 #ifdef MAKE_DECL_ONE_ONLY
index 367bda86a7eb4bab66f115c617ef6fec30f84b1e..81be71845e49b20cadd1a835eece28f2ffb583d6 100644 (file)
@@ -91,7 +91,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "input.h"
 
 #ifdef DWARF2_DEBUGGING_INFO
-static void dwarf2out_source_line (unsigned int, const char *, int);
+static void dwarf2out_source_line (unsigned int, const char *, int, bool);
 
 static rtx last_var_location_insn;
 #endif
@@ -3637,7 +3637,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
      prologue case, not the eh frame case.  */
 #ifdef DWARF2_DEBUGGING_INFO
   if (file)
-    dwarf2out_source_line (line, file, 0);
+    dwarf2out_source_line (line, file, 0, true);
 #endif
 
   if (dwarf2out_do_cfi_asm ())
@@ -16283,8 +16283,10 @@ dwarf2out_begin_function (tree fun)
 
 static void
 dwarf2out_source_line (unsigned int line, const char *filename,
-                       int discriminator ATTRIBUTE_UNUSED)
+                       int discriminator, bool is_stmt)
 {
+  static bool last_is_stmt = true;
+
   if (debug_info_level >= DINFO_LEVEL_NORMAL
       && line != 0)
     {
@@ -16301,10 +16303,13 @@ dwarf2out_source_line (unsigned int line, const char *filename,
        {
          /* Emit the .loc directive understood by GNU as.  */
          fprintf (asm_out_file, "\t.loc %d %d 0", file_num, line);
-#ifdef HAVE_GAS_DISCRIMINATOR
-         if (discriminator != 0)
+         if (is_stmt != last_is_stmt)
+           {
+             fprintf (asm_out_file, " is_stmt %d", is_stmt ? 1 : 0);
+             last_is_stmt = is_stmt;
+           }
+         if (SUPPORTS_DISCRIMINATOR && discriminator != 0)
            fprintf (asm_out_file, " discriminator %d", discriminator);
-#endif /* HAVE_GAS_DISCRIMINATOR */
          fputc ('\n', asm_out_file);
 
          /* Indicate that line number info exists.  */
index b113bc90a39a8b9516971c9ba78d8bdd4875d0f4..3de72811401b5eb9060e69732030201021e05017 100644 (file)
@@ -213,7 +213,7 @@ static int asm_insn_count (rtx);
 #endif
 static void profile_function (FILE *);
 static void profile_after_prologue (FILE *);
-static bool notice_source_line (rtx);
+static bool notice_source_line (rtx, bool *);
 static rtx walk_alter_subreg (rtx *, bool *);
 static void output_asm_name (void);
 static void output_alternate_entry_point (FILE *, rtx);
@@ -2089,6 +2089,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
        rtx body = PATTERN (insn);
        int insn_code_number;
        const char *templ;
+       bool is_stmt;
 
 #ifdef HAVE_conditional_execution
        /* Reset this early so it is correct for ASM statements.  */
@@ -2190,11 +2191,12 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
          }
        /* Output this line note if it is the first or the last line
           note in a row.  */
-       if (notice_source_line (insn))
+       if (notice_source_line (insn, &is_stmt))
          {
            (*debug_hooks->source_line) (last_linenum,
                                         last_filename,
-                                        last_discriminator);
+                                        last_discriminator,
+                                        is_stmt);
          }
 
        if (GET_CODE (body) == ASM_INPUT)
@@ -2698,10 +2700,12 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
   return NEXT_INSN (insn);
 }
 \f
-/* Return whether a source line note needs to be emitted before INSN.  */
+/* Return whether a source line note needs to be emitted before INSN.
+   Sets IS_STMT to TRUE if the line should be marked as a possible
+   breakpoint location.  */
 
 static bool
-notice_source_line (rtx insn)
+notice_source_line (rtx insn, bool *is_stmt)
 {
   const char *filename;
   int linenum;
@@ -2717,20 +2721,33 @@ notice_source_line (rtx insn)
       linenum = insn_line (insn);
     }
 
-  if (filename
-      && (force_source_line
-         || filename != last_filename
-         || last_linenum != linenum
-         || last_discriminator != discriminator))
+  if (filename == NULL)
+    return false;
+
+  if (force_source_line
+      || filename != last_filename
+      || last_linenum != linenum)
     {
       force_source_line = false;
       last_filename = filename;
       last_linenum = linenum;
       last_discriminator = discriminator;
+      *is_stmt = true;
       high_block_linenum = MAX (last_linenum, high_block_linenum);
       high_function_linenum = MAX (last_linenum, high_function_linenum);
       return true;
     }
+
+  if (SUPPORTS_DISCRIMINATOR && last_discriminator != discriminator)
+    {
+      /* If the discriminator changed, but the line number did not,
+         output the line table entry with is_stmt false so the
+         debugger does not treat this as a breakpoint location.  */
+      last_discriminator = discriminator;
+      *is_stmt = false;
+      return true;
+    }
+
   return false;
 }
 \f
index cc8687419ffbba4157c5ea12c1c9896aea4f0da2..0e1cf18dfb23ddd91327c813efd1e61d5b514b97 100644 (file)
@@ -117,7 +117,7 @@ static void sdbout_start_source_file        (unsigned int, const char *);
 static void sdbout_end_source_file     (unsigned int);
 static void sdbout_begin_block         (unsigned int, unsigned int);
 static void sdbout_end_block           (unsigned int, unsigned int);
-static void sdbout_source_line         (unsigned int, const char *, int);
+static void sdbout_source_line         (unsigned int, const char *, int, bool);
 static void sdbout_end_epilogue                (unsigned int, const char *);
 static void sdbout_global_decl         (tree);
 #ifndef MIPS_DEBUGGING_INFO
@@ -1542,7 +1542,8 @@ sdbout_end_block (unsigned int line, unsigned int n ATTRIBUTE_UNUSED)
 
 static void
 sdbout_source_line (unsigned int line, const char *filename ATTRIBUTE_UNUSED,
-                    int discriminator ATTRIBUTE_UNUSED)
+                    int discriminator ATTRIBUTE_UNUSED,
+                    bool is_stmt ATTRIBUTE_UNUSED)
 {
   /* COFF relative line numbers must be positive.  */
   if ((int) line > sdb_begin_function_line)
index 41a3420f9ed795c7e20a1cfc848d68d17a13ebe5..917121a38025aaf73496e4c44880ded8d42cf1ba 100644 (file)
@@ -173,7 +173,7 @@ static void vmsdbgout_end_source_file (unsigned int);
 static void vmsdbgout_begin_block (unsigned int, unsigned int);
 static void vmsdbgout_end_block (unsigned int, unsigned int);
 static bool vmsdbgout_ignore_block (const_tree);
-static void vmsdbgout_source_line (unsigned int, const char *, int);
+static void vmsdbgout_source_line (unsigned int, const char *, int, bool);
 static void vmsdbgout_begin_prologue (unsigned int, const char *);
 static void vmsdbgout_end_prologue (unsigned int, const char *);
 static void vmsdbgout_end_function (unsigned int);
@@ -1297,7 +1297,7 @@ vmsdbgout_end_prologue (unsigned int line, const char *file)
       ASM_OUTPUT_LABEL (asm_out_file, label);
 
       /* VMS PCA expects every PC range to correlate to some line and file.  */
-      vmsdbgout_source_line (line, file, 0);
+      vmsdbgout_source_line (line, file, 0, true);
     }
 }
 
@@ -1331,7 +1331,7 @@ vmsdbgout_end_epilogue (unsigned int line, const char *file)
       ASM_OUTPUT_LABEL (asm_out_file, label);
 
       /* VMS PCA expects every PC range to correlate to some line and file.  */
-      vmsdbgout_source_line (line, file, 0);
+      vmsdbgout_source_line (line, file, 0, true);
     }
 }
 
@@ -1534,10 +1534,10 @@ lookup_filename (const char *file_name)
 
 static void
 vmsdbgout_source_line (register unsigned line, register const char *filename,
-                       int discriminator)
+                       int discriminator, bool is_stmt)
 {
   if (write_symbols == VMS_AND_DWARF2_DEBUG)
-    (*dwarf2_debug_hooks.source_line) (line, filename, discriminator);
+    (*dwarf2_debug_hooks.source_line) (line, filename, discriminator, is_stmt);
 
   if (debug_info_level >= DINFO_LEVEL_TERSE)
     {
index 3c853544ec4b2f6f06566c30e04234bbc2530a11..0f13486ad1e2c0b28adb26be7291419eba0a21ef 100644 (file)
@@ -322,7 +322,8 @@ xcoffout_source_file (FILE *file, const char *filename, int inline_p)
 
 void
 xcoffout_source_line (unsigned int line, const char *filename,
-                      int discriminator ATTRIBUTE_UNUSED)
+                      int discriminator ATTRIBUTE_UNUSED,
+                      bool is_stmt ATTRIBUTE_UNUSED)
 {
   bool inline_p = (strcmp (xcoff_current_function_file, filename) != 0
                   || (int) line < xcoff_begin_function_line);
index caf8b08cc0b4f71a00031a099b4e864f18b9c53d..124c106a8b50ed56cb091a628596fc7c8664b58d 100644 (file)
@@ -182,4 +182,4 @@ extern void xcoffout_end_function (unsigned int);
 extern void xcoffout_end_block (unsigned, unsigned);
 extern int xcoff_assign_fundamental_type_number (tree);
 extern void xcoffout_declare_function (FILE *, tree, const char *);
-extern void xcoffout_source_line (unsigned int, const char *, int);
+extern void xcoffout_source_line (unsigned int, const char *, int, bool);
This page took 0.107102 seconds and 5 git commands to generate.