|
|
This report is used to show the power of gdb
As we know, gdb is a powerful tool used to debug programs under linux.
The commands of gdb listed below is used to show its power:
(gdb) b 528
Breakpoint 1 at 0x804b124: file 4n-xfig-nxm-9.c, line 528.
(gdb) commands 1
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just "end".
>p *d
>p *dd
>end
_______________the commands above are used to run print command on the breakpoint 1
(gdb) set $l=0
(gdb) while $l<10
>p $l
>set $l=$l+1
>end
$1 = 0
$2 = 1
$3 = 2
$4 = 3
$5 = 4
$6 = 5
$7 = 6
$8 = 7
$9 = 8
$10 = 9
(gdb)
_____________________These commands above are a piece of loop program running in gdb which
can be applied for purpose of printing a linked list. The following are to run through a linked list:
(gdb) set $l=0
(gdb) set $p=&dt[0][0]
(gdb) while $l<20
>p *$p
>set $p=$p->next
>set $l=$l+1
>end
... ... |
|