8
abijith bufferOverFlow $ gdb a.out
GNU gdb (GDB) 7.6
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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/abijith/Project/Security/bufferOverFlow/a.out...done
(gdb) r
Starting program: /home/abijith/Projec2qt/Security/bufferOverFlow/a.out 
warning: no loadable sections found in added symbol-file system-supplied 
SO at 0x7ffff7ffd000

我写了一个简单的程序,它打印一个字符串并返回。我可以通过键入“ ./a.out ”直接执行它。但是当我在 gdb 中运行它时,就会发生上述错误。我尝试使用“ -g ”标志编译代码而不使用它。两次都给出了相同的结果。谁能帮我解决这个问题??

4

2 回答 2

3

那条讯息,

warning: no loadable sections found in added symbol-file system-supplied 

所以在 0x7ffff7ffd000

是一个不会阻止 GCC 运行的警告a.out;至少,它不应该。

据说有一个动态加载的对象a.out被缺少符号使用。与 a.out 本身无关。

您可以尝试将 a.out 构建为静态可执行文件;像这样:

gcc -static a.c

显然,添加所需的任何其他编译器参数。

作为静态可执行文件,您不会从 GCC 收到警告。这些符号可能仍然丢失,但不应影响程序的执行。

于 2013-08-31T20:16:46.537 回答
2

It appears this is a bug in glibc or gdb (depending on where you want to put the blame). It is apparently harmless - gdb will work fine.

It is caused by some magic the Linux kernel performs on binaries it runs. For details, see Debian bug report 738702 and the original gdb bug report 13097.

There is a patch to fix this, which Debian applied recently, so the problem no longer occurs with GDB 7.7.1 on Debian.

于 2014-10-05T12:40:46.437 回答