【问题标题】:gdb shows During startup program exited normally. in WSL (Bash on Windows, Windows Subsystem for Linux)gdb 显示在启动过程中程序正常退出。在 WSL 中(Windows 上的 Bash,Linux 的 Windows 子系统)
【发布时间】:2018-07-18 20:16:19
【问题描述】:

我正在使用 WSL(Windows 上的 Bash = Linux 的 Windows 子系统)。 我写了一个简单的代码,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。但是,我得到“在启动过程中程序正常退出。”

$ 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?请帮帮我。

【问题讨论】:

    标签: gdb windows-subsystem-for-linux


    【解决方案1】:

    看起来这已经被报告并修复了WSL bug

    作为一种解决方法,您可以在调试之前set disable-randomization off,请参阅https://github.com/Microsoft/WSL/issues/2870#issuecomment-359664608。或者将 WSL 更新到最新版本。

    【讨论】:

    • 解决方法有效。 (我在 /etc/gdb/gdbinit 文件中添加了set disable-randomization off)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-05
    • 2019-07-03
    相关资源
    最近更新 更多