Gdb ../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:没有这样的文件或目录

Gdb ../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:没有这样的文件或目录,gdb,Gdb,我是新来的程序世界。我正在使用Dev cpp 5.6.1学习C 我的调试器(GNUGDB(gdb)7.6.1)有问题。当我调试任何程序时,调试器都会警告我 单步执行,直到退出主功能, 它没有行号信息 及 __mingw_CRT启动() 地址../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:260 260../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:没有这样的文件或目录 这个问题以前

我是新来的程序世界。我正在使用Dev cpp 5.6.1学习C 我的调试器(GNUGDB(gdb)7.6.1)有问题。当我调试任何程序时,调试器都会警告我

单步执行,直到退出主功能, 它没有行号信息

__mingw_CRT启动() 地址../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:260 260../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:没有这样的文件或目录

这个问题以前发生过。我通过重新安装Dev Cpp(也重置旧配置)解决了这个问题。但过了一会儿,问题又出现了

示例代码:

#include <stdio.h>

int main(void)
{
    int a, b;
    printf("Please give me number 1: ");
    scanf("%d", &a);
    printf("Please give me number 2: ");
    scanf("%d", &b);
    printf("Sum = %d", a + b);
}
#包括
内部主(空)
{
INTA,b;
printf(“请给我1号:”);
scanf(“%d”和“&a”);
printf(“请给我2号:”);
scanf(“%d”和“b”);
printf(“总和=%d”,a+b);
}
调试器警告我:

C:\Users\Nam\Dropbox\code>gdb sum.exe
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 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 "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\Users\Nam\Dropbox\code\sum.exe...done.
(gdb) b main
Breakpoint 1 at 0x4016b3
(gdb) n
The program is not being run.
(gdb) r
Starting program: C:\Users\Nam\Dropbox\code/sum.exe
[New Thread 7148.0x1b6c]

Breakpoint 1, 0x004016b3 in main ()
(gdb) n
Single stepping until exit from function main,
which has no line number information.
Please give me number 1: 3
Please give me number 2: 4
Sum = 7__mingw_CRTStartup ()
    at ../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:260
260     ../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c: No such file or di
rectory.
(gdb)
C:\Users\Nam\Dropbox\code>gdb sum.exe
GNU gdb(gdb)7.6.1
版权所有(C)2013免费软件基金会。
许可证GPLv3+:GNU GPL版本3或更高版本
这是自由软件:您可以自由更改和重新发布它。
在法律允许的范围内,不存在任何担保。键入“显示复制”
和“显示保修”了解详细信息。
此GDB配置为“mingw32”。
有关错误报告说明,请参阅:
...
从C:\Users\Nam\Dropbox\code\sum.exe读取符号…完成。
(gdb)b干管
0x4016b3处的断点1
(gdb)n
程序没有运行。
(gdb)r
启动程序:C:\Users\Nam\Dropbox\code/sum.exe
[新螺纹7148.0x1b6c]
主()中的断点1,0x004016b3
(gdb)n
单步执行,直到退出主功能,
它没有行号信息。
请给我号码1:3
请给我号码2:4
总和=7_uuuumingw_ucrt启动()
地址../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:260
260../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:没有这样的文件或di
教区长。
(gdb)
我不知道怎么修理它

任何人都可以帮我:)提前谢谢

我不知道怎么修理它

我认为没有必要修复它。您收到了此消息,因为您已经从
main()
返回,现在您不在您的代码中,是mingw代码调用了您的
main()
。我做了与您相同的测试,这是完成main后的回溯:

10          printf("Sum = %d", a + b);
(gdb)
Sum = 311       }
(gdb) bt
#0  main () at t.c:11
(gdb) n
__mingw_CRTStartup () at ../mingw/crt1.c:250
250     ../mingw/crt1.c: No such file or directory.
(gdb) bt
#0  __mingw_CRTStartup () at ../mingw/crt1.c:250
#1  0x00401284 in mainCRTStartup () at ../mingw/crt1.c:264
(gdb) n
252     in ../mingw/crt1.c
(gdb) n
[Inferior 1 (process 1448) exited normally]
(gdb)
同样,您不必调试mingw启动代码。只需给gdb命令“continue”,它就可以完成您的进程的执行

我在这里找到了这个uu mingw_CRTStartup的来源。您可以看看从main返回后,mingw库执行的步骤:

static void __attribute__((noreturn))
__mingw_CRTStartup (void)
{
int nRet;

 /* skipped some lines ... */

 nRet = main (_argc, _argv, environ);
/*
* Perform exit processing for the C library. This means
* flushing output and calling 'atexit' registered functions.
*/
_cexit ();
ExitProcess (nRet);
}
一些有用的链接:

(一)