From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Lipe To: Jason Merrill Cc: wilson@cygnus.com, egcs@cygnus.com Subject: Re: dwarf2 debug dependent upon GAS? Date: Thu, 25 Feb 1999 23:25:00 -0000 Message-id: <19990226012522.D17655@rjlhome.sco.com> In-reply-to: < u93e3tism2.fsf@yorick.cygnus.com >; from Jason Merrill on Thu, Feb 25, 1999 at 10:31:01PM -0800 References: <19990221144644.M8783.cygnus.egcs@rjlhome.sco.com> <199902230124.RAA24440.cygnus.egcs@rtl.cygnus.com> <19990225143649.I17655@rjlhome.sco.com> X-SW-Source: 1999-02/msg01313.html > Actually, I think we should use ASM_{GENERATE,OUTPUT}_INTERNAL_LABEL to > handle such matters, like we do for text_end_label (and as the comment in > dwarfout.c suggests). That's a bit more complicated than this approach, > but more correct. This isn't quite right, but I'm calling it a night. >From the hip, my guess is that add_AT_section_offset() is calling stripattributes() on that third argument which is no longer appropriate. The bogus code looks like: .ascii "/tmp/x.c\0" / DW_AT_name .ascii "/home3/negcs/gcc\0" / DW_AT_comp_dir .ascii "GNU C egcs-2.93.09 19990225 (gcc2 ss-980929 experimental)\0" / DW_AT_producer .byte 0x1 / DW_AT_language .4byte .Ltext_label0 / DW_AT_low_pc .4byte .Letext0 / DW_AT_high_pc -> .4byte *.Ldebug_line_label0 / DW_AT_stmt_list .byte 0x2 / ULEB128 0x2 (DIE (0x6d) DW_TAG_subprogram) .byte 0x1 / DW_AT_external Remove the '*' from that line, and it compiles and links again. Index: dwarf2out.c =================================================================== RCS file: /egcs/carton/cvsfiles/egcs/gcc/dwarf2out.c,v retrieving revision 1.85 diff -u -p -r1.85 dwarf2out.c --- dwarf2out.c 1999/02/24 17:48:42 1.85 +++ dwarf2out.c 1999/02/26 07:21:27 @@ -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; @@ -9851,6 +9871,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, @@ -9918,12 +9953,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_section_offset (comp_unit_die, DW_AT_stmt_list, debug_line_section_label); } /* Output the abbreviation table. */ From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Lipe To: Jason Merrill Cc: wilson@cygnus.com, egcs@cygnus.com Subject: Re: dwarf2 debug dependent upon GAS? Date: Sun, 28 Feb 1999 22:53:00 -0000 Message-ID: <19990226012522.D17655@rjlhome.sco.com> References: <19990221144644.M8783.cygnus.egcs@rjlhome.sco.com> <199902230124.RAA24440.cygnus.egcs@rtl.cygnus.com> <19990225143649.I17655@rjlhome.sco.com> X-SW-Source: 1999-02n/msg01324.html Message-ID: <19990228225300.cnf9tS6-4hjRMte0c5Uzog5HHxoJqsw1nTtmWir2Ojw@z> > Actually, I think we should use ASM_{GENERATE,OUTPUT}_INTERNAL_LABEL to > handle such matters, like we do for text_end_label (and as the comment in > dwarfout.c suggests). That's a bit more complicated than this approach, > but more correct. This isn't quite right, but I'm calling it a night.