您可以修改gdb的源代码吗?

时间:2018-08-22 19:52:19

标签: gdb

我只是想知道是否可以直接从gdb修改源代码(例如,使用gdb -tui)?

谢谢, 偷了

1 个答案:

答案 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}}