gdb中执行完一个函数后如何单步执行该函数?
在gdb中,我可以使用命令“call”调用一个函数,但是如何单步执行该函数呢?我不想重新启动程序,但是函数已经执行了,gdb将执行下一条语句,并且我不知道如何调用该函数。
In gdb, I can call one function with command "call", but how can I step in the function? I don't want to restart the program, but the function had been executed, gdb will execute next statement, and I don't know how to recall the function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
gdb 具有反向调试能力。您可以在此处使用
reverse-step
,然后再次运行您的函数。gdb has reverse debugging ability. You can use
reverse-step
here and then run your function once again.在您的情况下,您希望单步执行使用 gdb 命令
call
执行的函数。因此,您需要在此函数处设置一个断点,然后执行它。当我想随时进入一个函数时,我总是这样做。如果它不执行这个函数,我认为它可能在存储有关函数及其源代码的信息的符号表中存在一些问题。您必须通过使用
-g
重新编译该表来确保该表正确。In your situation, you want to step into the function you use the gdb command
call
to execute. Thus you need to set abreakpoint
at this function then execute it. That is the way I always do when I want to step in a function in anytime.If it does not step in this function, I think it probably has some problems in the symbol table which store the information about the function and its source code. You have to make sure the table is right by recompiling it with
-g
.