GDB grep信息源文件 [英] GDB grep info sources files

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

问题描述

是否可以grep或过滤gdb中信息源的输出? 像这样:

Is it possible to grep or filter the output of info sources in gdb? Something like:

(gdb) info sources | grep bob.cpp

谢谢

推荐答案

是否可以grep或过滤gdb中信息源的输出?

Is it possible to grep or filter the output of info sources in gdb?

不.这可能被认为是一个错误:info shared使用可选的正则表达式来过滤共享库,但info sources则不是.

No. This could be considered a bug: info shared takes an optional regex to filter shared libraries, but info sources does not.

解决方法:

(gdb) set logging on  # GDB output will now be copied into gdb.txt
(gdb) info sources
(gdb) set logging off
(gdb) shell grep bob.cpp gdb.txt
(gdb) shell rm gdb.txt

如果您需要经常执行此操作,则可以将上述命令放入用户定义的命令.

If you need to do this often, you could put above commands into a user-defined command.

这篇关于GDB grep信息源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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