bug-binutils
[Top][All Lists]
Advanced

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

Re: addr2line seems to be off by one


From: Alan Modra
Subject: Re: addr2line seems to be off by one
Date: Mon, 18 Jul 2016 11:10:48 +0930
User-agent: Mutt/1.5.24 (2015-08-30)

On Sat, Jul 16, 2016 at 09:06:10PM +0200, Albert Netymk wrote:
> == addr.c
> 
> ```
> #include <stdio.h>
> 
> void f() { }
> 
> int main(int argc, char **argv)
> {
>   f();
>   puts("done");
>   return 0;
> }
> ```
> 
> ```
> $ clang -g addr.c ; objdump -d a.out | grep -B 3 puts | tail -n 4
>   400556:       e8 d5 ff ff ff          callq  400530 <f>
>   40055b:       48 bf 04 06 40 00 00    movabs $0x400604,%rdi
>   400562:       00 00 00
>   400565:       e8 a6 fe ff ff          callq  400410 <address@hidden>
> ```
> `40055b` is corresponding to placing "done" in `%rdi`, so I expect it
> to be associated to line of `puts("done")`. However, `addr2line
> 40055b` shows the line of `f()`.
> 
> 
> == ENV
> 
> clang: clang version 3.8.1-svn271230-1~exp1 (branches/release_38)
> addr2line: GNU addr2line (GNU Binutils for Ubuntu) 2.24

Please dump out the raw line number information produced by clang,
using "readelf -wl a.out".  I think you will find that the problem is
with clang, not addr2line.

-- 
Alan Modra
Australia Development Lab, IBM



reply via email to

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