gpt4 book ai didi

c++ - LLDB 中 GDB 的 “define” 是什么?

转载 作者:行者123 更新时间:2023-11-28 05:32:06 28 4
gpt4 key购买 nike

我想定义一个同时运行 2 个命令的 LLDB 函数(例如,打印变量值并转到下一行)。使用 GDB 调试 C 代码我会这样做:

(gdb) def f
Type commands for definition of "f".
End with a line saying just "end".
>p i
>n
>end
(gdb) f

但是用 LLDB 做同样的尝试是行不通的:

(lldb) def f
error: 'def' is not a valid command.
error: Unrecognized command 'def'.

有办法吗?

最佳答案

来自 http://lldb.llvm.org/tutorial.html :

lldb also has a built-in Python interpreter, which is accessible by the "script" command. All the functionality of the debugger is available as classes in the Python interpreter, so the more complex commands that in gdb you would introduce with the "define" command can be done by writing Python functions using the lldb-Python library, then loading the scripts into your running session and accessing them with the "script" command.

关于c++ - LLDB 中 GDB 的 “define” 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39251084/

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