在GDB中搜索源目录 [英] searching for source directories in GDB

查看:110
本文介绍了在GDB中搜索源目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何告诉* nix中的GDB递归地在单个目录中搜索源文件?例如:

How do I tell GDB in *nix to search for source files inside a single directory recursively? For example:

  • 如果一个模块中有一些不同的构建基块.
  • a是b,c,d的父目录,其中b,c,d是子目录.
  • 源文件分布在b,c,b中.

我需要向GDB指定所有源文件都位于"a"(父目录)中,GDB应将其用作参考,并在调试程序时递归搜索源文件.

I would need to specify to GDB that all the source files are located in 'a'(parent directory) which GDB should use as a reference and search for source files recursively while debugging a program.

推荐答案

或者您可以执行以下操作,调试源代码位于目录 srcdir 中的程序 prog :

Or you can do something like this, for debugging program prog with source in directory srcdir:

gdb `find srcdir -type d -printf '-d %p '` prog

我认为这是对您问题的更直接答案.如果您的可执行文件不包含编译目录和/或您没有gdb 6.6+版本,则也很有用.

I think it's a more direct answer to your question. Also useful if your executable doesn't contain the compilation directories and/or you don't have version 6.6+ of gdb.

这篇关于在GDB中搜索源目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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