Start on type debug hooks, take 2
Neil Booth
neil@daikokuya.demon.co.uk
Tue Jul 24 10:54:00 GMT 2001
The previous patch didn't bootstrap because objc, when invoked with
-print-objc-runtime-info would do some funky stuff creating structs in
its init() hook, which in turn caused debug routines to be called
through debug_hook. Except that was still NULL...
Bootstrapped and made check x86 Linux. OK to commit?
Neil.
* dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Update for type_decl.
* debug.c (do_nothing_debug_hooks): Similarly.
(debug_nothing_tree_int): New.
* debug.h (struct gcc_debug_hooks): Add type_decl.
(debug_nothing_tree_int): New.
* dwarf2out.c (dwarf2out_type_decl): New.
(dwarf2_debug_hooks): Update.
(dwarf2out_decl): Make static.
* dwarf2out.h (dwarf2out_decl): Remove.
* dwarfout.c (dwarf_debug_hooks): Update for type_decl.
* sdbout.c (sdb_debug_hooks): Similarly.
* toplev.c (rest_of_type_compilation): Use type_decl debug hook.
(compile_file): Move debug_hooks initialization to file scope.
============================================================
Index: gcc/dbxout.c
--- gcc/dbxout.c 2001/07/22 17:02:53 1.97
+++ gcc/dbxout.c 2001/07/24 17:51:52
@@ -345,6 +345,7 @@ struct gcc_debug_hooks dbx_debug_hooks =
debug_nothing_int, /* end_function */
dbxout_function_decl,
dbxout_global_decl, /* global_decl */
+ dbxout_symbol, /* type_decl */
debug_nothing_tree, /* deferred_inline_function */
debug_nothing_tree, /* outlining_inline_function */
debug_nothing_rtx /* label */
@@ -371,6 +372,7 @@ struct gcc_debug_hooks xcoff_debug_hooks
xcoffout_end_function,
debug_nothing_tree, /* function_decl */
dbxout_global_decl, /* global_decl */
+ dbxout_symbol, /* type_decl */
debug_nothing_tree, /* deferred_inline_function */
debug_nothing_tree, /* outlining_inline_function */
debug_nothing_rtx /* label */
============================================================
Index: gcc/debug.c
--- gcc/debug.c 2001/07/19 21:17:07 1.7
+++ gcc/debug.c 2001/07/24 17:51:52
@@ -39,6 +39,7 @@ struct gcc_debug_hooks do_nothing_debug_
debug_nothing_int, /* end_function */
debug_nothing_tree, /* function_decl */
debug_nothing_tree, /* global_decl */
+ debug_nothing_tree_int, /* type_decl */
debug_nothing_tree, /* deferred_inline_function */
debug_nothing_tree, /* outlining_inline_function */
debug_nothing_rtx /* label */
@@ -55,6 +56,13 @@ debug_nothing_void ()
void
debug_nothing_tree (decl)
union tree_node *decl ATTRIBUTE_UNUSED;
+{
+}
+
+void
+debug_nothing_tree_int (decl, local)
+ union tree_node *decl ATTRIBUTE_UNUSED;
+ int local ATTRIBUTE_UNUSED;
{
}
============================================================
Index: gcc/debug.h
--- gcc/debug.h 2001/07/19 21:17:07 1.7
+++ gcc/debug.h 2001/07/24 17:51:52
@@ -92,6 +92,10 @@ struct gcc_debug_hooks
compilation proper has finished. */
void (* global_decl) PARAMS ((union tree_node *decl));
+ /* Debug information for a type DECL. LOCAL is true if declared at
+ block scope. */
+ void (* type_decl) PARAMS ((union tree_node *decl, int local));
+
/* DECL is an inline function, whose body is present, but which is
not being output at this point. */
void (* deferred_inline_function) PARAMS ((union tree_node *decl));
@@ -121,6 +125,8 @@ extern void debug_nothing_int_int
PARAMS ((unsigned int, unsigned int));
extern void debug_nothing_tree
PARAMS ((union tree_node *));
+extern void debug_nothing_tree_int
+ PARAMS ((union tree_node *, int));
extern bool debug_true_tree
PARAMS ((union tree_node *));
extern void debug_nothing_rtx
============================================================
Index: gcc/dwarf2out.c
--- gcc/dwarf2out.c 2001/07/19 21:17:07 1.294
+++ gcc/dwarf2out.c 2001/07/24 17:52:24
@@ -3024,7 +3024,9 @@ static void dwarf2out_begin_block PARAMS
static void dwarf2out_end_block PARAMS ((unsigned, unsigned));
static bool dwarf2out_ignore_block PARAMS ((tree));
static void dwarf2out_global_decl PARAMS ((tree));
+static void dwarf2out_type_decl PARAMS ((tree, int));
static void dwarf2out_abstract_function PARAMS ((tree));
+static void dwarf2out_decl PARAMS ((tree));
/* The debug hooks structure. */
@@ -3047,6 +3049,7 @@ struct gcc_debug_hooks dwarf2_debug_hook
debug_nothing_int, /* end_function */
dwarf2out_decl, /* function_decl */
dwarf2out_global_decl,
+ dwarf2out_type_decl, /* type_decl */
debug_nothing_tree, /* deferred_inline_function */
/* The DWARF 2 backend tries to reduce debugging bloat by not
emitting the abstract description of inline functions until
@@ -11038,9 +11041,21 @@ dwarf2out_global_decl (decl)
dwarf2out_decl (decl);
}
+/* Debug information for a type DECL. LOCAL is true if declared at
+ block scope. */
+
+static void
+dwarf2out_type_decl (decl, local)
+ tree decl;
+ int local;
+{
+ if (!local)
+ dwarf2out_decl (decl);
+}
+
/* Write the debugging output for DECL. */
-void
+static void
dwarf2out_decl (decl)
register tree decl;
{
============================================================
Index: gcc/dwarf2out.h
--- gcc/dwarf2out.h 2001/07/19 21:17:08 1.18
+++ gcc/dwarf2out.h 2001/07/24 17:52:24
@@ -18,7 +18,6 @@ along with GNU CC; see the file COPYING.
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-extern void dwarf2out_decl PARAMS ((tree));
extern void dwarf2out_frame_debug PARAMS ((rtx));
extern void debug_dwarf PARAMS ((void));
============================================================
Index: gcc/dwarfout.c
--- gcc/dwarfout.c 2001/07/19 21:17:08 1.93
+++ gcc/dwarfout.c 2001/07/24 17:52:53
@@ -1396,6 +1396,7 @@ struct gcc_debug_hooks dwarf_debug_hooks
dwarfout_end_function,
dwarfout_function_decl,
dwarfout_global_decl,
+ debug_nothing_tree_int, /* type_decl */
dwarfout_deferred_inline_function,
debug_nothing_tree, /* outlining_inline_function */
debug_nothing_rtx /* label */
============================================================
Index: gcc/sdbout.c
--- gcc/sdbout.c 2001/07/22 17:02:53 1.54
+++ gcc/sdbout.c 2001/07/24 17:52:59
@@ -324,6 +324,7 @@ struct gcc_debug_hooks sdb_debug_hooks =
sdbout_end_function, /* end_function */
debug_nothing_tree, /* function_decl */
sdbout_global_decl, /* global_decl */
+ sdbout_symbol, /* type_decl */
debug_nothing_tree, /* deferred_inline_function */
debug_nothing_tree, /* outlining_inline_function */
sdbout_label
============================================================
Index: gcc/toplev.c
--- gcc/toplev.c 2001/07/23 14:08:12 1.496
+++ gcc/toplev.c 2001/07/24 17:53:19
@@ -218,9 +218,11 @@ const char *dump_base_name;
extern int target_flags;
-/* Debug hooks - dependent upon command line options. */
+/* Debug hooks - dependent upon command line options. ObjC's
+ generate_struct_by_value_array, called early from objc_init(),
+ calls finish_struct() and so needs this to point to something. */
-struct gcc_debug_hooks *debug_hooks;
+struct gcc_debug_hooks *debug_hooks = &do_nothing_debug_hooks;
/* Describes a dump file. */
@@ -2240,7 +2242,6 @@ compile_file (name)
/* Set up the debug hooks based on write_symbols. Default to doing
nothing. */
- debug_hooks = &do_nothing_debug_hooks;
#if defined(DBX_DEBUGGING_INFO)
if (write_symbols == DBX_DEBUG)
debug_hooks = &dbx_debug_hooks;
@@ -2562,27 +2563,11 @@ rest_of_decl_compilation (decl, asmspec,
void
rest_of_type_compilation (type, toplev)
-#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
tree type;
int toplev;
-#else
- tree type ATTRIBUTE_UNUSED;
- int toplev ATTRIBUTE_UNUSED;
-#endif
{
timevar_push (TV_SYMOUT);
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
- if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
- dbxout_symbol (TYPE_STUB_DECL (type), !toplev);
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG)
- sdbout_symbol (TYPE_STUB_DECL (type), !toplev);
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG && toplev)
- dwarf2out_decl (TYPE_STUB_DECL (type));
-#endif
+ (*debug_hooks->type_decl) (TYPE_STUB_DECL (type), !toplev);
timevar_pop (TV_SYMOUT);
}
More information about the Gcc-patches
mailing list