简体   繁体   English

如何在标准库C / C ++函数中进行gdb步入操作?

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

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. 当我使用gdb进行代码搜索时,我可以通过step-into移动到我定义的任何函数内部。 But when I try to do it for standard C function (eg printf() ) I see only binary form of source code. 但是当我尝试为标准C函数(例如printf())时,我只看到二进制形式的源代码。

How can I ask gdb to show human-readable source code? 如何让gdb显示人类可读的源代码? I am very interested in the work of standard functions.Thank you! 我对标准函数的工作很感兴趣。谢谢!

You have to: 你必须:

  • Install the debug versions of the standard C and C++ libraries 安装标准C和C ++库的调试版本
  • 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. 如果您使用的是Linux并且使用GCC作为编译器,那么您可以查看有关如何执行上述第二个项目符号的帖子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM