lambda$ uname -a Darwin lambda.local 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov 3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386 lambda$ msp430-gdb stack_bt.elf GNU gdb (GDB) 7.0 Copyright (C) 2009 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 "--host=i386-apple-darwin10.2.0 --target=msp430". For bug reporting instructions, please see: ... Reading symbols from /Volumes/data/skimu/proj/dfw/examples/f2274sbw/stack_bt.elf...done. 0x00008000 in _reset_vector__ () (gdb) reload Erasing target flash - Erased OK flash write enabled Loading section .text, size 0xe6 lma 0x8000 Loading section .vectors, size 0x20 lma 0xffe0 Start address 0x8000, load size 262 Transfer rate: 462 bytes/sec, 37 bytes/write. flash write disabled (gdb) list 1,100 1 /* 2 have fun with GDB's stack trace 3 */ 4 #include 5 6 #define toggle_led() {P1OUT ^= BIT0;} 7 8 tak(x, y, z) 9 { 10 if (x <= y) 11 return z; 12 else 13 return tak(tak(x-1, y, z), 14 tak(y-1, z, x), 15 tak(z-1, x, y)); 16 } 17 18 factorial(n) 19 { 20 if (n == 1) 21 return 1; 22 else 23 return n * factorial(n-1); 24 } 25 26 main() 27 { 28 WDTCTL = (WDTPW|WDTHOLD); 29 P1DIR |= 0x01; 30 31 while (1) { 32 toggle_led(); 33 tak(10, 5, 1); 34 } 35 } 36 37 /* EOF */ (gdb) c Continuing. ^C Program received signal SIGINT, Interrupt. 0x00008048 in tak (x=6, y=2, z=1) at ../stack_bt.c:10 10 if (x <= y) (gdb) bt #0 0x00008048 in tak (x=6, y=2, z=1) at ../stack_bt.c:10 #1 0x00008056 in tak (x=2, y=1, z=7) at ../stack_bt.c:13 #2 0x00008064 in tak (x=7, y=3, z=1) at ../stack_bt.c:13 #3 0x00008056 in tak (x=3, y=1, z=8) at ../stack_bt.c:13 #4 0x00008064 in tak (x=8, y=4, z=1) at ../stack_bt.c:13 #5 0x00008056 in tak (x=4, y=1, z=9) at ../stack_bt.c:13 #6 0x00008064 in tak (x=9, y=5, z=1) at ../stack_bt.c:13 #7 0x00008072 in tak (x=10, y=5, z=1) at ../stack_bt.c:13 #8 0x000080c8 in main () at ../stack_bt.c:33 (gdb) list 5 6 #define toggle_led() {P1OUT ^= BIT0;} 7 8 tak(x, y, z) 9 { 10 if (x <= y) 11 return z; 12 else 13 return tak(tak(x-1, y, z), 14 tak(y-1, z, x), (gdb) info r pc/r0: 8048 sp/r1: 05a0 sr/r2: 0004 r3: 0000 fp/r4: ffff r5: ffbf r6: ffef r7: 0001 r8: 0002 r9: 0006 r10: 0003 r11: 0004 r12: efff r13: 0001 r14: 0002 r15: 0006 (gdb) quit A debugging session is active. Inferior 1 [Remote target] will be killed. Quit anyway? (y or n) y lambda$