Jackey's 感悟

Do Research

《软件调试的艺术》学习笔记——GDB使用技巧摘要(2)

command命令可以在每次发生断点的时候自动执行一系列命令,解放程序员的双手。
见示例:
(gdb) command 1
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just “end”
>silent
>printf “fibonacci was passed %d.\n”, n
> continue
>end
(gdb) run
Starting program: fibonacci
fibonacci was passed 3.
fibonacci was passed 2.
fibonacci was passed 1.
fibonacci was passed 0.
fibonacci was passed 1.
Fibonacci(3) is 3.

Program exited normally.
(gdb)
Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google photo

You are commenting using your Google account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s

%d 博主赞过: