如何使用gdb在.exe文件中查找分段错误 [英] How do I use gdb to find Segmentation Faults in a .exe file

查看:98
本文介绍了如何使用gdb在.exe文件中查找分段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在可执行文件使用的c文件中查找分段错误,但没有找到任何线索.有人知道该怎么做吗?

I'm trying to find the segmentation fault in a c file that is used by an executable but I haven't found any leads. Does anyone know how to do this?

推荐答案

运行gdb并从gdb运行程序,然后使用backtrace.您将获得堆栈框架,您可以通过fram命令遍历该框架,并使用print检查变量的值.通过互联网查看gdb tips \ docs.您可以使用gdb加载由崩溃程序生成的已经存在的核心文件,以查找发生问题的位置.加载的核心文件等于崩溃点的状态,您只需使用backtrace.

Run gdb and run your program from gdb, then use backtrace. you 'll get stack frame, which you can walk through by fram command and use print to check variables' values. Check gdb tips\docs over internet. You can use gdb to load already existing core file, generated by crashed program, to find spot where problem occured. Loaded core file is equal to state at crash point, you just usebacktrace.

关于您的问题的答案在这里:确定导致分段错误的C代码行?

Answer on your question was here: Determine the line of C code that causes a segmentation fault?

这篇关于如何使用gdb在.exe文件中查找分段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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