Commit 9a666dda by Jason Merrill

x

From-SVN: r13160
parent f3ff3f4a
...@@ -434,12 +434,8 @@ check_newline () ...@@ -434,12 +434,8 @@ check_newline ()
&& getc (finput) == 'e' && getc (finput) == 'e'
&& ((c = getc (finput)) == ' ' || c == '\t' || c == '\n')) && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
{ {
#ifdef DWARF_DEBUGGING_INFO if (c != '\n')
if (c != '\n' debug_define (lineno, get_directive_line (finput));
&& (debug_info_level == DINFO_LEVEL_VERBOSE)
&& (write_symbols == DWARF_DEBUG))
dwarfout_define (lineno, get_directive_line (finput));
#endif /* DWARF_DEBUGGING_INFO */
goto skipline; goto skipline;
} }
} }
...@@ -451,12 +447,8 @@ check_newline () ...@@ -451,12 +447,8 @@ check_newline ()
&& getc (finput) == 'f' && getc (finput) == 'f'
&& ((c = getc (finput)) == ' ' || c == '\t' || c == '\n')) && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
{ {
#ifdef DWARF_DEBUGGING_INFO if (c != '\n')
if (c != '\n' debug_undef (lineno, get_directive_line (finput));
&& (debug_info_level == DINFO_LEVEL_VERBOSE)
&& (write_symbols == DWARF_DEBUG))
dwarfout_undef (lineno, get_directive_line (finput));
#endif /* DWARF_DEBUGGING_INFO */
goto skipline; goto skipline;
} }
} }
...@@ -608,16 +600,7 @@ linenum: ...@@ -608,16 +600,7 @@ linenum:
p->name = input_filename; p->name = input_filename;
input_file_stack = p; input_file_stack = p;
input_file_stack_tick++; input_file_stack_tick++;
#ifdef DBX_DEBUGGING_INFO debug_start_source_file (input_filename);
if (write_symbols == DBX_DEBUG)
dbxout_start_new_source_file (input_filename);
#endif
#ifdef DWARF_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& write_symbols == DWARF_DEBUG)
dwarfout_start_new_source_file (input_filename);
#endif /* DWARF_DEBUGGING_INFO */
used_up = 1; used_up = 1;
} }
else if (TREE_INT_CST_LOW (yylval.ttype) == 2) else if (TREE_INT_CST_LOW (yylval.ttype) == 2)
...@@ -629,15 +612,7 @@ linenum: ...@@ -629,15 +612,7 @@ linenum:
input_file_stack = p->next; input_file_stack = p->next;
free (p); free (p);
input_file_stack_tick++; input_file_stack_tick++;
#ifdef DBX_DEBUGGING_INFO debug_end_source_file (input_file_stack->line);
if (write_symbols == DBX_DEBUG)
dbxout_resume_previous_source_file ();
#endif
#ifdef DWARF_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& write_symbols == DWARF_DEBUG)
dwarfout_resume_previous_source_file (input_file_stack->line);
#endif /* DWARF_DEBUGGING_INFO */
} }
else else
error ("#-lines for entering and leaving files don't match"); error ("#-lines for entering and leaving files don't match");
......
...@@ -88,12 +88,11 @@ Boston, MA 02111-1307, USA. */ ...@@ -88,12 +88,11 @@ Boston, MA 02111-1307, USA. */
%{mabi=64: -D__mips64} \ %{mabi=64: -D__mips64} \
%{!mabi*: -D__mips64}" %{!mabi*: -D__mips64}"
/* Irix 6 uses DWARF. */ /* Irix 6 uses DWARF-2. */
#define DWARF_DEBUGGING_INFO #define DWARF2_DEBUGGING_INFO
#define DWARF_VERSION 2
#define MIPS_DEBUGGING_INFO #define MIPS_DEBUGGING_INFO
#undef PREFERRED_DEBUGGING_TYPE #undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
/* The size in bytes of a DWARF field indicating an offset or length /* The size in bytes of a DWARF field indicating an offset or length
relative to a debug info section, specified to be 4 bytes in the DWARF-2 relative to a debug info section, specified to be 4 bytes in the DWARF-2
...@@ -479,7 +478,7 @@ do { \ ...@@ -479,7 +478,7 @@ do { \
#define LINK_SPEC "\ #define LINK_SPEC "\
%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \ %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
%{bestGnum} %{shared} %{non_shared} \ %{bestGnum} %{shared} %{non_shared} \
%{call_shared} %{no_archive} %{exact_version} \ %{call_shared} %{no_archive} %{exact_version} %{w} \
%{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \ %{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \
%{rpath} -init __do_global_ctors -fini __do_global_dtors \ %{rpath} -init __do_global_ctors -fini __do_global_dtors \
%{shared:-hidden_symbol __do_global_ctors,__do_global_dtors} \ %{shared:-hidden_symbol __do_global_ctors,__do_global_dtors} \
......
...@@ -880,7 +880,7 @@ while (0) ...@@ -880,7 +880,7 @@ while (0)
#define MIPS_DEBUGGING_INFO /* MIPS specific debugging info */ #define MIPS_DEBUGGING_INFO /* MIPS specific debugging info */
#ifndef PREFERRED_DEBUGGING_TYPE /* assume SDB_DEBUGGING_INFO */ #ifndef PREFERRED_DEBUGGING_TYPE /* assume SDB_DEBUGGING_INFO */
#define PREFERRED_DEBUGGING_TYPE ((len > 1 && !strncmp (str, "ggdb", len)) ? DBX_DEBUG : SDB_DEBUG) #define PREFERRED_DEBUGGING_TYPE ((!strncmp (str, "ggdb", 4)) ? DBX_DEBUG : SDB_DEBUG)
#endif #endif
/* By default, turn on GDB extensions. */ /* By default, turn on GDB extensions. */
......
...@@ -245,6 +245,10 @@ do { \ ...@@ -245,6 +245,10 @@ do { \
#define DWARF_DEBUGGING_INFO #define DWARF_DEBUGGING_INFO
/* All ELF targets can support DWARF-2. */
#define DWARF2_DEBUGGING_INFO
/* The numbers used to denote specific machine registers in the System V /* The numbers used to denote specific machine registers in the System V
Release 4 DWARF debugging information are quite likely to be totally Release 4 DWARF debugging information are quite likely to be totally
different from the numbers used in BSD stabs debugging information different from the numbers used in BSD stabs debugging information
......
...@@ -21,10 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -21,10 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "config.h" #include "config.h"
#ifndef DWARF_VERSION #ifdef DWARF2_DEBUGGING_INFO
#define DWARF_VERSION 1
#endif
#if defined (DWARF_DEBUGGING_INFO) && (DWARF_VERSION == 2)
#include <stdio.h> #include <stdio.h>
#include "dwarf2.h" #include "dwarf2.h"
#include "tree.h" #include "tree.h"
...@@ -321,6 +318,8 @@ extern char *language_string; ...@@ -321,6 +318,8 @@ extern char *language_string;
#define DWARF_OFFSET_SIZE 4 #define DWARF_OFFSET_SIZE 4
#endif #endif
#define DWARF_VERSION 2
/* Fixed size portion of the DWARF compilation unit header. */ /* Fixed size portion of the DWARF compilation unit header. */
#define DWARF_COMPILE_UNIT_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 3) #define DWARF_COMPILE_UNIT_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 3)
...@@ -405,7 +404,7 @@ static unsigned file_table_in_use; ...@@ -405,7 +404,7 @@ static unsigned file_table_in_use;
#define FILE_TABLE_INCREMENT 64 #define FILE_TABLE_INCREMENT 64
/* Local pointer to the name of the main input file. Initialized in /* Local pointer to the name of the main input file. Initialized in
dwarfout_init. */ dwarf2out_init. */
static char *primary_filename; static char *primary_filename;
/* For Dwarf output, we must assign lexical-blocks id numbers in the order in /* For Dwarf output, we must assign lexical-blocks id numbers in the order in
...@@ -5617,7 +5616,7 @@ add_location_or_const_value_attribute (die, decl) ...@@ -5617,7 +5616,7 @@ add_location_or_const_value_attribute (die, decl)
(at debug-time) will show the function as having been called with the (at debug-time) will show the function as having been called with the
*new* value rather than the value which was originally passed in. This *new* value rather than the value which was originally passed in. This
happens rarely enough that it is not a major problem, but it *is* a happens rarely enough that it is not a major problem, but it *is* a
problem, and I'd like to fix it. A future version of dwarfout.c may problem, and I'd like to fix it. A future version of dwarf2out.c may
generate two additional attributes for any given DW_TAG_formal_parameter generate two additional attributes for any given DW_TAG_formal_parameter
DIE which will describe the "passed type" and the "passed location" for DIE which will describe the "passed type" and the "passed location" for
the given formal parameter in addition to the attributes we now generate the given formal parameter in addition to the attributes we now generate
...@@ -6197,7 +6196,7 @@ decl_start_label (decl) ...@@ -6197,7 +6196,7 @@ decl_start_label (decl)
/* These routines generate the internnal representation of the DIE's for /* These routines generate the internnal representation of the DIE's for
the compilation unit. Debugging information is collected by walking the compilation unit. Debugging information is collected by walking
the declaration trees passed in from dwarfout_file_scope_decl(). */ the declaration trees passed in from dwarf2out_file_scope_decl(). */
static void static void
gen_array_type_die (type, context_die) gen_array_type_die (type, context_die)
...@@ -7626,7 +7625,7 @@ gen_decl_die (decl, context_die) ...@@ -7626,7 +7625,7 @@ gen_decl_die (decl, context_die)
/***************** Debug Information Generation Hooks ***********************/ /***************** Debug Information Generation Hooks ***********************/
void void
dwarfout_file_scope_decl (decl, set_finalizing) dwarf2out_file_scope_decl (decl, set_finalizing)
register tree decl; register tree decl;
register int set_finalizing; register int set_finalizing;
{ {
...@@ -7755,7 +7754,7 @@ dwarfout_file_scope_decl (decl, set_finalizing) ...@@ -7755,7 +7754,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
/* Output a marker (i.e. a label) for the beginning of the generated code for /* Output a marker (i.e. a label) for the beginning of the generated code for
a lexical block. */ a lexical block. */
void void
dwarfout_begin_block (blocknum) dwarf2out_begin_block (blocknum)
register unsigned blocknum; register unsigned blocknum;
{ {
function_section (current_function_decl); function_section (current_function_decl);
...@@ -7765,7 +7764,7 @@ dwarfout_begin_block (blocknum) ...@@ -7765,7 +7764,7 @@ dwarfout_begin_block (blocknum)
/* Output a marker (i.e. a label) for the end of the generated code for a /* Output a marker (i.e. a label) for the end of the generated code for a
lexical block. */ lexical block. */
void void
dwarfout_end_block (blocknum) dwarf2out_end_block (blocknum)
register unsigned blocknum; register unsigned blocknum;
{ {
function_section (current_function_decl); function_section (current_function_decl);
...@@ -7775,7 +7774,7 @@ dwarfout_end_block (blocknum) ...@@ -7775,7 +7774,7 @@ dwarfout_end_block (blocknum)
/* Output a marker (i.e. a label) at a point in the assembly code which /* Output a marker (i.e. a label) at a point in the assembly code which
corresponds to a given source level label. */ corresponds to a given source level label. */
void void
dwarfout_label (insn) dwarf2out_label (insn)
register rtx insn; register rtx insn;
{ {
char label[MAX_ARTIFICIAL_LABEL_BYTES]; char label[MAX_ARTIFICIAL_LABEL_BYTES];
...@@ -7791,7 +7790,7 @@ dwarfout_label (insn) ...@@ -7791,7 +7790,7 @@ dwarfout_label (insn)
/* Output a marker (i.e. a label) for the beginning of a function, before /* Output a marker (i.e. a label) for the beginning of a function, before
the prologue. */ the prologue. */
void void
dwarfout_begin_prologue () dwarf2out_begin_prologue ()
{ {
char label[MAX_ARTIFICIAL_LABEL_BYTES]; char label[MAX_ARTIFICIAL_LABEL_BYTES];
register dw_fde_ref fde; register dw_fde_ref fde;
...@@ -7825,7 +7824,7 @@ dwarfout_begin_prologue () ...@@ -7825,7 +7824,7 @@ dwarfout_begin_prologue ()
the real body of the function begins (after parameters have been moved to the real body of the function begins (after parameters have been moved to
their home locations). */ their home locations). */
void void
dwarfout_begin_function () dwarf2out_begin_function ()
{ {
char label[MAX_ARTIFICIAL_LABEL_BYTES]; char label[MAX_ARTIFICIAL_LABEL_BYTES];
register long int offset; register long int offset;
...@@ -7919,7 +7918,7 @@ dwarfout_begin_function () ...@@ -7919,7 +7918,7 @@ dwarfout_begin_function ()
/* Output a marker (i.e. a label) for the point in the generated code where /* Output a marker (i.e. a label) for the point in the generated code where
the real body of the function ends (just before the epilogue code). */ the real body of the function ends (just before the epilogue code). */
void void
dwarfout_end_function () dwarf2out_end_function ()
{ {
dw_fde_ref fde; dw_fde_ref fde;
char label[MAX_ARTIFICIAL_LABEL_BYTES]; char label[MAX_ARTIFICIAL_LABEL_BYTES];
...@@ -7935,7 +7934,7 @@ dwarfout_end_function () ...@@ -7935,7 +7934,7 @@ dwarfout_end_function ()
for a function definition. This gets called *after* the epilogue code has for a function definition. This gets called *after* the epilogue code has
been generated. */ been generated. */
void void
dwarfout_end_epilogue () dwarf2out_end_epilogue ()
{ {
dw_fde_ref fde; dw_fde_ref fde;
char label[MAX_ARTIFICIAL_LABEL_BYTES]; char label[MAX_ARTIFICIAL_LABEL_BYTES];
...@@ -7948,7 +7947,7 @@ dwarfout_end_epilogue () ...@@ -7948,7 +7947,7 @@ dwarfout_end_epilogue ()
} }
/* Lookup a filename (in the list of filenames that we know about here in /* Lookup a filename (in the list of filenames that we know about here in
dwarfout.c) and return its "index". The index of each (known) filename is dwarf2out.c) and return its "index". The index of each (known) filename is
just a unique number which is associated with only that one filename. just a unique number which is associated with only that one filename.
We need such numbers for the sake of generating labels We need such numbers for the sake of generating labels
(in the .debug_sfnames section) and references to those (in the .debug_sfnames section) and references to those
...@@ -8007,7 +8006,7 @@ lookup_filename (file_name) ...@@ -8007,7 +8006,7 @@ lookup_filename (file_name)
and record information relating to this source line, in and record information relating to this source line, in
'line_info_table' for later output of the .debug_line section. */ 'line_info_table' for later output of the .debug_line section. */
void void
dwarfout_line (filename, line) dwarf2out_line (filename, line)
register char *filename; register char *filename;
register unsigned line; register unsigned line;
{ {
...@@ -8067,16 +8066,15 @@ dwarfout_line (filename, line) ...@@ -8067,16 +8066,15 @@ dwarfout_line (filename, line)
/* Record the beginning of a new source file, for later output /* Record the beginning of a new source file, for later output
of the .debug_macinfo section. At present, unimplemented. */ of the .debug_macinfo section. At present, unimplemented. */
void void
dwarfout_start_new_source_file (filename) dwarf2out_start_source_file (filename)
register char *filename; register char *filename;
{ {
} }
/* Record the resumption of a source file, for later output /* Record the end of a source file, for later output
of the .debug_macinfo section. At present, unimplemented. */ of the .debug_macinfo section. At present, unimplemented. */
void void
dwarfout_resume_previous_source_file (lineno) dwarf2out_end_source_file ()
register unsigned lineno;
{ {
} }
...@@ -8084,14 +8082,14 @@ dwarfout_resume_previous_source_file (lineno) ...@@ -8084,14 +8082,14 @@ dwarfout_resume_previous_source_file (lineno)
the tail part of the directive line, i.e. the part which is past the the tail part of the directive line, i.e. the part which is past the
initial whitespace, #, whitespace, directive-name, whitespace part. */ initial whitespace, #, whitespace, directive-name, whitespace part. */
void void
dwarfout_define (lineno, buffer) dwarf2out_define (lineno, buffer)
register unsigned lineno; register unsigned lineno;
register char *buffer; register char *buffer;
{ {
static int initialized = 0; static int initialized = 0;
if (!initialized) if (!initialized)
{ {
dwarfout_start_new_source_file (primary_filename); dwarf2out_start_source_file (primary_filename);
initialized = 1; initialized = 1;
} }
} }
...@@ -8100,7 +8098,7 @@ dwarfout_define (lineno, buffer) ...@@ -8100,7 +8098,7 @@ dwarfout_define (lineno, buffer)
the tail part of the directive line, i.e. the part which is past the the tail part of the directive line, i.e. the part which is past the
initial whitespace, #, whitespace, directive-name, whitespace part. */ initial whitespace, #, whitespace, directive-name, whitespace part. */
void void
dwarfout_undef (lineno, buffer) dwarf2out_undef (lineno, buffer)
register unsigned lineno; register unsigned lineno;
register char *buffer; register char *buffer;
{ {
...@@ -8108,7 +8106,7 @@ dwarfout_undef (lineno, buffer) ...@@ -8108,7 +8106,7 @@ dwarfout_undef (lineno, buffer)
/* Set up for Dwarf output at the start of compilation. */ /* Set up for Dwarf output at the start of compilation. */
void void
dwarfout_init (asm_out_file, main_input_filename) dwarf2out_init (asm_out_file, main_input_filename)
register FILE *asm_out_file; register FILE *asm_out_file;
register char *main_input_filename; register char *main_input_filename;
{ {
...@@ -8185,7 +8183,7 @@ dwarfout_init (asm_out_file, main_input_filename) ...@@ -8185,7 +8183,7 @@ dwarfout_init (asm_out_file, main_input_filename)
/* Output stuff that dwarf requires at the end of every file, /* Output stuff that dwarf requires at the end of every file,
and generate the DWARF-2 debugging info. */ and generate the DWARF-2 debugging info. */
void void
dwarfout_finish () dwarf2out_finish ()
{ {
/* Traverse the DIE tree and add sibling attributes to those DIE's /* Traverse the DIE tree and add sibling attributes to those DIE's
that have children. */ that have children. */
...@@ -8266,4 +8264,4 @@ dwarfout_finish () ...@@ -8266,4 +8264,4 @@ dwarfout_finish ()
output_aranges (); output_aranges ();
} }
} }
#endif /* DWARF_DEBUGGING_INFO && DWARF_VERSION == 2 */ #endif /* DWARF2_DEBUGGING_INFO */
...@@ -21,10 +21,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -21,10 +21,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h" #include "config.h"
#ifndef DWARF_VERSION #ifdef DWARF_DEBUGGING_INFO
#define DWARF_VERSION 1
#endif
#if defined (DWARF_DEBUGGING_INFO) && (DWARF_VERSION != 2)
#include <stdio.h> #include <stdio.h>
#include "dwarf.h" #include "dwarf.h"
#include "tree.h" #include "tree.h"
...@@ -5734,4 +5731,4 @@ dwarfout_finish () ...@@ -5734,4 +5731,4 @@ dwarfout_finish ()
} }
} }
#endif /* DWARF_DEBUGGING_INFO && DWARF_VERSION != 2 */ #endif /* DWARF_DEBUGGING_INFO */
...@@ -895,10 +895,10 @@ final_start_function (first, file, optimize) ...@@ -895,10 +895,10 @@ final_start_function (first, file, optimize)
last_linenum = high_block_linenum = high_function_linenum last_linenum = high_block_linenum = high_function_linenum
= NOTE_LINE_NUMBER (first); = NOTE_LINE_NUMBER (first);
#if defined (DWARF_DEBUGGING_INFO) && DWARF_VERSION == 2 #ifdef DWARF2_DEBUGGING_INFO
/* Output DWARF definition of the function. */ /* Output DWARF definition of the function. */
if (write_symbols == DWARF_DEBUG) if (write_symbols == DWARF2_DEBUG)
dwarfout_begin_prologue (); dwarf2out_begin_prologue ();
#endif #endif
/* For SDB and XCOFF, the function beginning must be marked between /* For SDB and XCOFF, the function beginning must be marked between
...@@ -1066,6 +1066,11 @@ final_end_function (first, file, optimize) ...@@ -1066,6 +1066,11 @@ final_end_function (first, file, optimize)
dwarfout_end_function (); dwarfout_end_function ();
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG)
dwarf2out_end_function ();
#endif
#ifdef XCOFF_DEBUGGING_INFO #ifdef XCOFF_DEBUGGING_INFO
if (write_symbols == XCOFF_DEBUG) if (write_symbols == XCOFF_DEBUG)
xcoffout_end_function (file, high_function_linenum); xcoffout_end_function (file, high_function_linenum);
...@@ -1087,6 +1092,11 @@ final_end_function (first, file, optimize) ...@@ -1087,6 +1092,11 @@ final_end_function (first, file, optimize)
dwarfout_end_epilogue (); dwarfout_end_epilogue ();
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG)
dwarf2out_end_epilogue ();
#endif
#ifdef XCOFF_DEBUGGING_INFO #ifdef XCOFF_DEBUGGING_INFO
if (write_symbols == XCOFF_DEBUG) if (write_symbols == XCOFF_DEBUG)
xcoffout_end_epilogue (file); xcoffout_end_epilogue (file);
...@@ -1365,6 +1375,12 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -1365,6 +1375,12 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
if (write_symbols == DWARF_DEBUG) if (write_symbols == DWARF_DEBUG)
dwarfout_begin_function (); dwarfout_begin_function ();
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
/* This outputs a marker where the function body starts, so it
must be after the prologue. */
if (write_symbols == DWARF2_DEBUG)
dwarf2out_begin_function ();
#endif
break; break;
} }
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED) if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
...@@ -1377,11 +1393,8 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -1377,11 +1393,8 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG
&& (debug_info_level == DINFO_LEVEL_NORMAL && (debug_info_level == DINFO_LEVEL_NORMAL
|| debug_info_level == DINFO_LEVEL_VERBOSE || debug_info_level == DINFO_LEVEL_VERBOSE
#ifdef DWARF_DEBUGGING_INFO
|| write_symbols == DWARF_DEBUG || write_symbols == DWARF_DEBUG
#endif || write_symbols == DWARF2_DEBUG))
)
)
{ {
/* Beginning of a symbol-block. Assign it a sequence number /* Beginning of a symbol-block. Assign it a sequence number
and push the number onto the stack PENDING_BLOCKS. */ and push the number onto the stack PENDING_BLOCKS. */
...@@ -1416,17 +1429,18 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -1416,17 +1429,18 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
if (write_symbols == DWARF_DEBUG) if (write_symbols == DWARF_DEBUG)
dwarfout_begin_block (next_block_index); dwarfout_begin_block (next_block_index);
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG)
dwarf2out_begin_block (next_block_index);
#endif
next_block_index++; next_block_index++;
} }
else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END
&& (debug_info_level == DINFO_LEVEL_NORMAL && (debug_info_level == DINFO_LEVEL_NORMAL
|| debug_info_level == DINFO_LEVEL_VERBOSE || debug_info_level == DINFO_LEVEL_VERBOSE
#ifdef DWARF_DEBUGGING_INFO
|| write_symbols == DWARF_DEBUG || write_symbols == DWARF_DEBUG
#endif || write_symbols == DWARF2_DEBUG))
)
)
{ {
/* End of a symbol-block. Pop its sequence number off /* End of a symbol-block. Pop its sequence number off
PENDING_BLOCKS and output debugging info based on that. */ PENDING_BLOCKS and output debugging info based on that. */
...@@ -1452,6 +1466,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -1452,6 +1466,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
if (write_symbols == DWARF_DEBUG && block_depth >= 0) if (write_symbols == DWARF_DEBUG && block_depth >= 0)
dwarfout_end_block (pending_blocks[block_depth]); dwarfout_end_block (pending_blocks[block_depth]);
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG && block_depth >= 0)
dwarf2out_end_block (pending_blocks[block_depth]);
#endif
} }
else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL
&& (debug_info_level == DINFO_LEVEL_NORMAL && (debug_info_level == DINFO_LEVEL_NORMAL
...@@ -1461,6 +1479,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -1461,6 +1479,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
if (write_symbols == DWARF_DEBUG) if (write_symbols == DWARF_DEBUG)
dwarfout_label (insn); dwarfout_label (insn);
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG)
dwarf2out_label (insn);
#endif
} }
else if (NOTE_LINE_NUMBER (insn) > 0) else if (NOTE_LINE_NUMBER (insn) > 0)
/* This note is a line-number. */ /* This note is a line-number. */
...@@ -1537,6 +1559,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -1537,6 +1559,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
if (write_symbols == DWARF_DEBUG && LABEL_NAME (insn)) if (write_symbols == DWARF_DEBUG && LABEL_NAME (insn))
dwarfout_label (insn); dwarfout_label (insn);
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG && LABEL_NAME (insn))
dwarf2out_label (insn);
#endif
if (app_on) if (app_on)
{ {
fprintf (file, ASM_APP_OFF); fprintf (file, ASM_APP_OFF);
...@@ -2156,6 +2182,11 @@ output_source_line (file, insn) ...@@ -2156,6 +2182,11 @@ output_source_line (file, insn)
if (write_symbols == DWARF_DEBUG) if (write_symbols == DWARF_DEBUG)
dwarfout_line (filename, NOTE_LINE_NUMBER (insn)); dwarfout_line (filename, NOTE_LINE_NUMBER (insn));
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG)
dwarf2out_line (filename, NOTE_LINE_NUMBER (insn));
#endif
} }
} }
......
...@@ -27,6 +27,7 @@ enum debug_info_type ...@@ -27,6 +27,7 @@ enum debug_info_type
DBX_DEBUG, /* Write BSD .stabs for DBX (using dbxout.c). */ DBX_DEBUG, /* Write BSD .stabs for DBX (using dbxout.c). */
SDB_DEBUG, /* Write COFF for (old) SDB (using sdbout.c). */ SDB_DEBUG, /* Write COFF for (old) SDB (using sdbout.c). */
DWARF_DEBUG, /* Write Dwarf debug info (using dwarfout.c). */ DWARF_DEBUG, /* Write Dwarf debug info (using dwarfout.c). */
DWARF2_DEBUG, /* Write Dwarf v2 debug info (using dwarf2out.c). */
XCOFF_DEBUG /* Write IBM/Xcoff debug info (using dbxout.c). */ XCOFF_DEBUG /* Write IBM/Xcoff debug info (using dbxout.c). */
}; };
......
...@@ -97,7 +97,7 @@ vms_fopen (fname, type) ...@@ -97,7 +97,7 @@ vms_fopen (fname, type)
PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way. PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
This is one long line cause VAXC can't handle a \-newline. */ This is one long line cause VAXC can't handle a \-newline. */
#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO)) #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
#ifndef PREFERRED_DEBUGGING_TYPE #ifndef PREFERRED_DEBUGGING_TYPE
You Lose! You must define PREFERRED_DEBUGGING_TYPE! You Lose! You must define PREFERRED_DEBUGGING_TYPE!
#endif /* no PREFERRED_DEBUGGING_TYPE */ #endif /* no PREFERRED_DEBUGGING_TYPE */
...@@ -112,6 +112,9 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE! ...@@ -112,6 +112,9 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE!
#ifdef DWARF_DEBUGGING_INFO #ifdef DWARF_DEBUGGING_INFO
#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
#endif
#ifdef XCOFF_DEBUGGING_INFO #ifdef XCOFF_DEBUGGING_INFO
#define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
#endif #endif
...@@ -2315,6 +2318,10 @@ compile_file (name) ...@@ -2315,6 +2318,10 @@ compile_file (name)
if (write_symbols == DWARF_DEBUG) if (write_symbols == DWARF_DEBUG)
TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename)); TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG)
TIMEVAR (symout_time, dwarf2out_init (asm_out_file, main_input_filename));
#endif
/* Initialize yet another pass. */ /* Initialize yet another pass. */
...@@ -2523,6 +2530,16 @@ compile_file (name) ...@@ -2523,6 +2530,16 @@ compile_file (name)
&& (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl))) && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1)); TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
/* Output DWARF2 information for file-scope tentative data object
declarations, file-scope (extern) function declarations (which
had no corresponding body) and file-scope tagged type declarations
and definitions which have not yet been forced out. */
if (write_symbols == DWARF2_DEBUG
&& (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
TIMEVAR (symout_time, dwarf2out_file_scope_decl (decl, 1));
#endif
} }
} }
...@@ -2547,6 +2564,14 @@ compile_file (name) ...@@ -2547,6 +2564,14 @@ compile_file (name)
}); });
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG)
TIMEVAR (symout_time,
{
dwarf2out_finish ();
});
#endif
/* Output some stuff at end of file if nec. */ /* Output some stuff at end of file if nec. */
if (!output_bytecode) if (!output_bytecode)
...@@ -2756,6 +2781,11 @@ rest_of_type_compilation (type, toplev) ...@@ -2756,6 +2781,11 @@ rest_of_type_compilation (type, toplev)
if (write_symbols == DWARF_DEBUG && toplev) if (write_symbols == DWARF_DEBUG && toplev)
TIMEVAR (symout_time, dwarfout_file_scope_decl (TYPE_STUB_DECL (type), 0)); TIMEVAR (symout_time, dwarfout_file_scope_decl (TYPE_STUB_DECL (type), 0));
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
/* Don't write out function-scope types here. */
if (write_symbols == DWARF2_DEBUG && toplev)
TIMEVAR (symout_time, dwarf2out_file_scope_decl (TYPE_STUB_DECL (type), 0));
#endif
} }
/* This is called from finish_function (within yyparse) /* This is called from finish_function (within yyparse)
...@@ -2863,6 +2893,17 @@ rest_of_compilation (decl) ...@@ -2863,6 +2893,17 @@ rest_of_compilation (decl)
set_decl_abstract_flags (decl, 0); set_decl_abstract_flags (decl, 0);
} }
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
/* Generate the DWARF2 info for the "abstract" instance
of a function which we may later generate inlined and/or
out-of-line instances of. */
if (write_symbols == DWARF2_DEBUG)
{
set_decl_abstract_flags (decl, 1);
TIMEVAR (symout_time, dwarf2out_file_scope_decl (decl, 0));
set_decl_abstract_flags (decl, 0);
}
#endif
TIMEVAR (integration_time, save_for_inline_nocopy (decl)); TIMEVAR (integration_time, save_for_inline_nocopy (decl));
RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlineable; RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlineable;
goto exit_rest_of_compilation; goto exit_rest_of_compilation;
...@@ -2885,6 +2926,18 @@ rest_of_compilation (decl) ...@@ -2885,6 +2926,18 @@ rest_of_compilation (decl)
set_decl_abstract_flags (decl, 0); set_decl_abstract_flags (decl, 0);
} }
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
/* Generate the DWARF2 info for the "abstract" instance of
a function which we will generate an out-of-line instance
of almost immediately (and which we may also later generate
various inlined instances of). */
if (write_symbols == DWARF2_DEBUG)
{
set_decl_abstract_flags (decl, 1);
TIMEVAR (symout_time, dwarf2out_file_scope_decl (decl, 0));
set_decl_abstract_flags (decl, 0);
}
#endif
saved_block_tree = DECL_INITIAL (decl); saved_block_tree = DECL_INITIAL (decl);
saved_arguments = DECL_ARGUMENTS (decl); saved_arguments = DECL_ARGUMENTS (decl);
TIMEVAR (integration_time, save_for_inline_copying (decl)); TIMEVAR (integration_time, save_for_inline_copying (decl));
...@@ -3376,6 +3429,11 @@ rest_of_compilation (decl) ...@@ -3376,6 +3429,11 @@ rest_of_compilation (decl)
TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0)); TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG)
TIMEVAR (symout_time, dwarf2out_file_scope_decl (decl, 0));
#endif
exit_rest_of_compilation: exit_rest_of_compilation:
/* In case the function was not output, /* In case the function was not output,
...@@ -3818,8 +3876,6 @@ main (argc, argv, envp) ...@@ -3818,8 +3876,6 @@ main (argc, argv, envp)
} }
else if (str[0] == 'g') else if (str[0] == 'g')
{ {
char *p = str + 1;
char *q;
unsigned len; unsigned len;
unsigned level; unsigned level;
/* A lot of code assumes write_symbols == NO_DEBUG if the /* A lot of code assumes write_symbols == NO_DEBUG if the
...@@ -3847,8 +3903,19 @@ main (argc, argv, envp) ...@@ -3847,8 +3903,19 @@ main (argc, argv, envp)
{ "gstabs+", DBX_DEBUG, 1 }, { "gstabs+", DBX_DEBUG, 1 },
#endif #endif
#ifdef DWARF_DEBUGGING_INFO #ifdef DWARF_DEBUGGING_INFO
{ "gdwarf-1", DWARF_DEBUG, 0 },
{ "gdwarf-1+", DWARF_DEBUG, 1 },
#endif
#ifdef DWARF2_DEBUGGING_INFO
{ "gdwarf-2", DWARF2_DEBUG, 0 },
#endif
#if defined (DWARF_DEBUGGING_INFO) || defined (DWARF2_DEBUGGING_INFO)
#if PREFERRED_DEBUGGING_TYPE == DWARF_DEBUG || !defined (DWARF2_DEBUGGING_INFO)
{ "gdwarf", DWARF_DEBUG, 0 }, { "gdwarf", DWARF_DEBUG, 0 },
{ "gdwarf+", DWARF_DEBUG, 1 }, { "gdwarf+", DWARF_DEBUG, 1 },
#else
{ "gdwarf", DWARF2_DEBUG, 0 },
#endif
#endif #endif
#ifdef XCOFF_DEBUGGING_INFO #ifdef XCOFF_DEBUGGING_INFO
{ "gxcoff", XCOFF_DEBUG, 0 }, { "gxcoff", XCOFF_DEBUG, 0 },
...@@ -3861,36 +3928,38 @@ main (argc, argv, envp) ...@@ -3861,36 +3928,38 @@ main (argc, argv, envp)
}; };
/* Indexed by enum debug_info_type. */ /* Indexed by enum debug_info_type. */
static char *debug_type_names[] = { static char *debug_type_names[] = {
"none", "stabs", "coff", "dwarf", "xcoff" "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
}; };
while (*p && (*p < '0' || *p > '9'))
p++;
len = p - str;
q = p;
while (*q && (*q >= '0' && *q <= '9'))
q++;
if (*p)
level = atoi (p);
else
level = 2; /* default debugging info level */
if (*q || level > 3)
{
warning ("invalid debug level specification in option: `-%s'",
str);
/* ??? This error message is incorrect in the case of
-g4 -g. */
warning ("no debugging information will be generated");
level = 0;
}
/* Look up STR in the table. */ /* Look up STR in the table. */
for (da = debug_args; da->arg; da++) for (da = debug_args; da->arg; da++)
{ {
if (! strncmp (str, da->arg, len)) if (! strncmp (str, da->arg, strlen (da->arg)))
{ {
enum debug_info_type type = da->debug_type; enum debug_info_type type = da->debug_type;
/* ??? A few targets use STR and LEN in the char *p, *q;
p = str + strlen (da->arg);
if (*p && (*p < '0' || *p > '9'))
continue;
q = p;
while (*q && (*q >= '0' && *q <= '9'))
q++;
if (*p)
level = atoi (p);
else
level = 2; /* default debugging info level */
if (*q || level > 3)
{
warning ("invalid debug level specification in option: `-%s'",
str);
/* ??? This error message is incorrect in the case of
-g4 -g. */
warning ("no debugging information will be generated");
level = 0;
}
/* ??? A few targets use STR in the
definition of PREFERRED_DEBUGGING_TYPE! */ definition of PREFERRED_DEBUGGING_TYPE! */
if (type == NO_DEBUG) if (type == NO_DEBUG)
type = PREFERRED_DEBUGGING_TYPE; type = PREFERRED_DEBUGGING_TYPE;
...@@ -4233,3 +4302,90 @@ print_switch_values (file, pos, max, indent, sep, term) ...@@ -4233,3 +4302,90 @@ print_switch_values (file, pos, max, indent, sep, term)
fprintf (file, "%s", term); fprintf (file, "%s", term);
} }
/* Record the beginning of a new source file, named FILENAME. */
void
debug_start_source_file (filename)
register char *filename;
{
#ifdef DBX_DEBUGGING_INFO
if (write_symbols == DBX_DEBUG)
dbxout_start_new_source_file (filename);
#endif
#ifdef DWARF_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& write_symbols == DWARF_DEBUG)
dwarfout_start_new_source_file (filename);
#endif /* DWARF_DEBUGGING_INFO */
#ifdef DWARF2_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& write_symbols == DWARF2_DEBUG)
dwarf2out_start_source_file (filename);
#endif /* DWARF2_DEBUGGING_INFO */
}
/* Record the resumption of a source file. LINENO is the line number in
the source file we are returning to. */
void
debug_end_source_file (lineno)
register unsigned lineno;
{
#ifdef DBX_DEBUGGING_INFO
if (write_symbols == DBX_DEBUG)
dbxout_resume_previous_source_file ();
#endif
#ifdef DWARF_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& write_symbols == DWARF_DEBUG)
dwarfout_resume_previous_source_file (lineno);
#endif /* DWARF_DEBUGGING_INFO */
#ifdef DWARF2_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& write_symbols == DWARF2_DEBUG)
dwarf2out_end_source_file ();
#endif /* DWARF2_DEBUGGING_INFO */
}
/* Called from check_newline in c-parse.y. The `buffer' parameter contains
the tail part of the directive line, i.e. the part which is past the
initial whitespace, #, whitespace, directive-name, whitespace part. */
void
debug_define (lineno, buffer)
register unsigned lineno;
register char *buffer;
{
#ifdef DWARF_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& write_symbols == DWARF_DEBUG)
dwarfout_define (lineno, buffer);
#endif /* DWARF_DEBUGGING_INFO */
#ifdef DWARF2_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& write_symbols == DWARF2_DEBUG)
dwarf2out_define (lineno, buffer);
#endif /* DWARF2_DEBUGGING_INFO */
}
/* Called from check_newline in c-parse.y. The `buffer' parameter contains
the tail part of the directive line, i.e. the part which is past the
initial whitespace, #, whitespace, directive-name, whitespace part. */
void
debug_undef (lineno, buffer)
register unsigned lineno;
register char *buffer;
{
#ifdef DWARF_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& write_symbols == DWARF_DEBUG)
dwarfout_undef (lineno, buffer);
#endif /* DWARF_DEBUGGING_INFO */
#ifdef DWARF2_DEBUGGING_INFO
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& write_symbols == DWARF2_DEBUG)
dwarf2out_undef (lineno, buffer);
#endif /* DWARF2_DEBUGGING_INFO */
}
...@@ -1180,6 +1180,11 @@ assemble_variable (decl, top_level, at_end, dont_output_data) ...@@ -1180,6 +1180,11 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
&& DECL_CONTEXT (decl)) && DECL_CONTEXT (decl))
dwarfout_file_scope_decl (decl, 0); dwarfout_file_scope_decl (decl, 0);
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG && top_level
&& DECL_CONTEXT (decl))
dwarf2out_file_scope_decl (decl, 0);
#endif
} }
/* Only output DWARF debugging information for record-scope variables /* Only output DWARF debugging information for record-scope variables
...@@ -1308,6 +1313,11 @@ assemble_variable (decl, top_level, at_end, dont_output_data) ...@@ -1308,6 +1313,11 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
&& DECL_CONTEXT (decl)) && DECL_CONTEXT (decl))
dwarfout_file_scope_decl (decl, 0); dwarfout_file_scope_decl (decl, 0);
#endif #endif
#ifdef DWARF2_DEBUGGING_INFO
if (write_symbols == DWARF2_DEBUG && top_level
&& DECL_CONTEXT (decl))
dwarf2out_file_scope_decl (decl, 0);
#endif
/* Only output DWARF debugging information for record-scope variables /* Only output DWARF debugging information for record-scope variables
here. In the case of function-scope variables, the information here. In the case of function-scope variables, the information
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment