Makefile.in (toplev.o, [...]): Depend on debug.h, wrap long lines.

* 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.

From-SVN: r43908
This commit is contained in:
Neil Booth 2001-07-10 18:44:34 +00:00 committed by Neil Booth
parent baed53ac34
commit a51d908e98
13 changed files with 209 additions and 65 deletions

View File

@ -1,3 +1,33 @@
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

View File

@ -734,7 +734,7 @@ C_OBJS = c-parse.o c-lang.o $(C_AND_OBJC_OBJS)
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 \
@ -1339,7 +1339,7 @@ diagnostic.o : diagnostic.c diagnostic.h diagnostic.def \
$(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
@ -1391,17 +1391,19 @@ explow.o : explow.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.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) \

View File

@ -82,6 +82,7 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "tm_p.h"
#include "ggc.h"
#include "debug.h"
#ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h"
@ -283,6 +284,8 @@ static int current_sym_nchars;
#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
@ -306,6 +309,13 @@ static void dbxout_finish_symbol PARAMS ((tree));
static void dbxout_block PARAMS ((tree, int, tree));
static void dbxout_really_begin_function PARAMS ((tree));
/* The target debug structure. */
struct gcc_debug_hooks dbx_debug_hooks =
{
dbxout_init,
dbxout_finish
};
#if defined(ASM_OUTPUT_SECTION_NAME)
static void
dbxout_function_end ()
@ -332,13 +342,13 @@ 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;
@ -535,7 +545,7 @@ dbxout_source_line (file, filename, lineno)
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;

View File

@ -18,9 +18,6 @@ along with GNU CC; see the file COPYING. If not, write to
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));

37
gcc/debug.c Normal file
View File

@ -0,0 +1,37 @@
/* 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;
{
}

46
gcc/debug.h Normal file
View File

@ -0,0 +1,46 @@
/* 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 */

View File

@ -57,6 +57,7 @@ Boston, MA 02111-1307, USA. */
#include "md5.h"
#include "tm_p.h"
#include "diagnostic.h"
#include "debug.h"
/* DWARF2 Abbreviation Glossary:
CFA = Canonical Frame Address
@ -231,6 +232,8 @@ static unsigned current_funcdef_fde;
/* 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));
@ -360,7 +363,15 @@ expand_builtin_dwarf_fp_regnum ()
#ifndef INCOMING_FRAME_SP_OFFSET
#define INCOMING_FRAME_SP_OFFSET 0
#endif
/* The target debug structure. */
struct gcc_debug_hooks dwarf2_debug_hooks =
{
dwarf2out_init,
dwarf2out_finish
};
/* Return a pointer to a copy of the section string name S with all
attributes stripped off, and an asterisk prepended (for assemble_name). */
@ -11355,7 +11366,7 @@ dwarf2out_undef (lineno, buffer)
/* 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;
@ -11445,8 +11456,10 @@ dwarf2out_init (asm_out_file, 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;

View File

@ -18,9 +18,6 @@ along with GNU CC; see the file COPYING. If not, write to
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 *));

View File

@ -577,6 +577,7 @@ Boston, MA 02111-1307, USA. */
#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. */
@ -786,6 +787,8 @@ static int in_class;
/* 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));
@ -1357,6 +1360,13 @@ static void retry_incomplete_types PARAMS ((void));
ASM_OUTPUT_DWARF_STRING (FILE,P), ASM_OUTPUT_DWARF_STRING (FILE,"\n")
#endif
/* The target debug structure. */
struct gcc_debug_hooks dwarf_debug_hooks =
{
dwarfout_init,
dwarfout_finish
};
/************************ general utility functions **************************/
@ -6166,7 +6176,7 @@ dwarfout_undef (lineno, buffer)
/* 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;
@ -6356,8 +6366,10 @@ dwarfout_init (asm_out_file, 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];

View File

@ -18,9 +18,6 @@ along with GNU CC; see the file COPYING. If not, write to
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));

View File

@ -57,6 +57,7 @@ AT&T C compiler. From the example below I would conclude the following:
#include "ggc.h"
#include "tm_p.h"
#include "gsyms.h"
#include "debug.h"
/* 1 if PARM is passed to this function in memory. */
@ -91,6 +92,7 @@ extern tree current_function_decl;
#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));
@ -287,7 +289,13 @@ static struct sdb_file *current_file;
#endif /* MIPS_DEBUGGING_INFO */
/* The target debug structure. */
struct gcc_debug_hooks sdb_debug_hooks =
{
sdbout_init,
debug_nothing_init_finish
};
#if 0
/* return the tag identifier for type
@ -1607,11 +1615,10 @@ sdbout_resume_previous_source_file ()
/* 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);
@ -1621,7 +1628,7 @@ sdbout_init (asm_file, input_file_name, syms)
#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);

View File

@ -18,8 +18,6 @@ along with GNU CC; see the file COPYING. If not, write to
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));

View File

@ -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. */