2014年(35)
分类: 嵌入式
2014-02-08 16:51:58
原文地址:GDB远程调试技术(应用层调试) 作者:imjacob
|
|
|
|
|
|
|
|
|
GNU gdb (Sourcery G++ Lite 2008q3-72) 6.8.50.20080821-cvs
|
|
|
|
|
|
|
|
|
|
(gdb) set solib-absolute-prefix /home/kernel/fs/root_nfs
(gdb) set solib-search-path /home/kernel/fs/root_nfs/lib
(gdb) target remote 10.27.10.23:9000
Remote debugging using 10.27.10.23:9000
Reading symbols from /home/kernel/fs/root_nfs/lib/ld-linux.so.3...(no debugging symbols
found)...done.
Loaded symbols for /home/kernel/fs/root_nfs/lib/ld-linux.so.3
0x400007b0 in ?? () from /home/kernel/fs/root_nfs/lib/ld-linux.so.3
(gdb) l
3 {
4 int i=2;
5 int x, y;
6
7 x=(++i);
8 printf(" %d %d\n", i,x);
9 x+=(++i);
10 printf(" %d %d\n", i,x);
11 x+=(++i);
12 printf(" %d %d\n", i,x);
(gdb) l
13 i=2;
14 y=(i++)+(i++)+(i++);
15 printf(" %d %d\n", i,y);
16
17 return 0;
18 }
19
(gdb) b 8
Note: breakpoint 1 also set at pc 0x83a8.
Breakpoint 2 at 0x83a8: file test.c, line 8.
(gdb) c
Continuing.
Breakpoint 1, main () at test.c:8
8 printf(" %d %d\n", i,x);
(gdb) n
9 x+=(++i);
(gdb) b 12
Breakpoint 3 at 0x8400: file test.c, line 12.
(gdb) n
10 printf(" %d %d\n", i,x);
(gdb) n
11 x+=(++i);
(gdb) n
Breakpoint 3, main () at test.c:12
12 printf(" %d %d\n", i,x);
(gdb) n
13 i=2;
(gdb) n
14 y=(i++)+(i++)+(i++);
(gdb) n
15 printf(" %d %d\n", i,y);
(gdb) n
17 return 0;
(gdb) n
18 }
(gdb) n
0x4003b004 in __libc_start_main ()
from /home/kernel/fs/root_nfs/lib/libc.so.6
(gdb)