public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Robert Lipe <robertl@sco.com>
To: Jason Merrill <jason@cygnus.com>
Cc: wilson@cygnus.com, egcs@cygnus.com
Subject: Re: dwarf2 debug dependent upon GAS?
Date: Sun, 28 Feb 1999 22:53:00 -0000	[thread overview]
Message-ID: <19990226001542.Z17655@rjlhome.sco.com> (raw)
Message-ID: <19990228225300.rGY5dK1_ZVKmoWIMk_dNsFisrBwLUULO8U1G-Ae6gP8@z> (raw)
In-Reply-To: <u9d82xiwp5.fsf@yorick.cygnus.com>

> I don't think we need anything so complex.  I'd look at the code in
> dwarfout.c; TEXT_BEGIN_LABEL et al.  Of course, you don't need all of the
> labels rfg defined there...

Yes, that is indeed more appealing.  With this installed, an empty C
program will assemble and link on SVR5.

If you're OK with this approach, I'll send in a ChangeLog and describe
what I did and why as comments in the code.

If the comment in dwarfout.c before TEXT_BEGIN_LABEL is to be believed,
we might have to make these labels '.Lblah'.  My assembler doesn't make
them global with just the leading dot.   Your call.

Thanx for the help.
RJL


Index: dwarf2out.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/dwarf2out.c,v
retrieving revision 1.85
diff -c -5 -p -r1.85 dwarf2out.c
*** dwarf2out.c	1999/02/24 17:48:42	1.85
--- dwarf2out.c	1999/02/26 06:10:59
*************** static unsigned lookup_filename		PROTO((
*** 2622,2632 ****
--- 2622,2648 ----
  #endif
  #ifndef BSS_SECTION
  #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	".text_label"
+ #endif
+ #ifndef  DEBUG_LINE_SECTION_LABEL
+ #define DEBUG_LINE_SECTION_LABEL ".debug_line_label"
+ #endif
+ #ifndef  DEBUG_INFO_SECTION_LABEL
+ #define DEBUG_INFO_SECTION_LABEL ".debug_info_label"
+ #endif
+ #ifndef  ABBREV_SECTION_LABEL
+ #define ABBREV_SECTION_LABEL ".debug_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.
     If necessary, these may be overridden from within the tm.h file, but
     typically, overriding these defaults is unnecessary.  */
*************** output_compilation_unit_header ()
*** 5421,5431 ****
    ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
    if (flag_debug_asm)
      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));
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Offset Into Abbrev. Section",
  	     ASM_COMMENT_START);
  
    fputc ('\n', asm_out_file);
--- 5437,5447 ----
    ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
    if (flag_debug_asm)
      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_LABEL));
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Offset Into Abbrev. Section",
  	     ASM_COMMENT_START);
  
    fputc ('\n', asm_out_file);
*************** output_pubnames ()
*** 5494,5504 ****
  
    if (flag_debug_asm)
      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));
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
  	     ASM_COMMENT_START);
  
    fputc ('\n', asm_out_file);
--- 5510,5520 ----
  
    if (flag_debug_asm)
      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_LABEL));
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
  	     ASM_COMMENT_START);
  
    fputc ('\n', asm_out_file);
*************** output_aranges ()
*** 5575,5585 ****
    ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
    if (flag_debug_asm)
      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));
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
  	     ASM_COMMENT_START);
  
    fputc ('\n', asm_out_file);
--- 5591,5601 ----
    ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
    if (flag_debug_asm)
      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_LABEL));
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
  	     ASM_COMMENT_START);
  
    fputc ('\n', asm_out_file);
*************** output_aranges ()
*** 5601,5617 ****
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Pad to %d byte boundary",
  	     ASM_COMMENT_START, 2 * PTR_SIZE);
  
    fputc ('\n', asm_out_file);
!   ASM_OUTPUT_DWARF_ADDR (asm_out_file, stripattributes (TEXT_SECTION));
    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));
    if (flag_debug_asm)
      fprintf (asm_out_file, "%s Length", ASM_COMMENT_START);
  
    fputc ('\n', asm_out_file);
    for (i = 0; i < arange_table_in_use; ++i)
--- 5617,5633 ----
    if (flag_debug_asm)
      fprintf (asm_out_file, "\t%s Pad to %d byte boundary",
  	     ASM_COMMENT_START, 2 * PTR_SIZE);
  
    fputc ('\n', asm_out_file);
!   ASM_OUTPUT_DWARF_ADDR (asm_out_file, stripattributes (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_LABEL));
    if (flag_debug_asm)
      fprintf (asm_out_file, "%s Length", ASM_COMMENT_START);
  
    fputc ('\n', asm_out_file);
    for (i = 0; i < arange_table_in_use; ++i)
*************** output_line_info ()
*** 5792,5809 ****
    fputc ('\n', asm_out_file);
    output_uleb128 (1 + PTR_SIZE);
    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));
    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));
    for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index)
      {
        register dw_line_info_ref line_info;
  
        /* Emit debug info for the address of the current line, choosing
--- 5808,5825 ----
    fputc ('\n', asm_out_file);
    output_uleb128 (1 + PTR_SIZE);
    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_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_LABEL));
    for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index)
      {
        register dw_line_info_ref line_info;
  
        /* Emit debug info for the address of the current line, choosing
*************** dwarf2out_init (asm_out_file, main_input
*** 9849,9858 ****
--- 9865,9883 ----
       taken as being relative to the directory from which the compiler was
       invoked when the given (base) source file was compiled.  */
    gen_compile_unit_die (main_input_filename);
  
    ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_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,
     and generate the DWARF-2 debugging info.  */
  
*************** dwarf2out_finish ()
*** 9917,9931 ****
        /* We can only use the low/high_pc attributes if all of the code
  	 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_high_pc, text_end_label);
  	}
  
!       add_AT_section_offset (comp_unit_die, DW_AT_stmt_list, DEBUG_LINE_SECTION);
      }
  
    /* Output the abbreviation table.  */
    fputc ('\n', asm_out_file);
    ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION);
--- 9942,9956 ----
        /* We can only use the low/high_pc attributes if all of the code
  	 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_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_LABEL);
      }
  
    /* Output the abbreviation table.  */
    fputc ('\n', asm_out_file);
    ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION);

  parent reply	other threads:[~1999-02-28 22:53 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <19990221144644.M8783.cygnus.egcs@rjlhome.sco.com>
1999-02-22 17:24 ` Jim Wilson
     [not found]   ` < 199902230124.RAA24440@rtl.cygnus.com >
1999-02-22 21:32     ` Robert Lipe
     [not found]       ` < 19990222233200.P325@rjlhome.sco.com >
1999-02-23  7:04         ` Brian Ford
     [not found]           ` < Pine.SGI.4.03.9902230903340.512-100000@uscream.vss.fsi.com >
1999-02-23  8:41             ` Robert Lipe
     [not found]               ` < 19990223104109.E2294@rjlhome.sco.com >
1999-02-23  9:03                 ` Brian Ford
1999-02-28 22:53                   ` Brian Ford
1999-02-23 17:39               ` Daniel Berlin
1999-02-28 22:53                 ` Daniel Berlin
1999-02-28 22:53               ` Robert Lipe
1999-02-28 22:53           ` Brian Ford
1999-02-23 14:19         ` Jim Wilson
1999-02-28 22:53           ` Jim Wilson
1999-02-28 22:53       ` Robert Lipe
1999-02-28 22:53   ` Jim Wilson
     [not found] ` <199902230124.RAA24440.cygnus.egcs@rtl.cygnus.com>
1999-02-25 12:05   ` Jason Merrill
     [not found]     ` <19990225143649.I17655@rjlhome.sco.com>
1999-02-25 18:13       ` Jason Merrill
     [not found]         ` < u9u2w9j4jr.fsf@yorick.cygnus.com >
1999-02-25 20:55           ` Robert Lipe
1999-02-25 21:02             ` Jason Merrill
     [not found]               ` < u9d82xiwp5.fsf@yorick.cygnus.com >
1999-02-25 21:21                 ` Robert Lipe
1999-02-25 21:27                   ` Jason Merrill
1999-02-28 22:53                     ` Jason Merrill
1999-02-28 22:53                   ` Robert Lipe
1999-02-25 22:16                 ` Robert Lipe [this message]
1999-02-25 22:31                   ` Jason Merrill
     [not found]                     ` < u93e3tism2.fsf@yorick.cygnus.com >
1999-02-25 23:25                       ` Robert Lipe
     [not found]                         ` < 19990226012522.D17655@rjlhome.sco.com >
1999-02-28  0:57                           ` Jeffrey A Law
1999-02-28 22:53                             ` Jeffrey A Law
1999-02-28 22:53                         ` Robert Lipe
1999-02-28 22:53                     ` Jason Merrill
1999-02-28 22:53                   ` Robert Lipe
1999-02-28 22:53               ` Jason Merrill
1999-02-25 21:19             ` Jason Merrill
1999-02-28 22:53               ` Jason Merrill
1999-02-28 22:53             ` Robert Lipe
1999-02-28 22:53         ` Jason Merrill
1999-02-28 22:53     ` Jason Merrill
1999-02-21 12:47 Robert Lipe
     [not found] ` < 19990221144644.M8783@rjlhome.sco.com >
1999-02-21 14:51   ` Jeffrey A Law
1999-02-28 22:53     ` Jeffrey A Law
1999-02-28 22:53 ` Robert Lipe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19990226001542.Z17655@rjlhome.sco.com \
    --to=robertl@sco.com \
    --cc=egcs@cygnus.com \
    --cc=jason@cygnus.com \
    --cc=wilson@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).