我正在尝试使用书中的教程来学习 gdb。
用 C写了最简单的helloworld,编译 GCC 没有额外的参数。
我跑,gdb -q ./a.out然后当我跑的时候
(gdb) b main
Breakpoint 1 at 0x113d
(gdb) run
Starting program: /run/media/source/a.out
exec: The term 'exec' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
During startup program exited with code 1.
这显然是一个错误,与 gdb 中的某些东西是在powershell而不是 bash 中启动的事实有关(我有一个默认的 shell - powershell,但它发生在 linux 上)。但是,从 bash 运行时,此错误完全相同。如何解决?
正如gdb文档中所见(松散的翻译):
然后。要正常工作,在启动 gdb 时,
SHELL必须将环境变量设置为稍微兼容 posix 的 shell。这可以通过运行这样的gdb东西来完成: