gpt4 book ai didi

debugging - 如何在 gdb 脚本中确认操作(答案 "Y")?

转载 作者:行者123 更新时间:2023-12-03 01:13:44 26 4
gpt4 key购买 nike

我使用 gdb 来调试我的 cpp 代码。我这样设置断点:

(gdb) break ParseDriver.cc:60
No source file named ParseDriver.cc.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (ParseDriver.cc:60) pending.

为了简化设置断点,我写了一个简单的gdb脚本(名为breakpoints.gdb),它只包含一行:

break ParseDriver.cc:60

我在 gdb 终端中获取此脚本,但失败了。

(gdb) source ~/breakpoints.gdb
No source file named ParseDriver.cc.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]

看来我们需要在脚本中回答Y才能设置断点。

那么,我如何在 gdb 脚本中回答 Y ?预先感谢您。

最佳答案

(gdb) set breakpoint pending on

这将使 gdb 跳过询问确认,引用自 the docs :

This indicates that an unrecognized breakpoint location should automatically result in a pending breakpoint being created.

关于debugging - 如何在 gdb 脚本中确认操作(答案 "Y")?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11356138/

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