在MSYS上为GDBSERVER下的程序提供论点

Supply arguments to program under gdbserver on MSYS

本文关键字:程序 MSYS 上为 GDBSERVER      更新时间:2023-10-16

我需要异步调试程序,因为它停滞不前, ctrl c 杀死了 gdb,而不是中断程序(而不是中断程序(这在mingw/msys上)。

有人暗示gdb在异步模式下无法在Windows上使用,实际上它没有(使用Asynchronous execution not supported on this target.消息),但是gdbserver会。

所以我尝试:

$ gdbserver localhost:60000 ./a_.exe 0
Process ./a_.exe created; pid = 53644
Listening on port 60000

(根据Manpage所说的方式提供0作为参数。)

然后在另一个终端中:

$ gdb ./a_.exe
(gdb) target remote localhost:60000
Remote debugging using localhost:60000
0x76fa878f in ntdll!DbgBreakPoint () from C:Windowssystem32ntdll.dll
(gdb) continue
Continuing.
[Inferior 1 (Remote target) exited with code 01]

现在原始看起来像:

$ gdbserver localhost:60000 ./a_.exe 0
Process ./a_.exe created; pid = 53484
Listening on port 60000
Remote debugging from host 127.0.0.1
Expecting 1 argument: test case number to run.
Child exited with status 1
GDBserver exiting

也就是说,我的程序认为它没有参数。

manpage是错误的吗?

是!"误导"是一个更合适的术语。(至少适用于此平台上此版本的gdbserver,误导了。)

第一个参数实际上是给出下等方的第一个参数(argv)。通常这是可执行文件的名称。因此,以下工作有效:

$ gdbserver localhost:60000 ./a_.exe whatever 0

也就是说,曼页应该说,要保持一致:

target> gdbserver host:2345 emacs emacs foo.txt

我无法帮助您使用GDBSERVER,
但是,如果您只是在寻找一种中断在mingw/msys gdb
中运行的程序(类似于 ctrl c linux上的c
看看Debugbreak