如何防止GDB加载(大型)库的调试符号? [英] How to prevent GDB from loading debugging symbol for a (large) library?

查看:468
本文介绍了如何防止GDB加载(大型)库的调试符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调试Qt 5应用程序时,我有时对Qt 5的内部没有兴趣,而是对应用程序本身的结构感兴趣。因此,我不需要加载Qt 5库的所有调试符号,因为这些需要几秒钟才能加载。



是否可以阻止GDB为这些加载符号Qt 5库,同时保留我的应用程序的调试符号?

解决方案


是否有可能阻止GDB从加载这些Qt 5库的符号,同时保留我的应用程序的调试符号?

是。



正如Richard Critten的评论所述,设置 auto-solib-add 0 将防止所有共享库,然后您可以使用 sharedlibrar y 命令(它接受一个正则表达式)。如果这个正则表达式被省略,那么所有的共享库都会被加载。然而,这会阻止自动加载所有的符号(不仅仅是调试符号),并且还可以防止系统库的符号自动加载,这通常需要解开堆栈。



更好的方法可能是保存Qt5的副本具有完整调试信息的库,例如〜/ Qt5-debug / ,然后在原始库上运行 strip -g 。这样,您将获得所有库的符号信息,并且在极少数情况下,当您真的需要Qt5的全面调试信息时,仍然可以使用GDB 文件〜/ Qt5-debug / libQt5Core .so.5.2 或类似命令。



来自GDB手册的GDB文件有更多关于使用这些独立调试符号的文档。


While debugging a Qt 5 application, I am sometimes not interested in the internals of Qt 5 but in the structure of the application itself. Therefore I do not need to load all debugging symbols of the Qt 5 libraries since these take a few seconds to load.

Is it possible to prevent GDB from loading symbols for these Qt 5 libraries while keeping the debugging symbols for my application?

解决方案

Is it possible to prevent GDB from loading symbols for these Qt 5 libraries while keeping the debugging symbols for my application?

Yes.

As Richard Critten's comment mentions, setting auto-solib-add to 0 will prevent loading of symbols for all shared libraries, and you can then add files manually with the sharedlibrary command (which accepts a regex). If this regex is omitted, then all shared libraries are loaded.

That however would prevent auto-loading of all symbols (not just debug symbols), and would also prevent auto-loading of symbols for system libraries, which are often required to unwind the stack.

A better approach may be to save a copy of Qt5 libraries with full debug info somewhere, e.g. ~/Qt5-debug/, then run strip -g on the original libraries. That way, you will get symbolic info for all libraries, and in the rare case when you actually need full-debug info for Qt5, you can still do that using the GDB file ~/Qt5-debug/libQt5Core.so.5.2 or similar commands.

The chapter GDB Files from the GDB manual has more documentation on using such separate debugging symbols.

这篇关于如何防止GDB加载(大型)库的调试符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆