+2001-07-17 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * dbxout.c (dbxout_really_begin_function): Rename to
+ dbxout_begin_function.
+ (dbx_debug_hooks, xcoff_debug_hooks): Update.
+ (dbxout_begin_function): Remove.
+ (dbxout_function): Update.
+ (dbxout_source_line): Update prototype.
+ * dbxout.h (dbxout_begin_function): Remove.
+ * debug.c (do_nothing_debug_hooks): Update.
+ (debug_nothing_tree): Update.
+ (debug_nothing_charstar_rtx): Remove.
+ * debug.h (union tree_node): Declare.
+ (struct rtx_def): Remove.
+ (gcc_debug_hooks): New hooks begin_prologue, end_prologue,
+ begin_function. Change source_line prototype.
+ (debug_nothing_tree): New.
+ (debug_nothing_charstar_rtx): Delete.
+ (dwarf2out_begin_prologue): Moved from ...
+ * tree.h: ... here.
+ * dwarf2out.c (dwarf2_debug_hooks): Update.
+ (dwarf2out_begin_prologue): Update prototype. If genuine dwarf2
+ debug info, call dwarf2out_source_line.
+ (dwarf2out_souce_line): Update prototype.
+ * dwarfout.c (dwarfout_begin_function): Rename dwarfout_end_prologue.
+ Change prototype, make static.
+ (dwarfout_source_line): Update prototype.
+ (dwarf_debug_hooks): Update.
+ * dwarfout.h (dwarfout_begin_function): Remove.
+ * final.c (final_start_function, final_scan_insn): Use appropriate
+ debug hooks, update to use notice_source_line.
+ (output_source_line): Rename notice_source_line. Don't call the
+ source_line debug hook.
+ * sdbout.c (sdbout_begin_function): Rename sdbout_begin_prologue,
+ make static, update prototype.
+ (sdbout_mark_begin_function): Rename sdbout_begin_function, update
+ prototype.
+ (sdbout_end_prologue): New.
+ (sdbout_source_line): Update prototype.
+ (sdbout_debug_hooks): Update.
+ (sdbout_symbol): Remove unused var.
+ * sdbout.h (sdbout_begin_function, sdbout_mark_begin_function):
+ Delete.
+ * varasm.c: Include debug.h.
+ (assemble_start_function): Use begin_function debug_hook.
+ * xcoffout.c (xcoffout_begin_prologue): Rename xcoffout_begin_function,
+ update with prototype.
+ (xcoffout_source_line): Update prototype.
+ * xcoffout.h (xcoffout_begin_prologue): Rename xcoffout_begin_function,
+ update prototype.
+ (xcoffout_source_line): Update prototype.
+
2001-07-17 Richard Henderson <rth@redhat.com>
* c-typeck.c (build_binary_op): Do not shorten unsigned
static void dbxout_finish PARAMS ((const char *));
static void dbxout_start_source_file PARAMS ((unsigned, const char *));
static void dbxout_end_source_file PARAMS ((unsigned));
-static void dbxout_source_line PARAMS ((const char *, rtx));
+static void dbxout_source_line PARAMS ((unsigned int, const char *));
#if defined(ASM_OUTPUT_SECTION_NAME)
static void dbxout_function_end PARAMS ((void));
#endif
static void dbxout_prepare_symbol PARAMS ((tree));
static void dbxout_finish_symbol PARAMS ((tree));
static void dbxout_block PARAMS ((tree, int, tree));
-static void dbxout_really_begin_function PARAMS ((tree));
+static void dbxout_begin_function PARAMS ((tree));
\f
/* The debug hooks structure. */
#if defined (DBX_DEBUGGING_INFO)
dbxout_end_source_file,
dbxout_begin_block,
dbxout_end_block,
- dbxout_source_line,
+ dbxout_source_line, /* source_line */
+ dbxout_source_line, /* begin_prologue: just output line info */
+ debug_nothing_int, /* end_prologue */
debug_nothing_void, /* end_epilogue */
- debug_nothing_int /* end function */
+#ifdef DBX_FUNCTION_FIRST
+ dbxout_begin_function,
+#else
+ debug_nothing_tree, /* begin_function */
+#endif
+ debug_nothing_int /* end_function */
};
#endif /* DBX_DEBUGGING_INFO */
xcoffout_begin_block,
xcoffout_end_block,
xcoffout_source_line,
+ xcoffout_begin_prologue, /* begin_prologue */
+ debug_nothing_int, /* end_prologue */
xcoffout_end_epilogue,
+ debug_nothing_tree, /* begin_function */
xcoffout_end_function
};
#endif /* XCOFF_DEBUGGING_INFO */
}
}
-/* Output a line number symbol entry into output stream FILE,
- for source file FILENAME and line number LINENO. */
+/* Output a line number symbol entry for source file FILENAME and line
+ number LINENO. */
static void
-dbxout_source_line (filename, note)
+dbxout_source_line (lineno, filename)
+ unsigned int lineno;
const char *filename;
- rtx note;
{
- unsigned int lineno = NOTE_LINE_NUMBER (note);
-
dbxout_source_file (asmfile, filename);
#ifdef ASM_OUTPUT_SOURCE_LINE
but on some systems, it comes before. */
static void
-dbxout_really_begin_function (decl)
+dbxout_begin_function (decl)
tree decl;
{
dbxout_symbol (decl, 0);
dbxout_symbol (DECL_RESULT (decl), 1);
}
-/* Called at beginning of output of function definition. */
-
-void
-dbxout_begin_function (decl)
- tree decl ATTRIBUTE_UNUSED;
-{
-#ifdef DBX_FUNCTION_FIRST
- dbxout_really_begin_function (decl);
-#endif
-}
-
/* Output dbx data for a function definition.
This includes a definition of the function name itself (a symbol),
definitions of the parameters (locating them in the parameter list)
tree decl;
{
#ifndef DBX_FUNCTION_FIRST
- dbxout_really_begin_function (decl);
+ dbxout_begin_function (decl);
#endif
dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));
#ifdef DBX_OUTPUT_FUNCTION_END
extern void dbxout_reg_parms PARAMS ((tree));
extern int dbxout_syms PARAMS ((tree));
extern void dbxout_function PARAMS ((tree));
-extern void dbxout_begin_function PARAMS ((tree));
debug_nothing_int,
debug_nothing_int_int,
debug_nothing_int_int,
- debug_nothing_charstar_rtx,
- debug_nothing_void,
- debug_nothing_int
+ debug_nothing_int_charstar, /* source_line */
+ debug_nothing_int_charstar, /* begin_prologue */
+ debug_nothing_int, /* end_prologue */
+ debug_nothing_void, /* end_epilogue */
+ debug_nothing_tree, /* begin_function */
+ debug_nothing_int /* end_function */
};
/* This file contains implementations of each debug hook that do
{
}
+void
+debug_nothing_tree (decl)
+ union tree_node *decl ATTRIBUTE_UNUSED;
+{
+}
+
void
debug_nothing_charstar (main_filename)
const char *main_filename ATTRIBUTE_UNUSED;
unsigned int n ATTRIBUTE_UNUSED;
{
}
-
-void
-debug_nothing_charstar_rtx (filename, note)
- const char *filename ATTRIBUTE_UNUSED;
- struct rtx_def *note ATTRIBUTE_UNUSED;
-{
-}
#ifndef GCC_DEBUG_H
#define GCC_DEBUG_H
-struct rtx_def;
+union tree_node;
/* This structure contains hooks for the debug information output
functions, accessed through the global instance debug_hooks set in
/* Record the end of a block. Arguments as for begin_block. */
void (* end_block) PARAMS ((unsigned int line, unsigned int n));
- /* Record a line based on NOTE. Obtain the line number with
- NOTE_LINE_NUMBER (note). */
- void (* source_line) PARAMS ((const char *filename, struct rtx_def *note));
+ /* Record a source file location at (FILE, LINE). */
+ void (* source_line) PARAMS ((unsigned int line, const char *file));
+
+ /* Called at start of prologue code. LINE is the first line in the
+ function. This has been given the same prototype as source_line,
+ so that the source_line hook can be substituted if appropriate. */
+ void (* begin_prologue) PARAMS ((unsigned int line, const char *file));
+
+ /* Called at end of prologue code. LINE is the first line in the
+ function. */
+ void (* end_prologue) PARAMS ((unsigned int line));
/* Record end of epilogue code. */
void (* end_epilogue) PARAMS ((void));
+ /* Called at start of function DECL, before it is declared. */
+ void (* begin_function) PARAMS ((union tree_node *decl));
+
/* Record end of function. LINE is highest line number in function. */
void (* end_function) PARAMS ((unsigned int line));
};
PARAMS ((unsigned int));
extern void debug_nothing_int_int
PARAMS ((unsigned int, unsigned int));
-extern void debug_nothing_charstar_rtx
- PARAMS ((const char *, struct rtx_def *));
+extern void debug_nothing_tree
+ PARAMS ((union tree_node *));
/* Hooks for various debug formats. */
extern struct gcc_debug_hooks do_nothing_debug_hooks;
/* Dwarf2 frame information. */
+/* FILE is NULL iff being called for frame information for non-dwarf
+ debug output. */
+extern void dwarf2out_begin_prologue
+ PARAMS ((unsigned int, const char * file));
extern void dwarf2out_end_epilogue
PARAMS ((void));
#include "diagnostic.h"
#include "debug.h"
+#ifdef DWARF2_DEBUGGING_INFO
+static void dwarf2out_source_line PARAMS ((unsigned int, const char *));
+#endif
+
/* DWARF2 Abbreviation Glossary:
CFA = Canonical Frame Address
a fixed address on the stack which identifies a call frame.
the prologue. */
void
-dwarf2out_begin_prologue ()
+dwarf2out_begin_prologue (line, file)
+ unsigned int line ATTRIBUTE_UNUSED;
+ const char *file ATTRIBUTE_UNUSED;
{
char label[MAX_ARTIFICIAL_LABEL_BYTES];
register dw_fde_ref fde;
fde->uses_eh_lsda = cfun->uses_eh_lsda;
args_size = old_args_size = 0;
+
+ /* We only want to output line number information for the genuine
+ dwarf2 prologue case, not the eh frame case. */
+#ifdef DWARF2_DEBUGGING_INFO
+ if (file)
+ dwarf2out_source_line (line, file);
+#endif
}
/* Output a marker (i.e. a label) for the absolute end of the generated code
static void dwarf2out_end_source_file PARAMS ((unsigned));
static void dwarf2out_begin_block PARAMS ((unsigned, unsigned));
static void dwarf2out_end_block PARAMS ((unsigned, unsigned));
-static void dwarf2out_source_line PARAMS ((const char *, rtx));
/* The debug hooks structure. */
dwarf2out_begin_block,
dwarf2out_end_block,
dwarf2out_source_line,
+ dwarf2out_begin_prologue,
+ debug_nothing_int, /* end_prologue */
dwarf2out_end_epilogue,
+ debug_nothing_tree, /* begin_function */
debug_nothing_int /* end_function */
};
\f
'line_info_table' for later output of the .debug_line section. */
static void
-dwarf2out_source_line (filename, note)
+dwarf2out_source_line (line, filename)
+ unsigned int line;
register const char *filename;
- rtx note;
{
- unsigned int line = NOTE_LINE_NUMBER (note);
-
if (debug_info_level >= DINFO_LEVEL_NORMAL)
{
function_section (current_function_decl);
static void dwarfout_begin_block PARAMS ((unsigned, unsigned));
static void dwarfout_end_block PARAMS ((unsigned, unsigned));
static void dwarfout_end_epilogue PARAMS ((void));
-static void dwarfout_source_line PARAMS (( const char *, rtx));
+static void dwarfout_source_line PARAMS ((unsigned int, const char *));
+static void dwarfout_end_prologue PARAMS ((unsigned int));
static void dwarfout_end_function PARAMS ((unsigned int));
static const char *dwarf_tag_name PARAMS ((unsigned));
static const char *dwarf_attr_name PARAMS ((unsigned));
dwarfout_end_source_file_check,
dwarfout_begin_block,
dwarfout_end_block,
- dwarfout_source_line,
+ dwarfout_source_line, /* source_line */
+ dwarfout_source_line, /* begin_prologue */
+ dwarfout_end_prologue,
dwarfout_end_epilogue,
+ debug_nothing_tree, /* begin_function */
dwarfout_end_function
};
\f
the real body of the function begins (after parameters have been moved
to their home locations). */
-void
-dwarfout_begin_function ()
+static void
+dwarfout_end_prologue (line)
+ unsigned int line ATTRIBUTE_UNUSED;
{
char label[MAX_ARTIFICIAL_LABEL_BYTES];
if (! use_gnu_debug_info_extensions)
return;
+
function_section (current_function_decl);
sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
ASM_OUTPUT_LABEL (asm_out_file, label);
}
static void
-dwarfout_source_line (filename, note)
+dwarfout_source_line (line, filename)
+ unsigned int line;
const char *filename;
- rtx note;
{
- unsigned int line = NOTE_LINE_NUMBER (note);
-
if (debug_info_level >= DINFO_LEVEL_NORMAL
/* We can't emit line number info for functions in separate sections,
because the assembler can't subtract labels in different sections. */
Boston, MA 02111-1307, USA. */
extern void dwarfout_file_scope_decl PARAMS ((tree , int));
-
-extern void dwarfout_begin_function PARAMS ((void));
static void profile_after_prologue PARAMS ((FILE *));
static void add_bb PARAMS ((FILE *));
static int add_bb_string PARAMS ((const char *, int));
-static void output_source_line PARAMS ((rtx));
+static void notice_source_line PARAMS ((rtx));
static rtx walk_alter_subreg PARAMS ((rtx));
static void output_asm_name PARAMS ((void));
static void output_operand PARAMS ((rtx, int));
}
#endif
- /* Initial line number is supposed to be output
- before the function's prologue and label
- so that the function's address will not appear to be
- in the last statement of the preceding function. */
if (NOTE_LINE_NUMBER (first) != NOTE_INSN_DELETED)
- last_linenum = high_block_linenum = high_function_linenum
- = NOTE_LINE_NUMBER (first);
+ notice_source_line (first);
+ high_block_linenum = high_function_linenum = last_linenum;
-#if defined (DWARF2_UNWIND_INFO) || defined (IA64_UNWIND_INFO) \
- || defined (DWARF2_DEBUGGING_INFO)
- dwarf2out_begin_prologue ();
-#endif
+ (*debug_hooks->begin_prologue) (last_linenum, last_filename);
- /* For SDB and XCOFF, the function beginning must be marked between
- the function label and the prologue. We always need this, even when
- -g1 was used. Defer on MIPS systems so that parameter descriptions
- follow function entry. */
-#if defined(SDB_DEBUGGING_INFO) && !defined(MIPS_DEBUGGING_INFO)
- if (write_symbols == SDB_DEBUG)
- sdbout_begin_function (last_linenum);
- else
-#endif
-#ifdef XCOFF_DEBUGGING_INFO
- if (write_symbols == XCOFF_DEBUG)
- xcoffout_begin_function (file, last_linenum);
- else
+#if defined (DWARF2_UNWIND_INFO) || defined (IA64_UNWIND_INFO)
+ if (write_symbols != DWARF2_DEBUG)
+ dwarf2out_begin_prologue (0, NULL);
#endif
- /* But only output line number for other debug info types if -g2
- or better. */
- if (NOTE_LINE_NUMBER (first) != NOTE_INSN_DELETED)
- output_source_line (first);
#ifdef LEAF_REG_REMAP
if (current_function_uses_only_leaf_regs)
break;
case NOTE_INSN_FUNCTION_BEG:
-#if defined(SDB_DEBUGGING_INFO) && defined(MIPS_DEBUGGING_INFO)
- /* MIPS stabs require the parameter descriptions to be after the
- function entry point rather than before. */
- if (write_symbols == SDB_DEBUG)
- {
- app_disable ();
- sdbout_begin_function (last_linenum);
- }
-#endif
-#ifdef DWARF_DEBUGGING_INFO
- /* This outputs a marker where the function body starts, so it
- must be after the prologue. */
- if (write_symbols == DWARF_DEBUG)
- {
- app_disable ();
- dwarfout_begin_function ();
- }
-#endif
+ app_disable ();
+ (*debug_hooks->end_prologue) (last_linenum);
break;
case NOTE_INSN_BLOCK_BEG:
/* Output this line note if it is the first or the last line
note in a row. */
if (!note_after)
- output_source_line (insn);
+ {
+ notice_source_line (insn);
+ (*debug_hooks->source_line) (last_linenum, last_filename);
+ }
}
break;
}
based on the NOTE-insn INSN, assumed to be a line number. */
static void
-output_source_line (insn)
+notice_source_line (insn)
rtx insn;
{
register const char *filename = NOTE_SOURCE_FILE (insn);
last_linenum = NOTE_LINE_NUMBER (insn);
high_block_linenum = MAX (last_linenum, high_block_linenum);
high_function_linenum = MAX (last_linenum, high_function_linenum);
-
- (*debug_hooks->source_line) (filename, insn);
}
\f
/* For each operand in INSN, simplify (subreg (reg)) so that it refers
static void sdbout_end_source_file PARAMS ((unsigned));
static void sdbout_begin_block PARAMS ((unsigned, unsigned));
static void sdbout_end_block PARAMS ((unsigned, unsigned));
-static void sdbout_source_line PARAMS ((const char *, rtx));
+static void sdbout_source_line PARAMS ((unsigned int, const char *));
static void sdbout_end_epilogue PARAMS ((void));
+#ifndef MIPS_DEBUGGING_INFO
+static void sdbout_begin_prologue PARAMS ((unsigned int, const char *));
+#endif
+static void sdbout_end_prologue PARAMS ((unsigned int));
+static void sdbout_begin_function PARAMS ((tree));
static void sdbout_end_function PARAMS ((unsigned int));
static char *gen_fake_label PARAMS ((void));
static int plain_type PARAMS ((tree));
sdbout_begin_block,
sdbout_end_block,
sdbout_source_line,
+#ifdef MIPS_DEBUGGING_INFO
+ /* Defer on MIPS systems so that parameter descriptions follow
+ function entry. */
+ debug_nothing_int_charstar, /* begin_prologue */
+ sdbout_end_prologue, /* end_prologue */
+#else
+ sdbout_begin_prologue, /* begin_prologue */
+ debug_nothing_int, /* end_prologue */
+#endif
sdbout_end_epilogue,
+ sdbout_begin_function,
sdbout_end_function
};
\f
}
else if (GET_CODE (value) == SUBREG)
{
- int offset = 0;
-
while (GET_CODE (value) == SUBREG)
value = SUBREG_REG (value);
if (GET_CODE (value) == REG)
}
static void
-sdbout_source_line (filename, note)
+sdbout_source_line (line, filename)
+ unsigned int line;
const char *filename ATTRIBUTE_UNUSED;
- rtx note;
{
- unsigned int line = NOTE_LINE_NUMBER (note);
-
/* COFF relative line numbers must be positive. */
if (line > sdb_begin_function_line)
{
/* Output sdb info for the current function name.
Called from assemble_start_function. */
-void
-sdbout_mark_begin_function ()
+static void
+sdbout_begin_function (decl)
+ tree decl ATTRIBUTE_UNUSED;
{
sdbout_symbol (current_function_decl, 0);
}
-/* Called at beginning of function body (after prologue).
- Record the function's starting line number, so we can output
- relative line numbers for the other lines.
- Describe beginning of outermost block.
- Also describe the parameter list. */
+/* Called at beginning of function body (before or after prologue,
+ depending on MIPS_DEBUGGING_INFO). Record the function's starting
+ line number, so we can output relative line numbers for the other
+ lines. Describe beginning of outermost block. Also describe the
+ parameter list. */
-void
-sdbout_begin_function (line)
- int line;
+#ifndef MIPS_DEBUGGING_INFO
+static void
+sdbout_begin_prologue (line, file)
+ unsigned int line;
+ const char *file ATTRIBUTE_UNUSED;
+{
+ sdbout_end_prologue (line);
+}
+#endif
+
+static void
+sdbout_end_prologue (line)
+ unsigned int line;
{
sdb_begin_function_line = line - 1;
PUT_SDB_FUNCTION_START (line);
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-extern void sdbout_begin_function PARAMS ((int));
-
extern void sdbout_label PARAMS ((rtx));
extern void sdbout_symbol PARAMS ((tree, int));
extern void sdbout_toplevel_data PARAMS ((tree));
extern void sdbout_types PARAMS ((tree));
-
-extern void sdbout_mark_begin_function PARAMS ((void));
-
extern void dwarf2out_return_reg PARAMS ((const char *, unsigned));
-/* Output a marker (i.e. a label) for the beginning of a function, before
- the prologue. */
-
-extern void dwarf2out_begin_prologue PARAMS ((void));
-
\f
/* Redefine abort to report an internal error w/o coredump, and
reporting the location of the error in the source file. This logic
#include "c-pragma.h"
#include "ggc.h"
#include "tm_p.h"
+#include "debug.h"
#ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h"
ASM_OUTPUT_FUNCTION_PREFIX (asm_out_file, fnname);
#endif
-#ifdef SDB_DEBUGGING_INFO
- /* Output SDB definition of the function. */
- if (write_symbols == SDB_DEBUG)
- sdbout_mark_begin_function ();
-#endif
-
-#ifdef DBX_DEBUGGING_INFO
- /* Output DBX definition of the function. */
- if (write_symbols == DBX_DEBUG)
- dbxout_begin_function (decl);
-#endif
+ (*debug_hooks->begin_function) (decl);
/* Make function name accessible from other files, if appropriate. */
}
}
-/* Output a line number symbol entry into output stream FILE,
- for source file FILENAME and line number NOTE. */
+/* Output a line number symbol entry for location (FILENAME, LINE). */
void
-xcoffout_source_line (filename, note)
+xcoffout_source_line (line, filename)
+ unsigned int line;
const char *filename;
- rtx note;
{
- xcoffout_source_file (asm_out_file, filename, RTX_INTEGRATED_P (note));
+ bool inline_p = (strcmp (xcoff_current_function_file, filename) != 0
+ || (int) line < xcoff_begin_function_line);
+
+ xcoffout_source_file (asm_out_file, filename, inline_p);
- ASM_OUTPUT_SOURCE_LINE (asm_out_file, NOTE_LINE_NUMBER (note));
+ ASM_OUTPUT_SOURCE_LINE (asm_out_file, line);
}
\f
/* Output the symbols defined in block number DO_BLOCK.
name, name, name, name);
}
-/* Called at beginning of function body (after prologue).
+/* Called at beginning of function body (at start of prologue).
Record the function's starting line number, so we can output
relative line numbers for the other lines.
Record the file name that this function is contained in. */
void
-xcoffout_begin_function (file, last_linenum)
- FILE *file;
- int last_linenum;
+xcoffout_begin_prologue (line, file)
+ unsigned int line;
+ const char *file ATTRIBUTE_UNUSED;
{
- ASM_OUTPUT_LFB (file, last_linenum);
+ ASM_OUTPUT_LFB (asm_out_file, line);
dbxout_parms (DECL_ARGUMENTS (current_function_decl));
/* Emit the symbols for the outermost BLOCK's variables. sdbout.c does this
xcoffout_block (DECL_INITIAL (current_function_decl), 0,
DECL_ARGUMENTS (current_function_decl));
- ASM_OUTPUT_SOURCE_LINE (file, last_linenum);
+ ASM_OUTPUT_SOURCE_LINE (asm_out_file, line);
}
/* Called at end of function (before epilogue).
extern int stab_to_sclass PARAMS ((int));
#ifdef BUFSIZ
-extern void xcoffout_begin_function PARAMS ((FILE *, int));
+extern void xcoffout_begin_prologue PARAMS ((unsigned int,
+ const char *));
extern void xcoffout_begin_block PARAMS ((unsigned, unsigned));
extern void xcoffout_end_epilogue PARAMS ((void));
extern void xcoffout_end_function PARAMS ((unsigned int));
#ifdef RTX_CODE
#ifdef BUFSIZ
-extern void xcoffout_source_line PARAMS ((const char *, rtx));
+extern void xcoffout_source_line PARAMS ((unsigned int,
+ const char *));
#endif /* BUFSIZ */
#endif /* RTX_CODE */