First of all, I don't speak English very well. Please forgive me. I want to check the source code of musl in gdb. This is what i have done.
apt install musl-tools
git://git.musl-libc.org/musl ,i have put it into ~
set the path for gdb,below is what in my '/~/.gdbinit':
layout src
directory ~/musl/src
i create a c program:
#include <stdio.h>
int main(){
printf("hello\n");
return 0;
}
i compile it with 'musl-gcc -O1 -g3 -static test.c'
then i run it with gdb.But when i use 's' to try to step into the source code of printf,it just skip it.
i have tried to ask chatgpt,but still can't solve it. can anybody tell me why this happen and how can i sovle it.
Build musl with debug symbols:
$ (cd musl; configure --enable-debug; make)
Build you program against library with debug symbols:
$ musl-gcc -g3 -static -Lmusl/lib test.c
Kick back and enjoy the sweet success:
$ gdb ./a.out
(gdb) start
Temporary breakpoint 1 at 0x40113d: file test.c, line 4.
Starting program: /home/allan/a.out
Temporary breakpoint 1, main () at test.c:4
4 printf("hello\n");
(gdb) s
puts (s=0x402000 "hello") at src/stdio/puts.c:6
6 FLOCK(stdout);