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:
Build you program against library with debug symbols:
Enjoy the sweet success: