Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make gdb step-into operation in standard library C/C++ function?

Tags:

c++

c

gdb

Recently I have faced an interesting problem. When I use gdb for code search, I can move inside any function which I defined, by step-into. But when I try to do it for standard C function (e.g printf() ) I see only binary form of source code.

How can I ask gdb to show human-readable source code? I am very interested in the work of standard functions.Thank you!

like image 220
theoreticalboypf94 Avatar asked Oct 27 '25 00:10

theoreticalboypf94


1 Answers

You have to:

  • Install the debug versions of the standard C and C++ libraries
  • Tell the compiler to link against those versions

If you are on Linux and have GCC as your compiler, you can look up this post about how to do the second bullet above.

like image 52
P.W Avatar answered Oct 28 '25 13:10

P.W