我只是想知道是否可以直接从gdb修改源代码(例如,使用gdb -tui)?
谢谢, 偷了
答案 0 :(得分:1)
以gdb -tui为例
否,edit
是源代码的只读视图。但是您可以使用$ EDITOR=vim gdb -q a.out
Reading symbols from a.out...done.
(gdb)
...
...
...
(gdb) edit
命令来启动您喜欢的编辑器并编辑源代码:
(gdb) help edit
Edit specified file or function.
With no argument, edits file containing most recent line listed.
Editing targets can be specified in these ways:
FILE:LINENUM, to edit at that line in that file,
FUNCTION, to edit at the beginning of that function,
FILE:FUNCTION, to distinguish among like-named static functions.
*ADDRESS, to edit at the line containing that address.
Uses EDITOR environment variable contents as editor (or ex as default).
另请参阅内置帮助:
{{1}}