On Tue, Oct 29, 2013 at 10:10:34PM -0400, Jasper St. Pierre wrote: > "almost identical"? Mind expanding on this?
the printf was a %s (symbol name) or %p (base addr) and the hex address (depending on if we had a name or not). the pointer-to-string conversion is now handled by symbol_name(), so now we print the same format string and it only differs in two ways, name and addr. Cheers, Peter > On Tue, Oct 29, 2013 at 7:25 PM, Peter Hutterer > <[email protected]>wrote: > > > The recent change to use elfutils made these conditions almost identical. > > > > Signed-off-by: Peter Hutterer <[email protected]> > > --- > > os/backtrace.c | 29 +++++++++++------------------ > > 1 file changed, 11 insertions(+), 18 deletions(-) > > > > diff --git a/os/backtrace.c b/os/backtrace.c > > index acf110a..c3a31bc 100644 > > --- a/os/backtrace.c > > +++ b/os/backtrace.c > > @@ -134,32 +134,25 @@ xorg_backtrace(void) > > size = backtrace(array, BT_SIZE); > > for (i = 0; i < size; i++) { > > int rc = dladdr(array[i], &info); > > + const char *name; > > + unsigned int addr; > > > > if (rc == 0) { > > ErrorFSigSafe("%u: ?? [%p]\n", i, array[i]); > > continue; > > } > > mod = (info.dli_fname && *info.dli_fname) ? info.dli_fname : > > "(vdso)"; > > - if (info.dli_saddr) > > - ErrorFSigSafe( > > - "%u: %s (%s+0x%x) [%p]\n", > > - i, > > - mod, > > - info.dli_sname, > > - (unsigned int)((char *) array[i] - > > - (char *) info.dli_saddr), > > - array[i]); > > + > > + if (info.dli_saddr) { > > + name = info.dli_sname; > > + addr = (unsigned int)((char *) array[i] - (char *) > > info.dli_saddr); > > + } > > else { > > - const char *name = symbol_name(array[i], info.dli_fbase); > > - ErrorFSigSafe( > > - "%u: %s (%s+0x%x) [%p]\n", > > - i, > > - mod, > > - name, > > - (unsigned int)((char *) array[i] - > > - (char *) info.dli_fbase), > > - array[i]); > > + name = symbol_name(array[i], info.dli_fbase); > > + addr = (unsigned int)((char *) array[i] - (char *) > > info.dli_fbase); > > } > > + > > + ErrorFSigSafe("%u: %s (%s+0x%x) [%p]\n", i, mod, name, addr, > > array[i]); > > } > > ErrorFSigSafe("\n"); > > } > > -- > > 1.8.3.1 > > > > _______________________________________________ > > [email protected]: X.Org development > > Archives: http://lists.x.org/archives/xorg-devel > > Info: http://lists.x.org/mailman/listinfo/xorg-devel > > > > > > -- > Jasper _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
