Script started on Fri Aug 27 13:25:05 2010 GNU gdb (GDB) 7.2.50.20100827-cvs Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later 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 "armv7l-unknown-linux-gnueabi". For bug reporting instructions, please see: ... Reading symbols from /home/ubuntu/src/pth/pth/.libs/test_std...done. (gdb) b pth_mctx.c:361 No source file named pth_mctx.c. Make breakpoint pending on future shared library load? (y or [n]) (gdb) b main Breakpoint 1 at 0x8932: file test_std.c, line 83. (gdb) r Starting program: /home/ubuntu/src/pth/pth/.libs/test_std Breakpoint 1, main (argc=1, argv=0xbed8f844) at test_std.c:83 83 fprintf(stderr, "\n=== TESTING GLOBAL LIBRARY API ===\n\n"); (gdb) b pth_mctx.c:361 Breakpoint 2 at 0x40022be4: file pth_mctx.c, line 361. (gdb) c Continuing. === TESTING GLOBAL LIBRARY API === Fetching library version version = 0x200207 === TESTING BASIC OPERATION === Initializing Pth system (spawns scheduler and main thread) pth_lib.c: before pth_spawn Program received signal SIGUSR1, User defined signal 1. __libc_do_syscall () at ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S:41 41 ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S: No such file or directory. in ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S (gdb) c Continuing. Breakpoint 2, __pth_mctx_set (mctx=0x13130, func=0x4002541d , sk_addr_lo=, sk_addr_hi=0x23388 "") at pth_mctx.c:361 361 if (pth_mctx_save((pth_mctx_t *)&mctx_caller) == 0) (gdb) n 362 longjmp(*((jmp_buf *)&mctx_trampoline), 1); (gdb) p *(jmp_buf *)&mctx_caller $1 = {{__jmpbuf = {1073956680, 78128, 0, 1073956680, 144264, -1093077412, 1073894429, -1093077424, -1093077968, 1073884153, 0 }, __mask_was_saved = 1, __saved_mask = {__val = {0 }}}} (gdb) x/12xw &mctx_caller 0x400347d0 : 0x40034748 0x00013130 0x00000000 0x40034748 0x400347e0 : 0x00023388 0xbed8f65c 0x4002541d 0xbed8f650 0x400347f0 : 0xbed8f430 0x40022bf9 0x00000000 0x00000000 (gdb) p/x $pc $2 = 0x40022c12 (gdb) x/20i 0x40022bf4 0x40022bf4 <__pth_mctx_set+328>: blx 0x40021b54 0x40022bf8 <__pth_mctx_set+332>: cbz r0, 0x40022c12 <__pth_mctx_set+358> 0x40022bfa <__pth_mctx_set+334>: movs r3, #1 0x40022bfc <__pth_mctx_set+336>: b.n 0x40022b1a <__pth_mctx_set+110> 0x40022bfe <__pth_mctx_set+338>: blx 0x400221a8 0x40022c02 <__pth_mctx_set+342>: movs r1, #5 0x40022c04 <__pth_mctx_set+344>: mov r3, r4 0x40022c06 <__pth_mctx_set+346>: str r1, [r0, #0] 0x40022c08 <__pth_mctx_set+348>: b.n 0x40022b1a <__pth_mctx_set+110> 0x40022c0a <__pth_mctx_set+350>: mov r0, r11 0x40022c0c <__pth_mctx_set+352>: blx 0x40021d1c 0x40022c10 <__pth_mctx_set+356>: b.n 0x40022ba8 <__pth_mctx_set+252> => 0x40022c12 <__pth_mctx_set+358>: ldr r6, [pc, #24] ; (0x40022c2c <__pth_mctx_set+384>) 0x40022c14 <__pth_mctx_set+360>: movs r1, #1 0x40022c16 <__pth_mctx_set+362>: ldr r7, [sp, #4] 0x40022c18 <__pth_mctx_set+364>: adds r5, r7, r6 0x40022c1a <__pth_mctx_set+366>: add.w r0, r5, #664 ; 0x298 0x40022c1e <__pth_mctx_set+370>: blx 0x40021bac 0x40022c22 <__pth_mctx_set+374>: nop 0x40022c24 <__pth_mctx_set+376>: andeq r1, r1, r0, asr #10 (gdb) p/x $sp $3 = 0xbed8f430 (gdb) # ok, the jmp_buf looks sane-ish (gdb) i fr Stack level 0, frame at 0xbed8f690: pc = 0x40022c12 in __pth_mctx_set (pth_mctx.c:362); saved pc 0x40025006 called by frame at 0xbed8f6c0 source language c. Arglist at 0xbed8f430, args: mctx=0x13130, func=0x4002541d , sk_addr_lo=, sk_addr_hi=0x23388 "" Locals at 0xbed8f430, Previous frame's sp is 0xbed8f690 Saved registers: r4 at 0xbed8f66c, r5 at 0xbed8f670, r6 at 0xbed8f674, r7 at 0xbed8f678, r8 at 0xbed8f67c, r9 at 0xbed8f680, r10 at 0xbed8f684, r11 at 0xbed8f688, lr at 0xbed8f68c (gdb) list 362 357 * redundant ping-pong pointer arithmentic is neccessary to avoid 358 * type-conversion warnings related to the `volatile' qualifier and 359 * the fact that `jmp_buf' usually is an array type. 360 */ 361 if (pth_mctx_save((pth_mctx_t *)&mctx_caller) == 0) 362 longjmp(*((jmp_buf *)&mctx_trampoline), 1); 363 364 /* 365 * Ok, we returned again, so now we're finished 366 */ (gdb) x/12xw &mctx_trampoline 0x400349e0 : 0xbed8f550 0x00013130 0x00000000 0x000000b3 0x400349f0 : 0x00023388 0xbed8f65c 0x4002541d 0xbed8f650 0x40034a00 : 0x00023088 0x40022a8b 0x00000000 0x00000000 (gdb) b *0x40022a8a Breakpoint 3 at 0x40022a8a: file pth_mctx.c, line 394. (gdb) # sp value 0x00023088 might be garbage? (gdb) c Continuing. *** longjmp causes uninitialized stack frame ***: /home/ubuntu/src/pth/pth/.libs/test_std terminated Program received signal SIGABRT, Aborted. __libc_do_syscall () at ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S:41 41 ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S: No such file or directory. in ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S (gdb) # hmm (gdb) b pth_mctx_set_trampoline Breakpoint 4 at 0x40022a70: file pth_mctx.c, line 394. (gdb) p pth_mctx_set_trampoline $4 = {void (int)} 0x40022a70 (gdb) k Kill the program being debugged? (y or n) y (gdb) r Starting program: /home/ubuntu/src/pth/pth/.libs/test_std Warning: Cannot insert breakpoint 3. Error accessing memory address 0x40022a8a: Input/output error. (gdb) disa 3 (gdb) c Continuing. Breakpoint 1, main (argc=1, argv=0xbed67844) at test_std.c:83 83 fprintf(stderr, "\n=== TESTING GLOBAL LIBRARY API ===\n\n"); (gdb) ena 3 (gdb) c Continuing. === TESTING GLOBAL LIBRARY API === Fetching library version version = 0x200207 === TESTING BASIC OPERATION === Initializing Pth system (spawns scheduler and main thread) pth_lib.c: before pth_spawn Program received signal SIGUSR1, User defined signal 1. __libc_do_syscall () at ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S:41 41 ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S: No such file or directory. in ../ports/sysdeps/unix/sysv/linux/arm/eabi/libc-do-syscall.S (gdb) c Continuing. Breakpoint 4, pth_mctx_set_trampoline (sig=10) at pth_mctx.c:394 394 if (setjmp(*((jmp_buf *)&mctx_trampoline)) == 0) { (gdb) p/x $sp $5 = 0x23098 (gdb) x/20i $pc-8 0x40022a68 : strdeq r1, [r1], -r0 0x40022a6c : andeq r0, r0, r8, asr #14 => 0x40022a70 : ldr r2, [pc, #48] ; (0x40022aa4 ) 0x40022a72 : nop 0x40022a74 : add r0, pc, #0 ; (adr r0, 0x40022a78 ) 0x40022a76 : ldr r1, [pc, #48] ; (0x40022aa8 ) 0x40022a78 : adds r3, r2, r0 0x40022a7a : push {lr} 0x40022a7c : adds r0, r3, r1 0x40022a7e : sub sp, #12 0x40022a80 : add.w r0, r0, #664 ; 0x298 0x40022a84 : str r3, [sp, #4] 0x40022a86 : blx 0x40021e24 0x40022a8a : cbnz r0, 0x40022a9c 0x40022a8c : ldr r0, [pc, #24] ; (0x40022aa8 ) 0x40022a8e : movs r1, #1 0x40022a90 : ldr r2, [sp, #4] 0x40022a92 : adds r3, r2, r0 ---Type to continue, or q to quit---x/20i $pc-6 0x40022a94 : str.w r1, [r3, #1056] ; 0x420 0x40022a98 : add sp, #12 (gdb) x/20i $pc => 0x40022a70 : ldr r2, [pc, #48] ; (0x40022aa4 ) 0x40022a72 : nop 0x40022a74 : add r0, pc, #0 ; (adr r0, 0x40022a78 ) 0x40022a76 : ldr r1, [pc, #48] ; (0x40022aa8 ) 0x40022a78 : adds r3, r2, r0 0x40022a7a : push {lr} 0x40022a7c : adds r0, r3, r1 0x40022a7e : sub sp, #12 0x40022a80 : add.w r0, r0, #664 ; 0x298 0x40022a84 : str r3, [sp, #4] 0x40022a86 : blx 0x40021e24 0x40022a8a : cbnz r0, 0x40022a9c 0x40022a8c : ldr r0, [pc, #24] ; (0x40022aa8 ) 0x40022a8e : movs r1, #1 0x40022a90 : ldr r2, [sp, #4] 0x40022a92 : adds r3, r2, r0 0x40022a94 : str.w r1, [r3, #1056] ; 0x420 0x40022a98 : add sp, #12 ---Type to continue, or q to quit---q Quit (gdb) set pagination off (gdb) p setjmp $6 = {} 0x40086220 (gdb) tb *0x40022a86 Temporary breakpoint 5 at 0x40022a86: file pth_mctx.c, line 394. (gdb) c Continuing. Temporary breakpoint 5, 0x40022a86 in pth_mctx_set_trampoline (sig=) at pth_mctx.c:394 394 if (setjmp(*((jmp_buf *)&mctx_trampoline)) == 0) { (gdb) p/x $sp $7 = 0x23088 (gdb) q A debugging session is active. Inferior 1 [process 30355] will be killed. Quit anyway? (y or n) y Script done on Fri Aug 27 13:41:00 2010