Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Aug 2018 14:02:45 +0530
From:      Pratyush Yadav <pratyush@freebsd.org>
To:        khanzf@gmail.com
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: addr2line with FreeBSD kernel failing
Message-ID:  <CA%2BX=3TKuA_PMfrTKT159Xp=ngCNAY%2ByCKXb=9GzTD%2BVdk%2BStgg@mail.gmail.com>
In-Reply-To: <CAFd4kYCAwKKNNsZJ49aa4YUT3fQ-PqS1Dymc27LO_hXXqbedfA@mail.gmail.com>
References:  <CAFd4kYCAwKKNNsZJ49aa4YUT3fQ-PqS1Dymc27LO_hXXqbedfA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 6, 2018 at 7:04 AM Farhan Khan <khanzf@gmail.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BX=3TKuA_PMfrTKT159Xp=ngCNAY%2ByCKXb=9GzTD%2BVdk%2BStgg>