addr2line with FreeBSD kernel failing

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

addr2line with FreeBSD kernel failing

Farhan Khan
Hi all,

Is there a way to go from a memory address to a kernel symbol?

I am working with a subsystem that uses a lot of function pointers,
and I am not certain which particular function is being called. I have
dtrace(1) printing out the memory address of the function, like this:

printf("Runs vap->iv_newstate: 0x%p", vap->iv_newstate);

The resulting memory address will be 0xffffffff834fa6d0. I was told I
can use addr2line(1), but it seems to fail, as follows:

# addr2line -e /usr/obj/usr/src/amd64.amd64/sys/GENERIC/kernel.full
ffffffff834fa6d0
??:0

Am I doing something wrong? Also, if I can do this directly in
dtrace(1), that would be much much better. This is definitely the
installed kernel, so there is no kernel mismatch. I have also tried
using kernel.debug and kernel, same result.

Thank you,

--
Farhan Khan
PGP Fingerprint: B28D 2726 E2BC A97E 3854 5ABE 9A9F 00BC D525 16EE
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: addr2line with FreeBSD kernel failing

Andriy Gapon
On 06/08/2018 04:31, Farhan Khan wrote:

> Hi all,
>
> Is there a way to go from a memory address to a kernel symbol?
>
> I am working with a subsystem that uses a lot of function pointers,
> and I am not certain which particular function is being called. I have
> dtrace(1) printing out the memory address of the function, like this:
>
> printf("Runs vap->iv_newstate: 0x%p", vap->iv_newstate);
>
> The resulting memory address will be 0xffffffff834fa6d0. I was told I
> can use addr2line(1), but it seems to fail, as follows:
>
> # addr2line -e /usr/obj/usr/src/amd64.amd64/sys/GENERIC/kernel.full
> ffffffff834fa6d0
> ??:0

Try 0xffffffff834fa6d0

> Am I doing something wrong? Also, if I can do this directly in
> dtrace(1), that would be much much better. This is definitely the
> installed kernel, so there is no kernel mismatch. I have also tried
> using kernel.debug and kernel, same result.


--
Andriy Gapon
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: addr2line with FreeBSD kernel failing

Pratyush Yadav-2
In reply to this post by Farhan Khan
On Mon, Aug 6, 2018 at 7:04 AM Farhan Khan <[hidden email]> wrote:

>
> Hi all,
>
> Is there a way to go from a memory address to a kernel symbol?
>
> I am working with a subsystem that uses a lot of function pointers,
> and I am not certain which particular function is being called. I have
> dtrace(1) printing out the memory address of the function, like this:
>
> printf("Runs vap->iv_newstate: 0x%p", vap->iv_newstate);
>
> The resulting memory address will be 0xffffffff834fa6d0. I was told I
> can use addr2line(1), but it seems to fail, as follows:
>
> # addr2line -e /usr/obj/usr/src/amd64.amd64/sys/GENERIC/kernel.full
> ffffffff834fa6d0
> ??:0
>
> Am I doing something wrong? Also, if I can do this directly in
> dtrace(1), that would be much much better. This is definitely the
> installed kernel, so there is no kernel mismatch. I have also tried
> using kernel.debug and kernel, same result.

I usually do:

addr2line -e /usr/lib/debug/boot/kernel/kernel.debug <address>

Try that, maybe it will work for you.


PS: I'm not sure addr2line would work for runtime pointers. I use it
to translate the instruction pointer addresses to lines.

--
Regards,
Pratyush Yadav
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

RE: addr2line with FreeBSD kernel failing

Andrew Duane-3
addr2line is only for functions, though the manual page could do a more explicit job of saying that....

....................................
Andrew L. Duane - Principal Resident Engineer
AT&T Advanced Services Technical Lead
Juniper Quality Ambassador
m   +1 603.770.7088
o    +1 408.933.6944 (2-6944)
skype: andrewlduane
[hidden email]

-----Original Message-----
From: [hidden email] <[hidden email]> On Behalf Of Pratyush Yadav
Sent: Monday, August 6, 2018 4:33 AM
To: [hidden email]
Cc: [hidden email]
Subject: Re: addr2line with FreeBSD kernel failing

On Mon, Aug 6, 2018 at 7:04 AM Farhan Khan <[hidden email]> wrote:

>
> Hi all,
>
> Is there a way to go from a memory address to a kernel symbol?
>
> I am working with a subsystem that uses a lot of function pointers,
> and I am not certain which particular function is being called. I have
> dtrace(1) printing out the memory address of the function, like this:
>
> printf("Runs vap->iv_newstate: 0x%p", vap->iv_newstate);
>
> The resulting memory address will be 0xffffffff834fa6d0. I was told I
> can use addr2line(1), but it seems to fail, as follows:
>
> # addr2line -e /usr/obj/usr/src/amd64.amd64/sys/GENERIC/kernel.full
> ffffffff834fa6d0
> ??:0
>
> Am I doing something wrong? Also, if I can do this directly in
> dtrace(1), that would be much much better. This is definitely the
> installed kernel, so there is no kernel mismatch. I have also tried
> using kernel.debug and kernel, same result.

I usually do:

addr2line -e /usr/lib/debug/boot/kernel/kernel.debug <address>

Try that, maybe it will work for you.


PS: I'm not sure addr2line would work for runtime pointers. I use it to translate the instruction pointer addresses to lines.

--
Regards,
Pratyush Yadav
_______________________________________________
[hidden email] mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freebsd.org_mailman_listinfo_freebsd-2Dhackers&d=DwICAg&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=wLJwfiB7xHha--tSRcWA32FYxcFX_lWIGi9GfFIoeMU&m=SbDSmhLSCCkuf6AV9WJwhdV7kvwBzHhPpHbDdo-gmvg&s=czXR1n_2hmwkrSdY5pwfPJqoKjz48iQJJIhQaeFe-zQ&e=
To unsubscribe, send any mail to "[hidden email]"
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: addr2line with FreeBSD kernel failing

Ryan Stone-2
In reply to this post by Farhan Khan
dtrace has native support for decoding symbols with the %a format
specifier.  Try this:

printf("Runs vap->iv_newstate: %a", vap->iv_newstate);
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"