在gdb断点处运行命令,但c或cont都不起作用 [英] Run command at gdb breakpoint, neither c or cont works

查看:77
本文介绍了在gdb断点处运行命令,但c或cont都不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行一个在遇到断点时打印信息的命令:

I'm trying to run a command that prints information when a breakpoint is hit:

(gdb) break XXX
(gdb) command
> printf "xx=%p, yy=%d\n", p1, p2
> end

似乎可行,我看到很多输出.

It seems to work, I see lots of outputs.

但是突然它停止工作了,我看到一行说:

But suddenly it stopped working, and I saw a line says:

---Type <return> to continue, or q <return> to quit---

我错过了什么吗?我现在不需要在屏幕上看到任何东西,因为我已经启用了登录gdb的功能.

Am I missing something? I don't need to see anything on the screen now, 'cause I already enabled logging in gdb.

推荐答案

但是突然它停止工作了,我看到一行说:

But suddenly it stopped working, and I saw a line says:

在运行程序之前,尝试运行set pagination offset height unlimited.这是来自文档:

Try run set pagination off or set height unlimited before you run your program. This is from doc:

如果您指定的高度不受限制或为零,则GDB会 无论输出多长时间,输出期间都不会暂停.这是 如果输出是输出到文件还是编辑器缓冲区,则很有用. ...转弯 分页关闭是设置高度不受限制的替代方法.

If you specify a height of either unlimited or zero lines, GDB does not pause during output no matter how long the output is. This is useful if output is to a file or to an editor buffer. ... Turning pagination off is the alternative to set height unlimited.

参考文献:

这篇关于在gdb断点处运行命令,但c或cont都不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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