Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Elias Athanasopoulos <eathan@otenet.gr>
To: Pierre Habraken <Pierre.Habraken@imag.fr>
Cc: binutils@sources.redhat.com, gdb@sources.redhat.com,
	Richard.Earnshaw@arm.com
Subject: [PATCH] Re: Section .debug_info in object file
Date: Thu, 12 Sep 2002 11:45:00 -0000	[thread overview]
Message-ID: <20020912220303.A1134@neutrino.particles.org> (raw)
In-Reply-To: <3D806189.7A45FCBA@imag.fr>; from Pierre.Habraken@imag.fr on Thu, Sep 12, 2002 at 11:42:33AM +0200

On Thu, Sep 12, 2002 at 11:42:33AM +0200, Pierre Habraken wrote:
> A few days ago I posted a message about the fact that after launching
> gdb to debug a program made of several C and Arm assembly language
> files, the command 'info sources' lists C files only.

I have attached a far from complete patch. It adds the first source file
name in the .debug_info section. This patch will not help you much, but
it solves a bug when both gcc and gas are used with dwarf2 support on. In the
latter case readelf reports garbage such as:

<0><bf>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_stmt_list   : 0      
DW_AT_high_pc     : 0x8048410 134513680    
DW_AT_low_pc      : 0x804841a 134513690    
DW_AT_name        : /home/anteater/test    
DW_AT_comp_dir    : GNU AS 2.11.90.0.8     
DW_AT_producer    : Β€=     
DW_AT_language    : 0      (Unknown: 0)

I check that with gcc 2.96. 

Elias

gas/ChangeLog

2002-09-12  Elias Athanasopoulos  <eathan@otenet.gr>

	* dwarf2dbg.c (out_debug_abbrev): Add support for the DW_AT_name field.
	(out_debug_info): Likewise.


--- dwarf2dbg.c.orig	Thu Sep 12 20:05:23 2002
+++ dwarf2dbg.c	Thu Sep 12 21:38:21 2002
@@ -1149,6 +1149,7 @@
       out_abbrev (DW_AT_low_pc, DW_FORM_addr);
       out_abbrev (DW_AT_high_pc, DW_FORM_addr);
     }
+  out_abbrev (DW_AT_name, DW_FORM_string);
   out_abbrev (DW_AT_comp_dir, DW_FORM_string);
   out_abbrev (DW_AT_producer, DW_FORM_string);
   out_abbrev (DW_AT_language, DW_FORM_data2);
@@ -1224,6 +1225,15 @@
       emit_expr (&expr, sizeof_address);
     }
 
+  /* DW_AT_name 
+   * FIXME: we only store the first source
+   * file, but we should add more records to
+   * .debug_info for each source file we assemble.
+   */  
+  len = strlen (files[1].filename) + 1;
+  p = frag_more (len);
+  memcpy (p, files[1].filename, len);
+                 
   /* DW_AT_comp_dir */
   comp_dir = getpwd ();
   len = strlen (comp_dir) + 1;


-- 
http://gnewtellium.sourceforge.net			MP3 is not a crime.	


  parent reply	other threads:[~2002-09-12 18:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-12  2:42 Pierre Habraken
2002-09-12  4:46 ` Keith.Walker
2002-09-14  4:49   ` Pierre Habraken
2002-09-16  3:10     ` Keith.Walker
2002-09-16  3:30       ` Elias Athanasopoulos
2002-09-16  3:43       ` Pierre Habraken
2002-09-12 11:45 ` Elias Athanasopoulos [this message]
2002-09-12 13:54   ` [PATCH] " Richard Henderson
2002-09-12 14:55     ` Elias Athanasopoulos
2002-09-15  2:25     ` Elias Athanasopoulos
2002-09-16 19:35       ` Richard Henderson
2002-09-16 19:51   ` Richard Henderson

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=20020912220303.A1134@neutrino.particles.org \
    --to=eathan@otenet.gr \
    --cc=Pierre.Habraken@imag.fr \
    --cc=Richard.Earnshaw@arm.com \
    --cc=binutils@sources.redhat.com \
    --cc=gdb@sources.redhat.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