summaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-10 18:44:34 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-10 18:44:34 +0000
commitb896d81b737707c6eb57293637d54e7e8e50e8a2 (patch)
treebf9ce8c7e5bc03d0da6a7ffad30060744e0c393f /gcc/toplev.c
parent9d683ac834f075fef4d24e682f94a421f45c11f4 (diff)
downloadgcc-b896d81b737707c6eb57293637d54e7e8e50e8a2.tar.gz
* Makefile.in (toplev.o, sdbout.o, dbxout.o, dwarfout.o,
dwarf2out.o): Depend on debug.h, wrap long lines. * dbxout.c: Include debug.h. (dbx_debug_hooks): New. (dbxout_init): Make static, take just 2 args. (dbxout_finish): Make static. * dbxout.h (dbxout_init, dbxout_finish): Delete. * debug.c: New file. * debug.h: New file. * dwarf2out.c: Include debug.h. (dwarf2_debug_hooks): New. (dwarf2out_init): Make static. (dwarf2out_finish): Make static, take 2 args. * dwarf2out.h (dwarf2out_init, dwarf2out_finish): Delete. * dwarfout.c: Include debug.h. (dwarf_debug_hooks): New. (dwarfout_init): Make static. (dwarfout_finish): Make static, take 2 args. * dwarfout.h (dwarfout_init, dwarfout_finish): Delete. * sdbout.c: Include debug.h. (sdb_debug_hooks): New. (sdbout_init): Make static, take 2 args. * sdbout.h (sdbout_init): Delete. * toplev.c: Include debug.h. (debug_hooks): New. (compile_file): Set deubg_hooks based on command line options. Use the hooks unconditionally rather than conditional compilation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43908 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 7406d43cdbb..90258dfbecb 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -66,6 +66,7 @@ Boston, MA 02111-1307, USA. */
#include "reload.h"
#include "dwarf2asm.h"
#include "integrate.h"
+#include "debug.h"
#ifdef DWARF_DEBUGGING_INFO
#include "dwarfout.h"
@@ -225,6 +226,10 @@ const char *dump_base_name;
extern int target_flags;
+/* Debug hooks - dependent upon command line options. */
+
+struct gcc_debug_hooks *debug_hooks;
+
/* Describes a dump file. */
struct dump_file_info
@@ -2281,6 +2286,26 @@ compile_file (name)
#endif
} /* ! flag_syntax_only */
+ /* Set up the debug hooks based on write_symbols. Default to doing
+ nothing. */
+ debug_hooks = &do_nothing_debug_hooks;
+#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
+ if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
+ debug_hooks = &dbx_debug_hooks;
+#endif
+#ifdef SDB_DEBUGGING_INFO
+ if (write_symbols == SDB_DEBUG)
+ debug_hooks = &sdb_debug_hooks;
+#endif
+#ifdef DWARF_DEBUGGING_INFO
+ if (write_symbols == DWARF_DEBUG)
+ debug_hooks = &dwarf_debug_hooks;
+#endif
+#ifdef DWARF2_DEBUGGING_INFO
+ if (write_symbols == DWARF2_DEBUG)
+ debug_hooks = &dwarf2_debug_hooks;
+#endif
+
#ifndef ASM_OUTPUT_SECTION_NAME
if (flag_function_sections)
{
@@ -2309,26 +2334,12 @@ compile_file (name)
/* If dbx symbol table desired, initialize writing it
and output the predefined types. */
timevar_push (TV_SYMOUT);
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
- if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
- dbxout_init (asm_out_file, main_input_filename, getdecls ());
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG)
- sdbout_init (asm_out_file, main_input_filename, getdecls ());
-#endif
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG)
- dwarfout_init (asm_out_file, main_input_filename);
-#endif
#ifdef DWARF2_UNWIND_INFO
if (dwarf2out_do_frame ())
dwarf2out_frame_init ();
#endif
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG)
- dwarf2out_init (asm_out_file, main_input_filename);
-#endif
+
+ (*debug_hooks->init) (asm_out_file, main_input_filename);
timevar_pop (TV_SYMOUT);
/* Initialize yet another pass. */
@@ -2401,25 +2412,12 @@ compile_file (name)
/* Do dbx symbols. */
timevar_push (TV_SYMOUT);
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
- if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
- dbxout_finish (asm_out_file, main_input_filename);
-#endif
-
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG)
- dwarfout_finish ();
-#endif
-
#ifdef DWARF2_UNWIND_INFO
if (dwarf2out_do_frame ())
dwarf2out_frame_finish ();
#endif
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG)
- dwarf2out_finish ();
-#endif
+ (*debug_hooks->finish) (asm_out_file, main_input_filename);
timevar_pop (TV_SYMOUT);
/* Output some stuff at end of file if nec. */