GDB 打印到文件而不是标准输出 [英] GDB print to file instead of stdout

查看:35
本文介绍了GDB 打印到文件而不是标准输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 GDB 并想检查那些不幸的上帝对象之一.需要很多页(我有一个 24 英寸的显示器横过来!)才能看到整个事情.

I am running GDB and want to examine one of those unfortunate god objects. It takes many pages (and I have a 24" monitor turned sideways!) to see the whole thing.

为了便于使用,我希望 GDB 将对象打印到文件而不是屏幕,以便我可以在 vi 中打开它并轻松移动.

For ease of use, I'd like GDB to print the object to a file instead of the screen so that I can open it in vi and move around with ease.

凭借 GDB 的所有功能,一定有办法做到这一点,对吗?

With all of GDB's versatility, there must be a way to do this, right?

推荐答案

您需要启用日志记录:

(gdb) set logging on

现在 GDB 将登录到 ./gdb.txt.你可以告诉它使用哪个文件:

Now GDB will log to ./gdb.txt. You can tell it which file to use:

(gdb) set logging file my_god_object.log

您可以检查当前的日志配置:

And you can examine the current logging configuration:

(gdb) show logging

这篇关于GDB 打印到文件而不是标准输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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