如何使用gdb命令列表打印函数的参数并返回值而不暂停? [英] How to use gdb command list to print a function's parameter and return value without pausing?
本文介绍了如何使用gdb命令列表打印函数的参数并返回值而不暂停?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想查看哪个参数和函数的返回值。我使用gdb断点命令列表(gdb命令脚本),如下所示:
int foo(int)
(gdb)break foo
(gdb)print $ r0
(gdb)finish
(gdb)print $ r0
(gdb)continue
(gdb)end
但它仅打印参数。
我从这里得到了原因 GDB断点命令列表
命令列表中的任何其他命令在忽略执行的命令后被忽略。
任何帮助表示感谢。
解决方案
如果您想在那里关联命令,您需要在函数结尾处添加第二个断点。
I want to see which parameter and return value to a function. I use gdb breakpoint command list (gdb command script) as follow:
int foo(int)
(gdb) break foo
(gdb) print $r0
(gdb) finish
(gdb) print $r0
(gdb) continue
(gdb) end
But it print only the parameter.
I got the reason from here GDB Breakpoint command lists
Any other commands in the command list, after a command that resumes execution, are ignored.
Any help is appreciated.
解决方案
You need a second breakpoint at the end of the function if you want to associate commands there.
这篇关于如何使用gdb命令列表打印函数的参数并返回值而不暂停?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文