使用libtool e gdb [英] using libtool e gdb
问题描述
我正在开发一个使用GNU autotools的项目,因此为了使用gdb调试代码,我正在libtool中运行gdb:
libtool --mode=execute gdbtui foobar
是否可以重新加载项目的修改版本而不必退出gdb/libtool并重新启动呢?
libtool --mode=execute
创建一个临时可执行文件,该文件将传递给gdb.重建时将删除此可执行文件.诀窍是用类似的东西重新创建它
libtool --mode=execute echo ./hello
(Libtool将重新创建临时可执行文件,并将其名称传递给echo
命令.您可以使用任何其他命令代替echo
,例如true
来抑制输出,甚至禁止使用不存在的命令.)>
要重新加载可执行文件,请使用gdb file
filename
命令文件.可执行的真实名称在启动时由gdb显示:
$ libtool --mode=execute gdb --args ./hello
...
Reading symbols from /path/to/.libs/lt-hello...done.
(gdb)
它也由gdb显示 info inferiors
命令:
(gdb) info inferiors
Num Description Executable
* 1 <null> /path/to/.libs/lt-hello
,当然也可以通过上面的echo
命令.
I'm working on a project that uses GNU autotools, so in order to debug the code using gdb, I'm running gdb from within libtool:
libtool --mode=execute gdbtui foobar
Is it possible to reload a modified version of the project without the annoyance of having to quit gdb/libtool and restart?
libtool --mode=execute
creates a temporary executable which is passed to gdb. This executable is removed upon rebuild. The trick is to recreate it with something like
libtool --mode=execute echo ./hello
(Libtool will recreate the temporary executable and pass its name to echo
command. You can use any other command instead of echo
, e.g. true
to suppress output, or even non-existing one.)
To reload the executable use gdb file
filename
command file. Executable real name is displayed by gdb upon start:
$ libtool --mode=execute gdb --args ./hello
...
Reading symbols from /path/to/.libs/lt-hello...done.
(gdb)
It is also displayed by gdb info inferiors
command:
(gdb) info inferiors
Num Description Executable
* 1 <null> /path/to/.libs/lt-hello
and, of course, by the above echo
command.
这篇关于使用libtool e gdb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!