GDB - 如何找出程序退出的位置 [英] GDB - how to find out from where program exited

查看:131
本文介绍了GDB - 如何找出程序退出的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在GDB中调试程序时,出现意外的正常退出程序。所以我想知道是否有一种方法可以找出程序退出的位置(哪一行)。

While debugging a program in GDB, I get an unexpected "program exited normally". So I'm wondering if is there a way to find out from where (which line) the program exited.

程序是多线程的,如果这很重要的话。

Program is multi-threaded, if that matters.

推荐答案

通常在应用程序完成执行时使用以下命令:

Usually with the command below when the application has finished executing:

(gdb) thread apply all bt

当然,如果您想知道确切的行,您必须使用调试符号编译应用程序,即 - g

Of course, if you want to know the exact line you must compile your application with debugging symbols, i.e. -g

这篇关于GDB - 如何找出程序退出的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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