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
Run Code Online (Sandbox Code Playgroud)
我写了一个简单的程序,它打印一个字符串并返回.我可以通过输入" ./a.out " 直接执行它.但是当我在gdb中运行它时,会发生上述错误.我尝试使用" -g "标志编译代码而不使用它.两次都给出了相同的结果.任何人都可以帮我解决这个问题吗?
那条消息,
warning: no loadable sections found in added symbol-file system-supplied
Run Code Online (Sandbox Code Playgroud)
所以在 0x7ffff7ffd000
是一个警告,不会阻止 GCC 运行a.out;至少,不应该。
这是说有一个动态加载的对象所使用的a.out缺少符号。与 a.out 本身无关。
您可以尝试将 a.out 构建为静态可执行文件;像这样:
gcc -static a.c
Run Code Online (Sandbox Code Playgroud)
显然,添加所需的任何其他编译器参数。
作为静态可执行文件,您不会从 GCC 收到该警告。这些符号可能仍然丢失,但不应影响程序的执行。