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

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

问题描述

list 命令打印一组行,但我需要一行,我在哪里以及可能发生错误的位置.

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天全站免登陆