[Mesa-dev] [PATCH 2/2] gallium/util: libunwind support

Kristian Høgsberg hoegsberg at gmail.com
Mon Apr 3 17:23:38 UTC 2017


On Mon, Apr 3, 2017 at 10:13 AM, Rob Clark <robdclark at gmail.com> wrote:
> On Mon, Apr 3, 2017 at 12:56 PM, Thomas Hellstrom <thellstrom at vmware.com> wrote:
>> Hi, Rob,
>>
>> On 03/24/2017 10:21 PM, Rob Clark wrote:
>>> It's kinda sad that (a) we don't have debug_backtrace support on !X86
>>> and that (b) we re-invent our own crude backtrace support in the first
>>> place.  If available, use libunwind instead.  The backtrace format is
>>> based on what xserver and weston use, since it is nice not to have to
>>> figure out a different format.
>>>
>>> Signed-off-by: Rob Clark <robdclark at gmail.com>
>>
>> Did you consider glibc "backtrace()", I think it's also available on ARM...
>
> I had not.. although xserver and weston are already using libunwind.
> I'm not sure about portability of libunwind to other libc
> implementations (but I guess it is at least not worse than using a
> glibc specific API).

We did use glibc backtrace initially in weston, but switched to
libbacktrace to get better support for symbols in dlopened modules.
Here's the commit message:

    compositor: Use libunwind if available for better backtraces

    libunwind has a dwarf parser and automatically queries the dlinfo
    for location of dlopened modules.  The resulting backtrace is much
    better and includes stack frames in dynamically loaded modules.

    krh: Originally submitted for Xorg, adapted for weston:

      http://lists.x.org/archives/xorg-devel/2013-February/035493.html

    Note this require libunwind at least 1.1 to get the pkg-config files.

    Signed-off-by: Marcin Slusarz <marcin.slusarz at gmail.com>

See https://cgit.freedesktop.org/wayland/weston/commit/?id=554a0da74a3f6fc945503a3eb1bfcc9038441b39

Kristian

> I suppose we could always add a fallback to backtrace().
>
>> Also is the output format the same as before, or at least compatible with
>> gallium/tools/addr2line.sh?
>
> quite possibly not.. I chose to align to the format that xserver and
> weston was already using.  Otoh, not sure if you would need to use
> addr2line.sh since it already decodes things to human readable
> fxn/file names.
>
> BR,
> -R
>
>> Thanks,
>> Thomas
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list