gpt4 book ai didi

gdb - 在 GDB 中,如何从用户定义的命令运行内置命令

转载 作者:行者123 更新时间:2023-12-01 16:03:05 29 4
gpt4 key购买 nike

使用 gdb,我需要在继续之前和中断之后立即运行额外的命令。我想我应该像这样创建一个用户定义的命令:

define continue
pre_continue
continue
post_continue
end

这当然会在无底的递归坑中失败。有没有办法绕过用户定义的命令直接调用内置命令?

顺便说一句:我需要将命令命名为 continue,以便我使用的 gdb 前端能够调用我的用户定义函数。

最佳答案

User-defined Command Hooks是您正在寻找的:

You may define hooks, which are a special kind of user-defined command. Whenever you run the command foo', if the user-defined
command
hook-foo' exists, it is executed (with no arguments) before that command.

A hook may also be defined which is run after the command you executed. Whenever you run the command foo', if the user-defined
command
hookpost-foo' exists, it is executed (with no arguments) after that command. Post-execution hooks may exist simultaneously with pre-execution hooks, for the same command.

此解决方案应该适合您:

define hook-continue
pre_continue
end

define hookpost-continue
post_continue
end

关于gdb - 在 GDB 中,如何从用户定义的命令运行内置命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8311716/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com