This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [msp430-elf] Dwarf line numbers not being encoded properly?


On Wed, 27 Jan 2016 15:22:18 -0500
Orlando Arias <orlandoarias@gmail.com> wrote:

> Thank you for your reply. At the moment, I have a patch which was kindly
> given to me by Simon Marchi which makes GDB utilize the readelf
> algorithm to obtain line numbers from the binary. We were never sure
> which tool was at fault (if gdb for not reading dwarf information
> properly, binutils for not encoding it properly, or gcc for not
> generating it properly), so I did not pursue the issue for a while.
> 
> With the new release of binutils, I decided to "reopen" the case, as the
> distribution I am doing this for prefers using pristine sources from
> upstream rather than applying patches to work around issues. Besides, if
> there is something I am doing incorrectly or a bug in a tool, I would
> rather have that fixed instead.
> 
> For reference, I have attached the patch that Simon Marchi provided. It
> applies cleanly to the GDB sources but if the problem is elsewhere, I
> would have it fixed correctly (hence the temporary workaround comment in
> there). Again, thank you.

I've looked over Simon's patch.  I think it's a fine patch to use
as a work around.

I think that GDB should detect size mismatches between the CU and the
encoding of the address associated with DW_LNE_set_address.  It should
issue a complaint when this mismatch is detected.

It's not clear to me if GDB should take any action beyond that.  The
DWARF4 standard says:

    The DW_LNE_set_address opcode takes a single relocatable address
    as an operand.  The size of the operand is the size of an address
    on the target machine.  It sets the address register to the value
    given by the relocatable address and sets the op_index register to
    0.

The key point here is that second sentence.  If we could be certain
that incorrect behavior would never result by going ahead and using
the readelf algoritm, then I think it makes sense to go ahead and
use that algorithm.  Otherwise, I think we need to be content with
issuing a complaint or perhaps a warning.  (In gdb, complaints are 
usually not seen unless they're explicitly turned on.)

You've probably already seen it, but in case you haven't, here's a link
to my patch for gas:

https://sourceware.org/ml/binutils/2016-01/msg00304.html

Kevin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]