error in xorg_backtrace

Alan Zheng machinecat1666 at gmail.com
Thu Sep 17 01:28:11 PDT 2009


Hi all:

I am compiling the xorg-server-1.6.99.901, but I got a compiling error for
below function.

The error message is:* undefined reference to `dladdr**' *

void xorg_backtrace(void)
{
    void *array[64];
    char *mod;
    int size, i;
    Dl_info info;
    ErrorF("\nBacktrace:\n");
    size = backtrace(array, 64);
    for (i = 0; i < size; i++) {
        dladdr(array[i], &info);
        mod = (info.dli_fname && *info.dli_fname) ? info.dli_fname :
"(vdso)";
        if (info.dli_saddr)
            ErrorF("%d: %s (%s+0x%lx) [%p]\n", i, mod,
                   info.dli_sname, array[i] - info.dli_saddr, array[i]);
        else
            ErrorF("%d: %s (%p+0x%lx) [%p]\n", i, mod,
                   info.dli_fbase, array[i] - info.dli_fbase, array[i]);
    }
}

So I have to temp fix this function with xorg-server-1.6.3 coding likes
below:

void xorg_backtrace(void)
{
    void *array[32]; /* deeper nesting than this means something's wrong */
    size_t size, i;
    char **strings;
    ErrorF("\nBacktrace:\n");
    size = backtrace(array, 32);
    strings = backtrace_symbols(array, size);
    for (i = 0; i < size; i++)
        ErrorF("%d: %s\n", i, strings[i]);
    free(strings);
}

Did anyone know it's my config issue or it's the xorg-server-1.6.99.901
coding issue?

Thanks & Regards

-- 
Refer to: http://www.microsuncn.com

Best Regards

Alan Zheng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.x.org/archives/xorg-devel/attachments/20090917/4af970be/attachment.htm 


More information about the xorg-devel mailing list