我试图用gdb调试一个程序,当我设置一个断点并继续使用strcpy()函数时。我得到以下答复:
frinto@kali:~/Documents/theclang/programs/helloworld$ gcc -fno-builtin -m32 -g -o char_array char_array.c
frinto@kali:~/Documents/theclang/programs/helloworld$ ls
a.out char_array char_array.c firstprog.c helloworld.c
frinto@kali:~/Documents/theclang/programs/helloworld$ ./char_array
Hello, world!
frinto@kali:~/Documents/theclang/programs/helloworld$ gdb -q char_array
Reading symbols from char_array...done.
(gdb) list
1 #include <stdio.h>
2 #include <string.h>
3
4 int main() {
5 char str_a[20];
6
7 strcpy(str_a, "Hello, world!\n");
8 printf(str_a);
9 }
(gdb) break 6
Breakpoint 1 at 0x11c6: file char_array.c, line 6.
(gdb) break strcpy
Breakpoint 2 at 0x1040
(gdb) break 8
Breakpoint 3 at 0x11dc: file char_array.c, line 8.
(gdb) run
Starting program: /home/frinto/Documents/theclang/programs/helloworld/char_array
Breakpoint 1, main () at char_array.c:7
7 strcpy(str_a, "Hello, world!\n");
(gdb) cont
Continuing.
Breakpoint 2, strcpy_ifunc () at ../sysdeps/i386/i686/multiarch/strcpy.c:29
29 ../sysdeps/i386/i686/multiarch/strcpy.c: No such file or directory.
(gdb) 我在Kali2.0上,我安装了:libc6-dbg和libc6-dbg:i386
如果这还不明显,我想去掉以下错误信息:
../sysdeps/i386/i686/multiarch/strcpy.c: No such file or directory提前感谢您的帮助!
发布于 2019-01-21 17:17:34
我想消除这条错误信息:
这不是一个错误。GDB告诉您,您已经停止使用strcpy_ifunc函数(请参阅这一描述 of IFUNCs ),它是在../sysdeps/i386/i686/multiarch/strcpy.c源文件中定义的,并且GDB不知道如何在文件系统中找到该文件(因此无法向您显示strcpy_ifunc的源)。
解决这个问题的最好方法是告诉GDB在哪里找到这个源。见(gdb) help directory。
当然,要做到这一点,您实际上需要GLIBC源代码。我不知道Kali包是否包含到libc6-dbg:i386中,您可能需要安装一个单独的glibc-source包。
https://stackoverflow.com/questions/54282586
复制相似问题