This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch was: dwarf2 debug dependent upon GAS?
- To: egcs-patches at cygnus dot com
- Subject: patch was: dwarf2 debug dependent upon GAS?
- From: Robert Lipe <robertlipe at usa dot net>
- Date: Sun, 28 Feb 1999 16:06:43 -0600
- Cc: Jason Merrill <jason at cygnus dot com>
- References: <19990226012522.D17655@rjlhome.sco.com> <29507.920192219@hurl.cygnus.com>
This patch iterated a few times in the egcs list. This version cleans
up the one remaining issue.
> > >From the hip, my guess is that add_AT_section_offset() is calling
> > stripattributes() on that third argument which is no longer appropriate.
A better guess would have been that calling add_AT_*section*_offset with
an argument used to be a section but was now a label was a bad plan.
With this patch installed, an SVR5 tree configured --with-dwarf2 will
now bootstrap, although noisily. (Separate patch forthcoming.) I have
not actually used any debugger on the generated binaries, but I don't
think I changed any runtime code anyway.
* dwarf2out.c (TEXT_SECTION_LAABEL, DEBUG_LINE_SECTION_LABEL,
DEBUG_INFO_SECTION_LABEL, ABBREV_SECTION_LABEL,
text_section_laabel, debug_line_section_label,
debug_info_section_label, abbrev_section_label): New.
(output_compilation_unit_header): Emit label associated
with section instead of section name itself.
(out_pubnames, output_aranges, output_line_info,
dwarf2out_finish): Likewise.
(dwarf2out_init): Build internal label names for sections
from static labels.
Index: dwarf2out.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/dwarf2out.c,v
retrieving revision 1.86
diff -u -p -r1.86 dwarf2out.c
--- dwarf2out.c 1999/02/25 21:26:06 1.86
+++ dwarf2out.c 1999/02/28 21:08:21
@@ -2624,7 +2624,23 @@ static unsigned lookup_filename PROTO((
#define BSS_SECTION ".bss"
#endif
+/* Labels we insert at beginning sections we can reference instead of
+ the section names themselves. */
+#ifndef TEXT_SECTION_LABEL
+#define TEXT_SECTION_LABEL "Ltext_label"
+#endif
+#ifndef DEBUG_LINE_SECTION_LABEL
+#define DEBUG_LINE_SECTION_LABEL "Ldebug_line_label"
+#endif
+#ifndef DEBUG_INFO_SECTION_LABEL
+#define DEBUG_INFO_SECTION_LABEL "Ldebug_info_label"
+#endif
+#ifndef ABBREV_SECTION_LABEL
+#define ABBREV_SECTION_LABEL "Ldebug_abbrev_label"
+#endif
+
+
/* Definitions of defaults for formats and names of various special
(artificial) labels which may be generated within this file (when the -g
options is used and DWARF_DEBUGGING_INFO is in effect.
@@ -2632,6 +2648,10 @@ static unsigned lookup_filename PROTO((
typically, overriding these defaults is unnecessary. */
static char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
+static char text_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
+static char abbrev_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
+static char debug_info_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
+static char debug_line_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
#ifndef TEXT_END_LABEL
#define TEXT_END_LABEL "Letext"
@@ -5423,7 +5443,7 @@ output_compilation_unit_header ()
fprintf (asm_out_file, "\t%s DWARF version number", ASM_COMMENT_START);
fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (ABBREV_SECTION));
+ ASM_OUTPUT_DWARF_OFFSET (asm_out_file, abbrev_section_label);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s Offset Into Abbrev. Section",
ASM_COMMENT_START);
@@ -5496,7 +5516,7 @@ output_pubnames ()
fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (DEBUG_INFO_SECTION));
+ ASM_OUTPUT_DWARF_OFFSET (asm_out_file, debug_info_section_label);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
ASM_COMMENT_START);
@@ -5577,7 +5597,7 @@ output_aranges ()
fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START);
fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (DEBUG_INFO_SECTION));
+ ASM_OUTPUT_DWARF_OFFSET (asm_out_file, debug_info_section_label);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
ASM_COMMENT_START);
@@ -5603,13 +5623,13 @@ output_aranges ()
ASM_COMMENT_START, 2 * PTR_SIZE);
fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, stripattributes (TEXT_SECTION));
+ ASM_OUTPUT_DWARF_ADDR (asm_out_file, text_section_label);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START);
fputc ('\n', asm_out_file);
ASM_OUTPUT_DWARF_ADDR_DELTA (asm_out_file, text_end_label,
- stripattributes (TEXT_SECTION));
+ text_section_label);
if (flag_debug_asm)
fprintf (asm_out_file, "%s Length", ASM_COMMENT_START);
@@ -5794,14 +5814,14 @@ output_line_info ()
fputc ('\n', asm_out_file);
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, stripattributes (TEXT_SECTION));
+ ASM_OUTPUT_DWARF_ADDR (asm_out_file, text_section_label);
fputc ('\n', asm_out_file);
/* Generate the line number to PC correspondence table, encoded as
a series of state machine operations. */
current_file = 1;
current_line = 1;
- strcpy (prev_line_label, stripattributes (TEXT_SECTION));
+ strcpy (prev_line_label, text_section_label);
for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index)
{
register dw_line_info_ref line_info;
@@ -9853,6 +9873,21 @@ dwarf2out_init (asm_out_file, main_input
gen_compile_unit_die (main_input_filename);
ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
+ ASM_GENERATE_INTERNAL_LABEL (abbrev_section_label, ABBREV_SECTION_LABEL, 0);
+ ASM_GENERATE_INTERNAL_LABEL (text_section_label, TEXT_SECTION_LABEL, 0);
+ ASM_GENERATE_INTERNAL_LABEL (debug_info_section_label,
+ DEBUG_INFO_SECTION_LABEL, 0);
+ ASM_GENERATE_INTERNAL_LABEL (debug_line_section_label,
+ DEBUG_LINE_SECTION_LABEL, 0);
+
+ ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION);
+ ASM_OUTPUT_LABEL (asm_out_file, abbrev_section_label);
+ ASM_OUTPUT_SECTION (asm_out_file, TEXT_SECTION);
+ ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
+ ASM_OUTPUT_SECTION (asm_out_file, DEBUG_INFO_SECTION);
+ ASM_OUTPUT_LABEL (asm_out_file, debug_info_section_label);
+ ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION);
+ ASM_OUTPUT_LABEL (asm_out_file, debug_line_section_label);
}
/* Output stuff that dwarf requires at the end of every file,
@@ -9920,12 +9955,11 @@ dwarf2out_finish ()
was in .text. */
if (separate_line_info_table_in_use == 0)
{
- add_AT_lbl_id (comp_unit_die, DW_AT_low_pc,
- stripattributes (TEXT_SECTION));
+ add_AT_lbl_id (comp_unit_die, DW_AT_low_pc, text_section_label);
add_AT_lbl_id (comp_unit_die, DW_AT_high_pc, text_end_label);
}
- add_AT_section_offset (comp_unit_die, DW_AT_stmt_list, DEBUG_LINE_SECTION);
+ add_AT_lbl_id (comp_unit_die, DW_AT_stmt_list, debug_line_section_label);
}
/* Output the abbreviation table. */