gdb:如何打印当前行或找到当前行号? [英] gdb: how to print the current line or find the current line number?

查看:182
本文介绍了gdb:如何打印当前行或找到当前行号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

列表命令打印一组行,但我需要一行,我在哪里,可能发生错误。

list commands prints a set of lines, but I need one single line, where I am and where an error has probably occurred.

推荐答案

我在调试时得到相同的信息。虽然我正在检查堆栈跟踪。很可能你会使用我认为的优化标志。检查此链接 - 有关的东西

I do get the same information while debugging. Though not while I am checking the stacktrace. Most probably you would have used the optimization flag I think. Check this link - something related.

尝试使用 -g3 编译,删除任何优化标志。
那么它可能会工作。
HTH!

Try compiling with -g3 remove any optimization flag. Then it might work. HTH!

这篇关于gdb:如何打印当前行或找到当前行号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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