public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Bob Wilson <bwilson@tensilica.com>
To: binutils@sources.redhat.com
Cc: Daniel Jacobowitz <drow@false.org>,
	Nick Clifton <nickc@redhat.com>,
	Alan Modra <amodra@bigpond.net.au>
Subject: Re: [PATCH] inconsistent DWARF2 sections generated by --gdwarf2
Date: Thu, 18 Nov 2004 18:14:00 -0000	[thread overview]
Message-ID: <419CE636.9090807@tensilica.com> (raw)
In-Reply-To: <20041118142206.GA29928@nevyn.them.org>

Replying to several messages at once here....

Nick Clifton wrote:
> I do not think so - the DWARF standard does specify that there there
> should be a correspondence between the compilation units in the .debug_info
> section and the compilation units in the .debug_line section:

I agree with this.  Before submitting the patch, I considered Alan's suggestion 
that this is a bug in readelf, and regardless of what GAS generates, it does 
seem that readelf should only look for .debug_line sections that are referenced 
from .debug_info sections.  I'm not going to tackle that change now.  After 
reading the DWARF spec, I think it would be best to fix GAS.  I agree with Alan 
that the current situation is not explicitly prohibited by the DWARF spec, but 
keeping .debug_line sections tied to .debug_info sections would seem to better 
follow the spirit of the spec.

Alan Modra wrote:
> On Thu, Nov 18, 2004 at 09:22:37AM +0000, Nick Clifton wrote:
>>> Does that make sense though ?  A .debug_line compilation unit which does 
>>> not correspond to any .debug_info compilation unit ?  What lines would 
>>> it be describing ?  Why would these lines exist without any debug info ?
> 
> .debug_line by itself gives you a mapping between addresses and source
> file line numbers.  That might be all a tool needs.

That's irrelevant, though, because the situation in question occurs only when 
there is no debug line info.  dwarf2_finish is currently writing an (empty) 
.debug_line section even when there is no line number data.  The whole point of 
the patch is to fix that!  (Sorry, I guess I didn't make that clear earlier.)

Nick Clifton wrote:
> As for the patch itself - I am not so sure.  It looks to me like there might
> be problems when -gdwarf2 is not specified on the command line. ie GAS might
> still generate dwarf2 debug sections.  I would need to have a look at this
> and I am really swamped at the moment. :-(   Bob - could you try a few more
> tests of your patch please ?  Say with various different -gxxx command line
> switches specified ?

I just tried --gstabs and --gstabs+ for several input files, and I don't see any 
problems.

I think your concern is misplaced, i.e., the patch might not be correct, but it 
shouldn't cause GAS to generate "extra" dwarf2 debugging output.  Look at it 
this way: the patch removes one of the conditions required for dwarf2_finish to 
return without doing anything.  It can only increase the number of situations 
where dwarf2_finish does nothing.

Daniel Jacobowitz wrote:
> Bob's original mail said it was harmless for GDB - but that's not true.
> GDB will only read line number data associated with some compilation
> unit.

Well, I said it was *probably* harmless, and from what you say, I still think 
that.  GDB will ignore the "orphan" .debug_line section, but that's fine -- 
there's nothing there for GDB to see anyway.

> 
> Is there any reason not to emit a compilation unit, if there isn't one
> already, and there is line number data?

No, there is no reason not to emit a comp unit in that case, and it will be 
emitted in that case, both with and without my patch.  The patch is intended to 
address only the case where there is no line number data.

I hope that clears things up a bit.  As far as I can tell, this shouldn't be a 
big deal -- it's just tidying up an unusual corner case.

--Bob

  reply	other threads:[~2004-11-18 18:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-15 19:27 Bob Wilson
2004-11-18  3:31 ` Alan Modra
2004-11-18  8:39   ` Nick Clifton
2004-11-18  8:59     ` Alan Modra
2004-11-18  9:18       ` Nick Clifton
2004-11-18 11:58         ` Alan Modra
2004-11-18 14:22           ` Daniel Jacobowitz
2004-11-18 18:14             ` Bob Wilson [this message]
2004-11-18 18:42               ` Daniel Jacobowitz
2004-11-22 12:19               ` Nick Clifton

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=419CE636.9090807@tensilica.com \
    --to=bwilson@tensilica.com \
    --cc=amodra@bigpond.net.au \
    --cc=binutils@sources.redhat.com \
    --cc=drow@false.org \
    --cc=nickc@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).