简体   繁体   English

../sysdeps/i386/i686/multiarch/strcpy.c: 没有那个文件或目录

[英]../sysdeps/i386/i686/multiarch/strcpy.c: No such file or directory

I'm trying to debug a program with gdb and when I set a breakpoint and continue on the strcpy() function.我正在尝试使用gdb调试程序,当我设置断点并继续执行strcpy()函数时。 I get the following response:我收到以下回复:

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) 

I'm on Kali 2.0 and I've installed: libc6-dbg and libc6-dbg:i386我在 Kali 2.0 上,我已经安装了: libc6-dbglibc6-dbg:i386

If it isn't obvious already, I want to get rid of this error message:如果它不是很明显,我想摆脱这个错误信息:

../sysdeps/i386/i686/multiarch/strcpy.c: No such file or directory

Thanks in advance for any help!在此先感谢您的帮助!

I want to get rid of this error message:我想摆脱这个错误信息:

This isn't an error.这不是错误。 GDB is telling you that you've stopped in strcpy_ifunc function (see this description of what IFUNC s are), which is defined in ../sysdeps/i386/i686/multiarch/strcpy.c source file, and that GDB doesn't know how to find that file on the filesystem (and thus can't show you the source of strcpy_ifunc ). GDB 告诉你你已经在strcpy_ifunc函数中停止了(参见这个关于IFUNC是什么的描述),它在../sysdeps/i386/i686/multiarch/strcpy.c源文件中定义,而 GDB 没有知道如何在文件系统上找到该文件(因此无法向您显示strcpy_ifunc的来源)。

The best way to fix this is to tell GDB where to find this source.解决这个问题的最好方法是告诉 GDB 在哪里可以找到这个源。 See (gdb) help directory .参见(gdb) help directory

Of course for this to work, you actually need the GLIBC sources.当然,要使其正常工作,您实际上需要 GLIBC 源。 I don't know whether Kali packages sources into libc6-dbg:i386 or not, you may have to install a separate glibc-source package.我不知道Kali是否将源代码打包到libc6-dbg:i386 ,您可能需要安装一个单独的glibc-source包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM