bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrong source when using `-S` in objdump


From: Albert Netymk
Subject: Re: Wrong source when using `-S` in objdump
Date: Tue, 3 May 2016 23:59:29 +0200

>
> Please take a look at the .debug_line info in your object file with
> "readelf -wl test.o".  I expect you will see negative advances of line
> number, at the address where you see repeated source lines.  This is
> normal.  Compilers will emit code corresponding to a single line, at
> different locations.  This happens even at -O0, particularly around
> loops.

Yes, you are right; I did saw negative advancement.

something like `advance Address by 6 to 0x36 and Line by -1 to 4`.

>
> So you should expect this line
>     for (int i = 0; i < N; ++i) {
> to be repeated.
>
> objdump also shows some context lines before the repeated line.
> That's why my_fun appears twice.  We could probably fix that.

That would be great. Having function head showing multiple times is
quite confusing.

> You'll also notice repeated source lines after the negative advance of
> line number that don't actually corresponded to code at those
> locations.  In this case
>         sum += arr[i];
> We can't do much about that..

I see. Anyway, thank you very much for the work and explanation.

-- 
Best Regards

Yours faithfully
Albert Netymk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]