Reputation:
I'm trying to debug a program with gdb
and when I set a breakpoint and continue on the strcpy()
function. 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
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!
Upvotes: 2
Views: 1557
Reputation: 213829
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
).
The best way to fix this is to tell GDB where to find this source. See (gdb) help directory
.
Of course for this to work, you actually need the GLIBC sources. I don't know whether Kali
packages sources into libc6-dbg:i386
or not, you may have to install a separate glibc-source
package.
Upvotes: 1