Add a parameter to the begin_block debug hook that is a pointer to the
tree_node of the block in question. CodeView needs this as it records
line numbers of inlined functions in a different manner, so we need to
be able to tell if the block is actually the start of an inlined
function.

gcc/
        * debug.cc (do_nothing_debug_hooks): Change begin_block
        function pointer.
        (debug_nothing_int_int_tree): New function.
        * debug.h (struct gcc_debug_hooks): Add tree parameter to begin_block.
        (debug_nothing_int_int_tree): Add declaration.
        * dwarf2out.cc (dwarf2out_begin_block): Add tree parameter.
        (dwarf2_lineno_debug_hooks): Use new dummy function for begin_block.
        * final.cc (final_scan_insn_1): Pass insn block through to
        debug_hooks->begin_block.
        * vmsdbgout.cc (vmsdbgout_begin_block): Add tree parameter.
---
 gcc/debug.cc     | 9 ++++++++-
 gcc/debug.h      | 3 ++-
 gcc/dwarf2out.cc | 7 ++++---
 gcc/final.cc     | 2 +-
 gcc/vmsdbgout.cc | 5 +++--
 5 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/gcc/debug.cc b/gcc/debug.cc
index 81f6683f4e1..65725decdb1 100644
--- a/gcc/debug.cc
+++ b/gcc/debug.cc
@@ -32,7 +32,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
   debug_nothing_int_charstar,
   debug_nothing_int_charstar,
   debug_nothing_int,
-  debug_nothing_int_int,                /* begin_block */
+  debug_nothing_int_int_tree,           /* begin_block */
   debug_nothing_int_int,                /* end_block */
   debug_true_const_tree,                /* ignore_block */
   debug_nothing_int_int_charstar_int_bool, /* source_line */
@@ -146,6 +146,13 @@ debug_nothing_int_int (unsigned int line ATTRIBUTE_UNUSED,
 {
 }
 
+void
+debug_nothing_int_int_tree (unsigned int line ATTRIBUTE_UNUSED,
+                           unsigned int n ATTRIBUTE_UNUSED,
+                           tree block ATTRIBUTE_UNUSED)
+{
+}
+
 void
 debug_nothing_tree_int (tree decl ATTRIBUTE_UNUSED,
                        int local ATTRIBUTE_UNUSED)
diff --git a/gcc/debug.h b/gcc/debug.h
index 1d6642aad03..7d35d7d5877 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -57,7 +57,7 @@ struct gcc_debug_hooks
 
   /* Record the beginning of block N, counting from 1 and not
      including the function-scope block, at LINE.  */
-  void (* begin_block) (unsigned int line, unsigned int n);
+  void (* begin_block) (unsigned int line, unsigned int n, tree block);
 
   /* Record the end of a block.  Arguments as for begin_block.  */
   void (* end_block) (unsigned int line, unsigned int n);
@@ -223,6 +223,7 @@ extern void debug_nothing_int_int_charstar_int_bool 
(unsigned int,
                                                     int, bool);
 extern void debug_nothing_int (unsigned int);
 extern void debug_nothing_int_int (unsigned int, unsigned int);
+extern void debug_nothing_int_int_tree (unsigned int, unsigned int, tree);
 extern void debug_nothing_tree (tree);
 extern void debug_nothing_tree_tree (tree, tree);
 extern void debug_nothing_tree_int (tree, int);
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index a2621ec7c76..698926b41c0 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -2866,7 +2866,7 @@ static void dwarf2out_undef (unsigned int, const char *);
 static void dwarf2out_start_source_file (unsigned, const char *);
 static void dwarf2out_end_source_file (unsigned);
 static void dwarf2out_function_decl (tree);
-static void dwarf2out_begin_block (unsigned, unsigned);
+static void dwarf2out_begin_block (unsigned, unsigned, tree);
 static void dwarf2out_end_block (unsigned, unsigned);
 static bool dwarf2out_ignore_block (const_tree);
 static void dwarf2out_set_ignored_loc (unsigned, unsigned, const char *);
@@ -2951,7 +2951,7 @@ const struct gcc_debug_hooks dwarf2_lineno_debug_hooks =
   debug_nothing_int_charstar,
   debug_nothing_int_charstar,
   debug_nothing_int,
-  debug_nothing_int_int,                /* begin_block */
+  debug_nothing_int_int_tree,           /* begin_block */
   debug_nothing_int_int,                /* end_block */
   debug_true_const_tree,                /* ignore_block */
   dwarf2out_source_line,                /* source_line */
@@ -27806,7 +27806,8 @@ dwarf2out_function_decl (tree decl)
 
 static void
 dwarf2out_begin_block (unsigned int line ATTRIBUTE_UNUSED,
-                      unsigned int blocknum)
+                      unsigned int blocknum,
+                      tree block ATTRIBUTE_UNUSED)
 {
   switch_to_section (current_function_section ());
   ASM_OUTPUT_DEBUG_LABEL (asm_out_file, BLOCK_BEGIN_LABEL, blocknum);
diff --git a/gcc/final.cc b/gcc/final.cc
index 11141f2b56c..fa5b46e13b2 100644
--- a/gcc/final.cc
+++ b/gcc/final.cc
@@ -2300,7 +2300,7 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int 
optimize_p ATTRIBUTE_UNUSED,
 
              /* Output debugging info about the symbol-block beginning.  */
              if (!DECL_IGNORED_P (current_function_decl))
-               debug_hooks->begin_block (last_linenum, n);
+               debug_hooks->begin_block (last_linenum, n, NOTE_BLOCK (insn));
 
              /* Mark this block as output.  */
              TREE_ASM_WRITTEN (NOTE_BLOCK (insn)) = 1;
diff --git a/gcc/vmsdbgout.cc b/gcc/vmsdbgout.cc
index f5d0d84cf70..d9e6a8b7b74 100644
--- a/gcc/vmsdbgout.cc
+++ b/gcc/vmsdbgout.cc
@@ -154,7 +154,7 @@ static void vmsdbgout_define (unsigned int, const char *);
 static void vmsdbgout_undef (unsigned int, const char *);
 static void vmsdbgout_start_source_file (unsigned int, const char *);
 static void vmsdbgout_end_source_file (unsigned int);
-static void vmsdbgout_begin_block (unsigned int, unsigned int);
+static void vmsdbgout_begin_block (unsigned int, unsigned int, tree);
 static void vmsdbgout_end_block (unsigned int, unsigned int);
 static bool vmsdbgout_ignore_block (const_tree);
 static void vmsdbgout_source_line (unsigned int, unsigned int, const char *,
@@ -1230,7 +1230,8 @@ vmsdbgout_end_epilogue (unsigned int line, const char 
*file)
    a lexical block.  */
 
 static void
-vmsdbgout_begin_block (unsigned line, unsigned blocknum)
+vmsdbgout_begin_block (unsigned line, unsigned blocknum,
+                      tree block ATTRIBUTE_UNUSED)
 {
   if (write_symbols == VMS_AND_DWARF2_DEBUG)
     (*dwarf2_debug_hooks.begin_block) (line, blocknum);
-- 
2.45.2

Reply via email to