+2001-07-10 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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.
+
Tue Jul 10 09:04:45 2001 Jeffrey A Law (law@cygnus.com)
* ssa-ccp.c (first_phi_node): Remove. Replace uses with calls to
OBJS = \
alias.o bb-reorder.o bitmap.o builtins.o caller-save.o calls.o \
- combine.o conflict.o convert.o cse.o cselib.o dbxout.o \
+ combine.o conflict.o convert.o cse.o cselib.o dbxout.o debug.o \
dependence.o df.o diagnostic.o doloop.o dominance.o dwarf2asm.o \
dwarf2out.o dwarfout.o emit-rtl.o except.o explow.o expmed.o expr.o \
final.o flow.o fold-const.o function.o gcse.o genrtl.o ggc-common.o \
$(GGC_H) input.h $(INSN_ATTR_H) insn-config.h toplev.h intl.h
toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) function.h \
flags.h input.h $(INSN_ATTR_H) xcoffout.h output.h diagnostic.h \
- insn-config.h intl.h $(RECOG_H) Makefile toplev.h dwarfout.h \
+ debug.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h dwarfout.h \
dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) $(lang_options_files) \
ssa.h $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h
optabs.o : optabs.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
insn-config.h $(EXPR_H) $(RECOG_H) reload.h \
toplev.h $(GGC_H) real.h $(TM_P_H) except.h
-dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h $(REGS_H) \
- insn-config.h reload.h gstab.h xcoffout.h output.h dbxout.h toplev.h \
- $(TM_P_H)
-sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h except.h \
+dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \
+ $(REGS_H) debug.h $(TM_P_H) \
+ insn-config.h reload.h gstab.h xcoffout.h output.h dbxout.h toplev.h
+debug.o : debug.c $(CONFIG_H) $(SYSTEM_H)
+sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \
function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) real.h \
insn-config.h $(OBSTACK_H) xcoffout.h c-pragma.h ggc.h \
- sdbout.h toplev.h $(TM_P_H)
+ sdbout.h toplev.h $(TM_P_H) except.h debug.h
dwarfout.o : dwarfout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf.h \
- flags.h insn-config.h reload.h output.h toplev.h dwarfout.h $(TM_P_H)
+ flags.h insn-config.h reload.h output.h toplev.h dwarfout.h $(TM_P_H) \
+ debug.h
dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf2.h \
- flags.h insn-config.h reload.h output.h diagnostic.h \
+ debug.h flags.h insn-config.h reload.h output.h diagnostic.h \
hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h varray.h \
$(GGC_H) except.h dwarf2asm.h $(TM_P_H)
dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) flags.h $(RTL_H) $(TREE_H) \
#include "toplev.h"
#include "tm_p.h"
#include "ggc.h"
+#include "debug.h"
#ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h"
#define CONTIN do { } while (0)
#endif
+static void dbxout_init PARAMS ((FILE *, const char *));
+static void dbxout_finish PARAMS ((FILE *, const char *));
#if defined(ASM_OUTPUT_SECTION_NAME)
static void dbxout_function_end PARAMS ((void));
#endif
static void dbxout_block PARAMS ((tree, int, tree));
static void dbxout_really_begin_function PARAMS ((tree));
\f
+/* The target debug structure. */
+struct gcc_debug_hooks dbx_debug_hooks =
+{
+ dbxout_init,
+ dbxout_finish
+};
+\f
#if defined(ASM_OUTPUT_SECTION_NAME)
static void
dbxout_function_end ()
/* At the beginning of compilation, start writing the symbol table.
Initialize `typevec' and output the standard data types of C. */
-void
-dbxout_init (asm_file, input_file_name, syms)
+static void
+dbxout_init (asm_file, input_file_name)
FILE *asm_file;
const char *input_file_name;
- tree syms;
{
char ltext_label_name[100];
+ tree syms = getdecls ();
asmfile = asm_file;
Unless you define DBX_OUTPUT_MAIN_SOURCE_FILE_END, the default is
to do nothing. */
-void
+static void
dbxout_finish (file, filename)
FILE *file ATTRIBUTE_UNUSED;
const char *filename ATTRIBUTE_UNUSED;
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-extern void dbxout_init PARAMS ((FILE *, const char *, tree));
-extern void dbxout_finish PARAMS ((FILE *, const char *));
-
extern void dbxout_start_new_source_file PARAMS ((const char *));
extern void dbxout_resume_previous_source_file PARAMS ((void));
--- /dev/null
+/* Do-nothing debug hooks for GCC.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "debug.h"
+
+/* The do-nothing debug hooks. */
+struct gcc_debug_hooks do_nothing_debug_hooks =
+{
+ debug_nothing_init_finish,
+ debug_nothing_init_finish
+};
+
+/* This file contains implementations of each debug hook that do
+ nothing. */
+
+void
+debug_nothing_init_finish (file, main_filename)
+ FILE *file ATTRIBUTE_UNUSED;
+ const char *main_filename ATTRIBUTE_UNUSED;
+{
+}
--- /dev/null
+/* Debug hooks for GCC.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef GCC_DEBUG_H
+#define GCC_DEBUG_H
+
+/* This structure contains hooks for the debug information output
+ functions, accessed through the global instance debug_hooks set in
+ toplev.c according to command line options. */
+struct gcc_debug_hooks
+{
+ /* Initialise debug output to FILE. MAIN_FILENAME is the name of
+ the main input file. */
+ void (* init) PARAMS ((FILE * file, const char *main_filename));
+
+ /* Output debug symbols to FILE. */
+ void (* finish) PARAMS ((FILE * file, const char *main_filename));
+};
+
+extern struct gcc_debug_hooks *debug_hooks;
+
+/* The do-nothing hooks. */
+extern void debug_nothing_init_finish
+ PARAMS ((FILE *, const char *));
+
+extern struct gcc_debug_hooks do_nothing_debug_hooks;
+extern struct gcc_debug_hooks dbx_debug_hooks;
+extern struct gcc_debug_hooks sdb_debug_hooks;
+extern struct gcc_debug_hooks dwarf_debug_hooks;
+extern struct gcc_debug_hooks dwarf2_debug_hooks;
+
+#endif /* !GCC_DEBUG_H */
#include "md5.h"
#include "tm_p.h"
#include "diagnostic.h"
+#include "debug.h"
/* DWARF2 Abbreviation Glossary:
CFA = Canonical Frame Address
/* Forward declarations for functions defined in this file. */
+static void dwarf2out_init PARAMS ((FILE *, const char *));
+static void dwarf2out_finish PARAMS ((FILE *, const char *));
static char *stripattributes PARAMS ((const char *));
static const char *dwarf_cfi_name PARAMS ((unsigned));
static dw_cfi_ref new_cfi PARAMS ((void));
#ifndef INCOMING_FRAME_SP_OFFSET
#define INCOMING_FRAME_SP_OFFSET 0
#endif
+\f
+/* The target debug structure. */
+struct gcc_debug_hooks dwarf2_debug_hooks =
+{
+ dwarf2out_init,
+ dwarf2out_finish
+};
+\f
/* Return a pointer to a copy of the section string name S with all
attributes stripped off, and an asterisk prepended (for assemble_name). */
/* Set up for Dwarf output at the start of compilation. */
-void
+static void
dwarf2out_init (asm_out_file, main_input_filename)
register FILE *asm_out_file;
register const char *main_input_filename;
/* Output stuff that dwarf requires at the end of every file,
and generate the DWARF-2 debugging info. */
-void
-dwarf2out_finish ()
+static void
+dwarf2out_finish (asm_out_file, input_filename)
+ register FILE *asm_out_file;
+ register const char *input_filename ATTRIBUTE_UNUSED;
{
limbo_die_node *node, *next_node;
dw_die_ref die = 0;
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-extern void dwarf2out_init PARAMS ((FILE *, const char *));
-extern void dwarf2out_finish PARAMS ((void));
-
extern void dwarf2out_define PARAMS ((unsigned, const char *));
extern void dwarf2out_undef PARAMS ((unsigned, const char *));
extern void dwarf2out_start_source_file PARAMS ((unsigned, const char *));
#include "dwarfout.h"
#include "toplev.h"
#include "tm_p.h"
+#include "debug.h"
/* IMPORTANT NOTE: Please see the file README.DWARF for important details
regarding the GNU implementation of Dwarf. */
/* Forward declarations for functions defined in this file. */
+static void dwarfout_init PARAMS ((FILE *, const char *));
+static void dwarfout_finish PARAMS ((FILE *, const char *));
static const char *dwarf_tag_name PARAMS ((unsigned));
static const char *dwarf_attr_name PARAMS ((unsigned));
static const char *dwarf_stack_op_name PARAMS ((unsigned));
ASM_OUTPUT_DWARF_STRING (FILE,P), ASM_OUTPUT_DWARF_STRING (FILE,"\n")
#endif
+\f
+/* The target debug structure. */
+struct gcc_debug_hooks dwarf_debug_hooks =
+{
+ dwarfout_init,
+ dwarfout_finish
+};
\f
/************************ general utility functions **************************/
/* Set up for Dwarf output at the start of compilation. */
-void
+static void
dwarfout_init (asm_out_file, main_input_filename)
register FILE *asm_out_file;
register const char *main_input_filename;
/* Output stuff that dwarf requires at the end of every file. */
-void
-dwarfout_finish ()
+static void
+dwarfout_finish (asm_out_file, main_input_filename)
+ register FILE *asm_out_file;
+ register const char *main_input_filename ATTRIBUTE_UNUSED;
{
char label[MAX_ARTIFICIAL_LABEL_BYTES];
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-extern void dwarfout_init PARAMS ((FILE *, const char *));
-extern void dwarfout_finish PARAMS ((void));
-
extern void dwarfout_define PARAMS ((unsigned, const char *));
extern void dwarfout_undef PARAMS ((unsigned, const char *));
extern void dwarfout_file_scope_decl PARAMS ((tree , int));
#include "ggc.h"
#include "tm_p.h"
#include "gsyms.h"
+#include "debug.h"
/* 1 if PARM is passed to this function in memory. */
#include "sdbout.h"
+static void sdbout_init PARAMS ((FILE *, const char *));
static char *gen_fake_label PARAMS ((void));
static int plain_type PARAMS ((tree));
static int template_name_p PARAMS ((tree));
#endif /* MIPS_DEBUGGING_INFO */
\f
-
+/* The target debug structure. */
+struct gcc_debug_hooks sdb_debug_hooks =
+{
+ sdbout_init,
+ debug_nothing_init_finish
+};
+\f
#if 0
/* return the tag identifier for type
/* Set up for SDB output at the start of compilation. */
-void
-sdbout_init (asm_file, input_file_name, syms)
+static void
+sdbout_init (asm_file, input_file_name)
FILE *asm_file ATTRIBUTE_UNUSED;
const char *input_file_name ATTRIBUTE_UNUSED;
- tree syms ATTRIBUTE_UNUSED;
{
#ifdef MIPS_DEBUGGING_INFO
current_file = (struct sdb_file *) xmalloc (sizeof *current_file);
#ifdef RMS_QUICK_HACK_1
tree t;
- for (t = syms; t; t = TREE_CHAIN (t))
+ for (t = getdecls (); t; t = TREE_CHAIN (t))
if (DECL_NAME (t) && IDENTIFIER_POINTER (DECL_NAME (t)) != 0
&& !strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__vtbl_ptr_type"))
sdbout_symbol (t, 0);
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-extern void sdbout_init PARAMS ((FILE *, const char *, tree));
-
extern void sdbout_begin_function PARAMS ((int));
extern void sdbout_end_function PARAMS ((int));
#include "reload.h"
#include "dwarf2asm.h"
#include "integrate.h"
+#include "debug.h"
#ifdef DWARF_DEBUGGING_INFO
#include "dwarfout.h"
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
#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)
{
/* 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. */
/* 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. */