Does the backtrace from the segfault ever get up into Thrift code, or is it _pthread_cleanup_push_defer forever? I suppose this might be an incompatibility between Thrift and uClibc.
Siamak Haschemi wrote: > Hello again, > > now I have some results: > >> 1/ If you can run your program under gdb, please do so. When it crashes, >> execute the "backtrace" command. Paste the results. > > Type "help" followed by a class name for a list of commands in that class. > Type "help all" for the list of all commands. > Type "help" followed by command name for full documentation. > Type "apropos word" to search for commands related to "word". > Command name abbreviations are allowed if unambiguous. > (gdb) help breakpoints > Making program stop at certain points. > > List of commands: > > awatch -- Set a watchpoint for an expression > break -- Set breakpoint at specified line or function > catch -- Set catchpoints to catch events > clear -- Clear breakpoint at specified line or function > commands -- Set commands to be executed when a breakpoint is hit > condition -- Specify breakpoint number N to break only if COND is true > delete -- Delete some breakpoints or auto-display expressions > delete breakpoints -- Delete some breakpoints or auto-display expressions > delete checkpoint -- Delete a fork/checkpoint (experimental) > delete display -- Cancel some expressions to be displayed when program stops > delete mem -- Delete memory region > delete tracepoints -- Delete specified tracepoints > disable -- Disable some breakpoints > disable breakpoints -- Disable some breakpoints > disable display -- Disable some expressions to be displayed when program > stops > disable mem -- Disable memory region > disable tracepoints -- Disable specified tracepoints > enable -- Enable some breakpoints > enable delete -- Enable breakpoints and delete when hit > enable display -- Enable some expressions to be displayed when program stops > enable mem -- Enable memory region > enable once -- Enable breakpoints for one hit > enable tracepoints -- Enable specified tracepoints > hbreak -- Set a hardware assisted breakpoint > ignore -- Set ignore-count of breakpoint number N to COUNT > rbreak -- Set a breakpoint for all functions matching REGEXP > rwatch -- Set a read watchpoint for an expression > tbreak -- Set a temporary breakpoint > tcatch -- Set temporary catchpoints to catch events > thbreak -- Set a temporary hardware assisted breakpoint > watch -- Set a watchpoint for an expression > > Type "help" followed by command name for full documentation. > Type "apropos word" to search for commands related to "word". > Command name abbreviations are allowed if unambiguous. > (gdb) breakpoints clear > Undefined command: "breakpoints". Try "help". > (gdb) break clear > Function "clear" not defined. > Make breakpoint pending on future shared library load? (y or [n]) n > (gdb) quit > [EMAIL PROTECTED]:~/seismo-openwrt/trunk/build_dir/i386/root-x86$ gdb > GNU gdb 6.8-debian > Copyright (C) 2008 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > <http://gnu.org/licenses/gpl.html> > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. Type "show copying" > and "show warranty" for details. > This GDB was configured as "i486-linux-gnu". > (gdb) >> 1/ If you can run your program under gdb, please do so. When > it crashes, > Undefined command: ">>". Try "help". > (gdb) >> execute the "backtrace" command. Paste the results.Quit > (gdb) quit > [EMAIL PROTECTED]:~/seismo-openwrt/trunk/build_dir/i386/root-x86$ gdb > GNU gdb 6.8-debian > Copyright (C) 2008 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > <http://gnu.org/licenses/gpl.html> > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. Type "show copying" > and "show warranty" for details. > This GDB was configured as "i486-linux-gnu". > (gdb) set solib-absolute-prefix > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86 > (gdb) file bin/hello > Reading symbols from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/bin/hello...done. > (gdb) target remote 141.20.23.212:2345 > Remote debugging using 141.20.23.212:2345 > 0xb7f6e910 in _start () from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/ld-uClibc.so.0 > (gdb) continue > Continuing. > > Program received signal SIGSEGV, Segmentation fault. > 0xb7dafb0a in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > (gdb) bt > #0 0xb7dafb0a in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #1 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #2 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #3 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #4 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #5 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #6 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #7 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #8 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #9 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #10 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #11 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #12 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #13 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #14 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #15 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #16 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #17 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #18 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #19 0xb7dafb2b in _pthread_cleanup_push_defer () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > ---Type <return> to continue, or q <return> to quit--- > >> 2/ execute the command "break setrlimit", then "run" (say "yes" when it >> asks you if you want to start your program from the beginning). It should >> stop right before calling setrlimit. Paste the backtrace > > Breakpoint 1, 0xb7db5aa5 in setrlimit () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > (gdb) bt > #0 0xb7db5aa5 in setrlimit () from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libc.so.0 > #1 0xb7d9bb22 in ?? () from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libpthread.so.0 > #2 0xb7d9c137 in ?? () from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libpthread.so.0 > #3 0xb7d966c1 in ?? () from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/libpthread.so.0 > #4 0xb7fa73f0 in _dl_get_ready_to_run () > from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/ld-uClibc.so.0 > #5 0xb7fa76ea in ?? () from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/ld-uClibc.so.0 > #6 0xb7fa4915 in _start () from > /home/siamak/seismo-openwrt/trunk/build_dir/i386/root-x86/lib/ld-uClibc.so.0 > > > > Kind regards, > > Siamak > > Siamak Haschemi schrieb: >> Hello David, >> >> thank you for helping me! >> >> I have troubles in setting breakpoints. I'm forced to use gdbserver with >> gdb. I replaced the real IP with DEVICE_IP in this E-Mail. >> >> See my comments below. >> >> David Reiss schrieb: >>> Can you please report the following... >>> >>> 1/ If you can run your program under gdb, please do so. When it crashes, >>> execute the "backtrace" command. Paste the results. >> GNU gdb 6.8-debian >> Copyright (C) 2008 Free Software Foundation, Inc. >> License GPLv3+: GNU GPL version 3 or later >> <http://gnu.org/licenses/gpl.html> >> This is free software: you are free to change and redistribute it. >> There is NO WARRANTY, to the extent permitted by law. Type "show copying" >> and "show warranty" for details. >> This GDB was configured as "i486-linux-gnu". >> (gdb) symbol-file hello >> Reading symbols from >> /home/siamak/seismo-openwrt/trunk/build_dir/i386/hello/hello...done. >> (gdb) target remote DEVICE_IP:2345 >> Remote debugging using DEVICE_IP:2345 >> 0xb7f23910 in ?? () >> (gdb) continue >> Continuing. >> >> Program received signal SIGSEGV, Segmentation fault. >> 0xb7d6db0a in ?? () >> (gdb) backtrace >> #0 0xb7d6db0a in ?? () >> #1 0xb7d6db2b in ?? () >> #2 0xb7d6db2b in ?? () >> #3 0xb7d6db2b in ?? () >> #4 0xb7d6db2b in ?? () >> #5 0xb7d6db2b in ?? () >> #6 0xb7d6db2b in ?? () >> #7 0xb7d6db2b in ?? () >> #8 0xb7d6db2b in ?? () >> #9 0xb7d6db2b in ?? () >> #10 0xb7d6db2b in ?? () >> #11 0xb7d6db2b in ?? () >> #12 0xb7d6db2b in ?? () >> #13 0xb7d6db2b in ?? () >> #14 0xb7d6db2b in ?? () >> #15 0xb7d6db2b in ?? () >> #16 0xb7d6db2b in ?? () >> #17 0xb7d6db2b in ?? () >> #18 0xb7d6db2b in ?? () >> #19 0xb7d6db2b in ?? () >> #20 0xb7d6db2b in ?? () >> #21 0xb7d6db2b in ?? () >> #22 0xb7d6db2b in ?? () >> #23 0xb7d6db2b in ?? () >> #24 0xb7d6db2b in ?? () >> #25 0xb7d6db2b in ?? () >> #26 0xb7d6db2b in ?? () >> #27 0xb7d6db2b in ?? () >> #28 0xb7d6db2b in ?? () >> #29 0xb7d6db2b in ?? () >> #30 0xb7d6db2b in ?? () >> #31 0xb7d6db2b in ?? () >> #32 0xb7d6db2b in ?? () >> #33 0xb7d6db2b in ?? () >> ---Type <return> to continue, or q <return> to quit--- >> #34 0xb7d6db2b in ?? () >> #35 0xb7d6db2b in ?? () >> #36 0xb7d6db2b in ?? () >> #37 0xb7d6db2b in ?? () >> #38 0xb7d6db2b in ?? () >> #39 0xb7d6db2b in ?? () >> #40 0xb7d6db2b in ?? () >> #41 0xb7d6db2b in ?? () >> #42 0xb7d6db2b in ?? () >> #43 0xb7d6db2b in ?? () >> #44 0xb7d6db2b in ?? () >> #45 0xb7d6db2b in ?? () >> #46 0xb7d6db2b in ?? () >> #47 0xb7d6db2b in ?? () >> #48 0xb7d6db2b in ?? () >> #49 0xb7d6db2b in ?? () >> #50 0xb7d6db2b in ?? () >> #51 0xb7d6db2b in ?? () >> #52 0xb7d6db2b in ?? () >> #53 0xb7d6db2b in ?? () >> #54 0xb7d6db2b in ?? () >> #55 0xb7d6db2b in ?? () >> #56 0xb7d6db2b in ?? () >> #57 0xb7d6db2b in ?? () >> #58 0xb7d6db2b in ?? () >> #59 0xb7d6db2b in ?? () >> #60 0xb7d6db2b in ?? () >> #61 0xb7d6db2b in ?? () >> #62 0xb7d6db2b in ?? () >> #63 0xb7d6db2b in ?? () >> #64 0xb7d6db2b in ?? () >> #65 0xb7d6db2b in ?? () >> #66 0xb7d6db2b in ?? () >> #67 0xb7d6db2b in ?? () >> ---Type <return> to continue, or q <return> to quit--- >> ... and so on >> >>> 2/ execute the command "break setrlimit", then "run" (say "yes" when it >>> asks you if you want to start your program from the beginning). It should >>> stop right before calling setrlimit. Paste the backtrace. >> GNU gdb 6.8-debian >> Copyright (C) 2008 Free Software Foundation, Inc. >> License GPLv3+: GNU GPL version 3 or later >> <http://gnu.org/licenses/gpl.html> >> This is free software: you are free to change and redistribute it. >> There is NO WARRANTY, to the extent permitted by law. Type "show copying" >> and "show warranty" for details. >> This GDB was configured as "i486-linux-gnu". >> (gdb) symbol-file hello >> Reading symbols from >> /home/siamak/seismo-openwrt/trunk/build_dir/i386/hello/hello...done. >> (gdb) target remote DEVICE_IP:2345 >> Remote debugging using DEVLICE_IP:2345 >> 0xb7f9c910 in ?? () >> (gdb) break setrlimit >> Function "setrlimit" not defined. >> Make breakpoint pending on future shared library load? (y or [n]) y >> Breakpoint 1 (setrlimit) pending. >> (gdb) c >> Continuing. >> >> Program received signal SIGSEGV, Segmentation fault. >> 0xb7de6b0a in ?? () >> >> :-( gdb does not stop at the breakpoint. >> >> >> >>> Please make sure that you have compiled Thrift for debugging. >>> ("./configure CXXFLAGS='-O0 -g'"). >> I run another test in which I force the loading of a library: >> >> 1) >> [EMAIL PROTECTED]:~# env LD_PRELOAD=/usr/lib/libz.so.1 echo hello >> hello >> >> 2) >> [EMAIL PROTECTED]:~# env LD_PRELOAD=/usr/lib/libnl.so.1 echo hello >> hello >> >> 3) >> [EMAIL PROTECTED]:~# env LD_PRELOAD=/usr/lib/libthrift.so.0 echo hello >> Segmentation fault >> >> >> ====== >> >> >> And here are some (relevant) outputs from the build: >> >> >> CFLAGS="-O2 -pipe -march=i486 -funit-at-a-time -fhonour-copts >> -I/home/siamak/seismo-openwrt/trunk/staging_dir/i386/usr/include >> -I/home/siamak/seismo-openwrt/trunk/staging_dir/i386/include " >> >> CXXFLAGS="-O2 -pipe -march=i486 -funit-at-a-time -fhonour-copts >> -I/home/siamak/seismo-openwrt/trunk/staging_dir/i386/usr/include >> -I/home/siamak/seismo-openwrt/trunk/staging_dir/i386/include -g" >> >> LDFLAGS="-L/home/siamak/seismo-openwrt/trunk/staging_dir/toolchain-i386_gcc4.1.2/lib >> -L/home/siamak/seismo-openwrt/trunk/staging_dir/i386/usr/lib >> -L/home/siamak/seismo-openwrt/trunk/staging_dir/i386/lib " make -C >> /home/siamak/seismo-openwrt/trunk/build_dir/i386/thrift/lib/cpp >> >> DESTDIR="/home/siamak/seismo-openwrt/trunk/build_dir/i386/thrift/ipkg-install" >> >> >> AR=i386-linux-uclibc-ar AS="ccache i386-linux-uclibc-gcc -c -O2 -pipe >> -march=i486 -funit-at-a-time -fhonour-copts" LD=i386-linux-uclibc-ld >> >> NM=i386-linux-uclibc-nm >> CC="ccache i386-linux-uclibc-gcc" >> GCC="ccache i386-linux-uclibc-gcc" >> CXX="i386-linux-uclibc-g++" >> RANLIB=i386-linux-uclibc-ranlib >> STRIP=i386-linux-uclibc-strip >> OBJCOPY=i386-linux-uclibc-objcopy >> OBJDUMP=i386-linux-uclibc-objdump >> SIZE=i386-linux-uclibc-size >> CROSS="i386-linux-uclibc-" >> ARCH="i386" >> >> >> i386-linux-uclibc-g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I./src >> -I/home/siamak/seismo-openwrt/trunk/staging_dir/i386/usr/include >> -I/home/siamak/seismo-openwrt/trunk/staging_dir/i386/include -Wall -O0 >> -g -MT Monitor.lo -MD -MP -MF .deps/Monitor.Tpo -c >> src/concurrency/Monitor.cpp -fPIC -DPIC -o .libs/Monitor.o >> >> >>> --David >>> >>> Siamak Haschemi wrote: >>>> Hello again, >>>> >>>> the Hello world program without the thrift library linked shows this >>>> strace (only the last relevant lines included): >>>> >>>> >>>> ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo >>>> ...}) = 0 >>>> ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo >>>> ...}) = 0 >>>> brk(0) = 0x88a7000 >>>> brk(0x88a8000) = 0x88a8000 >>>> write(1, "Hello World\n", 12Hello World >>>> ) = 12 >>>> _exit(0) >>>> >>>> >>>> For me, it looks like an problem with "getrlimit" or "setrlimit" function. >>>> >>>> Lind regards, >>>> >>>> Siamak Haschemi >>>> >>>> Siamak Haschemi schrieb: >>>>> Hello again, >>>>> >>>>> I don't know if it helps, but here is some more information: >>>>> >>>>> >>>>> >>>>> [EMAIL PROTECTED]:~# ldd ./hello >>>>> libthrift.so.0 => /lib/libthrift.so.0 (0xb7f23000) >>>>> libstdc++.so.6 => /lib/libstdc++.so.6 (0xb7e68000) >>>>> libm.so.0 => /lib/libm.so.0 (0xb7e5b000) >>>>> libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7e52000) >>>>> libc.so.0 => /lib/libc.so.0 (0xb7e08000) >>>>> librt.so.0 => /lib/librt.so.0 (0xb7e05000) >>>>> libpthread.so.0 => /lib/libpthread.so.0 (0xb7df3000) >>>>> ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0xb7fb9000) >>>>> >>>>> >>>>> >>>>> [EMAIL PROTECTED]:~# strace ./hello >>>>> execve("/bin/hello", ["/bin/hello"], [/* 8 vars */]) = 0 >>>>> mmap2(NULL, 20, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) >>>>> = 0xb7f52000 >>>>> stat("/etc/ld.so.cache", 0xbff56254) = -1 ENOENT (No such file or >>>>> directory) >>>>> open("/lib/libthrift.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0755, st_size=604571, ...}) = 0 >>>>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, >>>>> 0) = 0xb7f51000 >>>>> read(3, >>>>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20q\2\0004\0\0\0"..., >>>>> 4096) = 4096 >>>>> mmap2(NULL, 606208, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = >>>>> 0xb7ebd000 >>>>> mmap2(0xb7ebd000, 591833, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0) = 0xb7ebd000 >>>>> mmap2(0xb7f4e000, 10651, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0x91) = 0xb7f4e000 >>>>> close(3) = 0 >>>>> munmap(0xb7f51000, 4096) = 0 >>>>> open("/lib/libstdc++.so.6", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0755, st_size=741369, ...}) = 0 >>>>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, >>>>> 0) = 0xb7f51000 >>>>> read(3, >>>>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0,\0\4\0004\0\0\0"..., >>>>> 4096) = 4096 >>>>> mmap2(NULL, 765952, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = >>>>> 0xb7e02000 >>>>> mmap2(0xb7e02000, 719316, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0) = 0xb7e02000 >>>>> mmap2(0xb7eb2000, 20473, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0xb0) = 0xb7eb2000 >>>>> mmap2(0xb7eb7000, 23828, PROT_READ|PROT_WRITE, >>>>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7eb7000 >>>>> close(3) = 0 >>>>> munmap(0xb7f51000, 4096) = 0 >>>>> open("/lib/libm.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=45080, ...}) = 0 >>>>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, >>>>> 0) = 0xb7f51000 >>>>> read(3, >>>>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0t\21\0\0004\0\0\0"..., >>>>> 4096) = 4096 >>>>> mmap2(NULL, 53248, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = >>>>> 0xb7df5000 >>>>> mmap2(0xb7df5000, 41028, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0) = 0xb7df5000 >>>>> mmap2(0xb7e00000, 4120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0xa) = 0xb7e00000 >>>>> close(3) = 0 >>>>> munmap(0xb7f51000, 4096) = 0 >>>>> open("/lib/libgcc_s.so.1", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=31974, ...}) = 0 >>>>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, >>>>> 0) = 0xb7f51000 >>>>> read(3, >>>>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0H\25\0\0004\0\0\0"..., >>>>> 4096) = 4096 >>>>> mmap2(NULL, 36864, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = >>>>> 0xb7dec000 >>>>> mmap2(0xb7dec000, 31592, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0) = 0xb7dec000 >>>>> mmap2(0xb7df4000, 3302, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0x7) = 0xb7df4000 >>>>> close(3) = 0 >>>>> munmap(0xb7f51000, 4096) = 0 >>>>> open("/lib/libc.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0 >>>>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, >>>>> 0) = 0xb7f51000 >>>>> read(3, >>>>> "[EMAIL PROTECTED]"..., >>>>> 4096) = 4096 >>>>> mmap2(NULL, 303104, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = >>>>> 0xb7da2000 >>>>> mmap2(0xb7da2000, 271528, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0) = 0xb7da2000 >>>>> mmap2(0xb7de5000, 5309, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0x42) = 0xb7de5000 >>>>> mmap2(0xb7de7000, 16988, PROT_READ|PROT_WRITE, >>>>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7de7000 >>>>> close(3) = 0 >>>>> munmap(0xb7f51000, 4096) = 0 >>>>> open("/lib/librt.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=4110, ...}) = 0 >>>>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, >>>>> 0) = 0xb7f51000 >>>>> read(3, >>>>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\344\4\0\0004\0\0\0"..., >>>>> 4096) = 4096 >>>>> mmap2(NULL, 12288, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = >>>>> 0xb7d9f000 >>>>> mmap2(0xb7d9f000, 2336, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0) = 0xb7d9f000 >>>>> mmap2(0xb7da0000, 4110, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0) = 0xb7da0000 >>>>> close(3) = 0 >>>>> munmap(0xb7f51000, 4096) = 0 >>>>> open("/lib/libpthread.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=58930, ...}) = 0 >>>>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, >>>>> 0) = 0xb7f51000 >>>>> read(3, >>>>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0004=\0\0004\0\0\0"..., >>>>> 4096) = 4096 >>>>> mmap2(NULL, 73728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = >>>>> 0xb7d8d000 >>>>> mmap2(0xb7d8d000, 37304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0) = 0xb7d8d000 >>>>> mmap2(0xb7d97000, 22066, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, >>>>> 0x9) = 0xb7d97000 >>>>> mmap2(0xb7d9d000, 6232, PROT_READ|PROT_WRITE, >>>>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7d9d000 >>>>> close(3) = 0 >>>>> munmap(0xb7f51000, 4096) = 0 >>>>> open("/lib/libstdc++.so.6", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0755, st_size=741369, ...}) = 0 >>>>> close(3) = 0 >>>>> open("/lib/libm.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=45080, ...}) = 0 >>>>> close(3) = 0 >>>>> open("/lib/libc.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0 >>>>> close(3) = 0 >>>>> open("/lib/libgcc_s.so.1", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=31974, ...}) = 0 >>>>> close(3) = 0 >>>>> open("/lib/libm.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=45080, ...}) = 0 >>>>> close(3) = 0 >>>>> open("/lib/libgcc_s.so.1", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=31974, ...}) = 0 >>>>> close(3) = 0 >>>>> open("/lib/libc.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0 >>>>> close(3) = 0 >>>>> open("/lib/libc.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0 >>>>> close(3) = 0 >>>>> open("/lib/libc.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0 >>>>> close(3) = 0 >>>>> open("/lib/libc.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0 >>>>> close(3) = 0 >>>>> open("/lib/libc.so.0", O_RDONLY) = 3 >>>>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0 >>>>> close(3) = 0 >>>>> stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=16390, ...}) = >>>>> 0 >>>>> mprotect(0xb7eb2000, 16384, PROT_READ) = 0 >>>>> mprotect(0xb7e00000, 4096, PROT_READ) = 0 >>>>> mprotect(0xb7de5000, 4096, PROT_READ) = 0 >>>>> mprotect(0xb7da0000, 4096, PROT_READ) = 0 >>>>> mprotect(0xb7d97000, 4096, PROT_READ) = 0 >>>>> mprotect(0xb7f57000, 4096, PROT_READ) = 0 >>>>> ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo >>>>> ...}) = 0 >>>>> ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo >>>>> ...}) = 0 >>>>> getpid() = 2933 >>>>> getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0 >>>>> setrlimit(RLIMIT_STACK, {rlim_cur=2040*1024, rlim_max=RLIM_INFINITY}) = 0 >>>>> rt_sigaction(SIGRTMIN, {0xb7d95f96, [], SA_RESTORER, 0xb7dac998}, NULL, >>>>> 8) = 0 >>>>> rt_sigaction(SIGRT_1, {0xb7d95efe, [RTMIN], SA_RESTORER, 0xb7dac998}, >>>>> NULL, 8) = 0 >>>>> rt_sigaction(SIGRT_2, {0xb7d9562a, [], SA_RESTORER, 0xb7dac998}, NULL, >>>>> 8) = 0 >>>>> rt_sigprocmask(SIG_BLOCK, [RTMIN], NULL, 8) = 0 >>>>> rt_sigprocmask(SIG_UNBLOCK, [RT_1], NULL, 8) = 0 >>>>> --- SIGSEGV (Segmentation fault) @ 0 (0) --- >>>>> +++ killed by SIGSEGV +++ >>>>> >>>>> >>>>> >>>>> Kind regards, >>>>> >>>>> Siamak Haschemi >>>>> >>>>> Siamak Haschemi schrieb: >>>>>> Hello, >>>>>> >>>>>> as you seen here (https://issues.apache.org/jira/browse/THRIFT-177), I >>>>>> am trying to cross-compile Thrift for the OpenWRT platform >>>>>> (http://openwrt.org/), which is a Linux distribution for embedded >>>>>> devices. >>>>>> >>>>>> After a two-night-fight, my result are the following: >>>>>> >>>>>> - I've created a OpenWRT package for thrift (see the attachment if you >>>>>> are interested). >>>>>> - I've successfully compiled the cpp-library (which results in >>>>>> libthrift, libthriftz and libthriftnb) >>>>>> - For now, I will not cross-compile the thrift-compiler since I will >>>>>> compile the thrift definition files on my PC. >>>>>> >>>>>> Coming to this point, I was very happy and I thought that the story >>>>>> ends, but now I am faced with a problem I cannot solve myself: >>>>>> >>>>>> For testing my cross-compilation result, I cross-compiled the cpp-part >>>>>> of the thrift tutorial. I installed the cross-compiled libraries on the >>>>>> target device and start the CppServer and the only reaction was >>>>>> "Segmentation Fault" :-( >>>>>> >>>>>> >>>>>> I tried to backtrack the problem and I came to the finding, that a >>>>>> simple hello world program, which is linked to my cross-compiled >>>>>> thrift-library, causes the "Segmentation Fault". Without linking the >>>>>> thrift-library, everything is O.K. >>>>>> >>>>>> >>>>>> ======================= >>>>>> ------------ >>>>>> Hello.cpp >>>>>> ------------ >>>>>> >>>>>> #include <iostream> >>>>>> >>>>>> using namespace std; >>>>>> >>>>>> int main(int argc, char **argv) { >>>>>> printf("Hello World!\n"); >>>>>> return 0; >>>>>> } >>>>>> >>>>>> 1) First try >>>>>> >>>>>> $ i386-linux-uclibc-g++ -L${LIB_DIR} -levent *-lthrift* -o Hello >>>>>> Hello.cpp >>>>>> >>>>>> On the target device: >>>>>> >>>>>> [EMAIL PROTECTED]:~# ./Hello >>>>>> Segmentation fault >>>>>> >>>>>> 2) Second try >>>>>> >>>>>> $ i386-linux-uclibc-g++ -L${LIB_DIR} -levent -o Hello Hello.cpp >>>>>> >>>>>> On the target device: >>>>>> >>>>>> [EMAIL PROTECTED]:~# ./Hello >>>>>> Hello World! >>>>>> >>>>>> ====================== >>>>>> >>>>>> I will try to debug it with gdb, but I'm not an expert in this. >>>>>> >>>>>> >>>>>> So, please, can someone help me? >>>>>> >>>>>> >>>>>> >>>>>> Kind regards, >>>>>> >>>>>> Siamak Haschemi >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>
