libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libunwind-devel] libunwind with LD_PRELOAD option


From: Shan Shan
Subject: Re: [Libunwind-devel] libunwind with LD_PRELOAD option
Date: Tue, 6 Sep 2011 16:44:19 +0100



On Tue, Sep 6, 2011 at 3:49 PM, Arun Sharma <address@hidden> wrote:
On Tue, Sep 6, 2011 at 3:55 AM, Shan Shan
<address@hidden> wrote:
> Yes, i built libunwind with
> ./configure --host=arm-none-linux-gnueabi
>
> option only. Should i have "--enable-cxx-exceptions" also?

No you shouldn't.

> Also does libunwind dependent on any other libraries (i.e.) is it dependent
> on a debug version of a library? like ld (in Valgrind) or libc? Coz all the
> libraries running in target are stripped production versions without debug.
> Should i include libunwind first in LD_LIBRARY_PATH? Right now it's at the
> end? If libunwind takes over gcc libs, is the order of symbol search in
> LD_LIBRARY_PATH matters?

It's dependent on libdl and libc, but ok to strip symbols. I would be
careful when stripping ELF objects because you could be stripping out
unwind information as well (.eh_frame or .debug_frame sections).

Thanks. Here is the output of target's libc and libdl libraries. .eh_frame seems to be only 4 bytes in both the libraries and i don't see debug frames. When i checked the unwind code, it tries some 4 options to unwind a stack and one of the options look for .extab, .exidx frames too. May be it's picking up from there? May be that's why it's working for a simple application compiled with default gcc options.

Still, I am not sure how those 3 symbols alone causes crash even when not called. Those names doesn't look like one colliding with global namespace?

libdl-2.8.so  :
section             size     addr
.note.ABI-tag       0x20    0x154
.gnu.hash           0x98    0x174
.dynsym            0x2d0    0x20c
.dynstr            0x211    0x4dc
.gnu.version        0x5a    0x6ee
.gnu.version_d      0x5c    0x748
.gnu.version_r      0x50    0x7a4
.rel.dyn            0xa0    0x7f4
.rel.plt            0xb0    0x894
.init                0xc    0x944
.plt               0x11c    0x950
.text             0x2588    0xa6c
.fini                0x8   0x2ff4
.rodata             0x80   0x2ffc
.interp             0x14   0x307c
.ARM.extab          0x18   0x3090
.ARM.exidx         0x178   0x30a8
.eh_frame            0x4   0x3220
.hash              0x204   0x3224
.init_array          0x8   0xbee4
.fini_array          0x8   0xbeec
.jcr                 0x4   0xbef4
.dynamic           0x108   0xbef8
.got                0xa0   0xc000
.data                0x4   0xc0a0
.bss                0x30   0xc0a4
.ARM.attributes     0x2f      0x0
Total             0x34f2


and libc


libc-2.8.so  :
section                                size       addr
.note.ABI-tag                          0x20      0x174
.gnu.hash                            0x3888      0x194
.dynsym                              0x8340     0x3a1c
.dynstr                              0x554c     0xbd5c
.gnu.version                         0x1068    0x112a8
.gnu.version_d                         0xec    0x12310
.gnu.version_r                         0x30    0x123fc
.rel.dyn                             0x2798    0x1242c
.rel.plt                               0x98    0x14bc4
.plt                                   0xf8    0x14c5c
.text                               0xe73a0    0x14d60
__libc_freeres_fn                     0xe88    0xfc100
__libc_thread_freeres_fn              0x160    0xfcf88
.rodata                             0x17774    0xfd0e8
.interp                                0x14   0x11485c
.ARM.extab                            0xd6c   0x114870
.ARM.exidx                           0x3f48   0x1155dc
.eh_frame                               0x4   0x119524
.hash                                0x30bc   0x119528
.tdata                                  0x8   0x1246e8
.tbss                                  0x38   0x1246f0
.fini_array                             0x4   0x1246f0
.ctors                                  0x8   0x1246f4
.dtors                                  0x8   0x1246fc
__libc_subfreeres                      0x6c   0x124704
__libc_atexit                           0x4   0x124770
__libc_thread_subfreeres                0xc   0x124774
.data.rel.ro                         0x1798   0x124780
.dynamic                               0xe8   0x125f18
.got                                  0x1ac   0x126000
.data                                 0x7c4   0x1261b0
.bss                                 0x28d0   0x126978
.ARM.attributes                        0x2d        0x0
.gnu.warning.sigstack                  0x50        0x0
.gnu.warning.sigreturn                 0x3c        0x0
.gnu.warning.siggetmask                0x3c        0x0
.gnu.warning.getcontext                0x3c        0x0
.gnu.warning.setcontext                0x3c        0x0
.gnu.warning.makecontext               0x40        0x0
.gnu.warning.swapcontext               0x40        0x0
.gnu.warning.tmpnam                    0x38        0x0
.gnu.warning.tmpnam_r                  0x3c        0x0
.gnu.warning.tempnam                   0x38        0x0
.gnu.warning.sys_errlist               0x44        0x0
.gnu.warning.sys_nerr                  0x44        0x0
.gnu.warning.gets                      0x3c        0x0
.gnu.warning.getpw                     0x3c        0x0
.gnu.warning.setlogin                  0x3c        0x0
.gnu.warning.getwd                     0x78        0x0
.gnu.warning.lchmod                    0x38        0x0
.gnu.warning.sync_file_range           0x44        0x0
.gnu.warning.sstk                      0x38        0x0
.gnu.warning.mktemp                    0x38        0x0
.gnu.warning.gtty                      0x38        0x0
.gnu.warning.stty                      0x38        0x0
.gnu.warning.chflags                   0x3c        0x0
.gnu.warning.fchflags                  0x3c        0x0
.gnu.warning.revoke                    0x38        0x0
.gnu.warning.llseek                    0x40        0x0
.gnu.warning.epoll_pwait               0x40        0x0
.gnu.warning.create_module             0x40        0x0
.gnu.warning.get_kernel_syms           0x44        0x0
.gnu.warning.query_module              0x40        0x0
.gnu.warning.__gets_chk                0x3c        0x0
.gnu.warning.inet6_option_space        0x3c        0x0
.gnu.warning.inet6_option_init         0x3c        0x0
.gnu.warning.inet6_option_append       0x40        0x0
.gnu.warning.inet6_option_alloc        0x3c        0x0
.gnu.warning.inet6_option_next         0x3c        0x0
.gnu.warning.inet6_option_find         0x3c        0x0
.gnu.warning.getmsg                    0x38        0x0
.gnu.warning.getpmsg                   0x3c        0x0
.gnu.warning.putmsg                    0x38        0x0
.gnu.warning.putpmsg                   0x3c        0x0
.gnu.warning.fattach                   0x3c        0x0
.gnu.warning.fdetach                   0x3c        0x0
Total                              0x121a99

 
Sounds like what you want to do is to get a remote gdb working for
your target, so you can have symbols and get a better handle on where
the binary is crashing. This way you won't be space limited due to
having an embedded target.

 -Arun


reply via email to

[Prev in Thread] Current Thread [Next in Thread]