../sysdeps/i386/i686/multiarch/strcpy.c:没有这样的文件或目录

问题描述 投票:1回答:1

我正在尝试使用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) 

我在Kali 2.0上安装了:libc6-dbglibc6-dbg:i386

如果它已经不明显,我想摆脱这个错误信息:

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

在此先感谢您的帮助!

c gcc gdb libc strcpy
1个回答
1
投票

我想摆脱这个错误消息:

这不是错误。 GDB告诉你,你已经停止了strcpy_ifunc函数(参见this description是什么IFUNCs),这是在../sysdeps/i386/i686/multiarch/strcpy.c源文件中定义的,并且GDB不知道如何在文件系统上找到该文件(因此不能向您展示strcpy_ifunc的来源)。

解决此问题的最佳方法是告诉GDB在哪里找到此源。见(gdb) help directory

当然,为了实现这一点,您实际上需要GLIBC来源。我不知道Kali是否将资源打包到libc6-dbg:i386,你可能需要安装一个单独的glibc-source软件包。

© www.soinside.com 2019 - 2024. All rights reserved.