我正在使用Python通过批处理命令控制GDB.这是我如何调用GDB:
$ gdb --batch --command=cmd.gdb myprogram
Run Code Online (Sandbox Code Playgroud)
该cmd.gdb列表只包含调用Python脚本的行
source cmd.py
Run Code Online (Sandbox Code Playgroud)
并且cmd.py脚本尝试创建断点和附加命令列表
bp = gdb.Breakpoint("myFunc()") # break at function in myprogram
gdb.execute("commands " + str(bp.number))
# then what? I'd like to at least execute a "continue" on reaching breakpoint...
gdb.execute("run")
Run Code Online (Sandbox Code Playgroud)
问题是我不知道如何将任何GDB命令附加到Python脚本的断点.有没有办法做到这一点,或者我错过了一些更容易和更明显的自动执行断点特定命令的工具?
在 Ubuntu 上运行 GDB 7.4-2012.02 并且遇到我无法在其他平台上复制的奇怪行为。
bash$ export LD_LIBRARY_PATH=my_path
bash$ export LD_LIBRARY_PATH2=my_path2
bash$ gdb
GNU gdb (Ubuntu/Linaro 7.4-2012.02-0ubuntu2) 7.4-2012.02
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>.
(gdb) shell …Run Code Online (Sandbox Code Playgroud)