在gdb会话中选择调试信息文件的子集 [英] select subset of debug info files in gdb session

查看:156
本文介绍了在gdb会话中选择调试信息文件的子集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b


sudo dnf debuginfo-install 在我的fedora盒子里,我安装了很多独立的调试信息。 <数据包列表>


现在,如果我调试了一些简单的代码,符号被显示或某些值被打印。很明显,绝对需要评估所有已安装的符号文件以获取所有信息。



但是,如果我遇到问题,请在像goocanvas这样的库上进行说明希望使用我自己编译的代码生成本地调试smbols,这些代码使用 -g 选项和 goocanvas库的调试信息。



如何实现这种选择?只有重命名调试信息文件的文件夹并生成所需的副本?也许作为符号链接?或者在任何地方都有一个共同的选择选项?

解决方案

您可以跳过共享库中的所有调试信息,并仅加载goocanvas lib符号。以下是如何在gdb会话中执行此操作的示例:

  [〜] $ gdb -q / your / binary 
(gdb)set auto-solib-add off
(gdb)start

main()中的临时断点1,0x000055555564edd0
(gdb)sharedlibrary goocanvas

来自 gdb doc


如果您的程序使用大量带有调试信息的共享库
占用大量内存,您可以通过防止自动从
共享库中加载符号来减少gdb内存
的占用空间。为此,在
之前输入set auto-solib-add off,然后加载你的
调试符号需要的共享库regexp,其中regexp是一个常规的
表达式匹配你想要成为
符号的图书馆。


另请参阅以下相关问题:


On my fedora box I have installed a lot of separate debug infos.

sudo dnf debuginfo-install <list of packets>

Now, if I debug some simple code it needs very long until some symbol is displayed or some values are printed. It is quite clear that is absolutly needed to evaluate all the installed symbol files to get all information.

But if I have a problem, say on a lib like goocanvas I only want to have my local debug smbols generated with my own compiled code with -g option and the only the debug infos for goocanvas libs.

How can that kind of selection be achieved? Only by renaming the folder of debug info files and generate a copy of needed ones? Maybe as a symlink? Or is there a common selection option anywhere?

解决方案

You can skip all debug info from shared libraries and only load goocanvas lib symbols. Here is a sample of how to do it in gdb session:

[ ~]$ gdb -q /your/binary
(gdb) set auto-solib-add off 
(gdb) start 

Temporary breakpoint 1, 0x000055555564edd0 in main ()
(gdb) sharedlibrary goocanvas

From gdb doc:

If your program uses lots of shared libraries with debug info that takes large amounts of memory, you can decrease the gdb memory footprint by preventing it from automatically loading the symbols from shared libraries. To that end, type set auto-solib-add off before running the inferior, then load each library whose debug symbols you do need with sharedlibrary regexp, where regexp is a regular expression that matches the libraries whose symbols you want to be loaded.

See also this related question: How to prevent GDB from loading debugging symbol for a (large) library?

这篇关于在gdb会话中选择调试信息文件的子集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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