gdb 显示在启动过程中程序正常退出。在 WSL 中(Bash on Windows,Windows Linux 的子系统)
gdb shows During startup program exited normally. in WSL (Bash on Windows, Windows Subsystem for Linux)
我正在使用 WSL(Bash on Windows = Windows Linux 的子系统)。
我写了一个简单的代码,a.c
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hello\n");
return 0;
}
我编译了
$ gcc -g -o a.exe a.c
$
效果很好。
$ ./a.exe
Hello
$
并且,我尝试在 gdb 中执行 a.exe。但是,我得到了 "During startup program exited normally."
$ gdb ./a.exe
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.exe...done.
(gdb) r
Starting program: /home/softgear/a.exe
During startup program exited normally.
(gdb)
如何在 WSL 中使用 gdb?请帮助我。
看起来这已经被报告并修复了 WSL bug。
作为解决方法,您可以在调试前 set disable-randomization off
,请参阅 https://github.com/Microsoft/WSL/issues/2870#issuecomment-359664608。或者将 WSL 更新到最新版本。
我正在使用 WSL(Bash on Windows = Windows Linux 的子系统)。 我写了一个简单的代码,a.c
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hello\n");
return 0;
}
我编译了
$ gcc -g -o a.exe a.c
$
效果很好。
$ ./a.exe
Hello
$
并且,我尝试在 gdb 中执行 a.exe。但是,我得到了 "During startup program exited normally."
$ gdb ./a.exe
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.exe...done.
(gdb) r
Starting program: /home/softgear/a.exe
During startup program exited normally.
(gdb)
如何在 WSL 中使用 gdb?请帮助我。
看起来这已经被报告并修复了 WSL bug。
作为解决方法,您可以在调试前 set disable-randomization off
,请参阅 https://github.com/Microsoft/WSL/issues/2870#issuecomment-359664608。或者将 WSL 更新到最新版本。