GDB回溯没有用户输入? [英] gdb backtrace with no user input?

查看:135
本文介绍了GDB回溯没有用户输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否有可能推出通过GDB的应用程序,在一个段错误回溯写入一个文件(看后),然后退出GDB完全不需要任何用户输入。

I'm wondering if it's possible to launch an application via GDB, on a SegFault write the backtrace to a file (to look at later), and then exit GDB all without any user input.

我正在从一个shell脚本在一个无限循环的启动操作系统从非交互式会话的应用程序(所以如果它崩溃,重新加载)。该应用程序在非重复的方式崩溃,所以我需要从崩溃回溯调试问题。理想情况下,我只是修改shell脚本包括gdb调试+回溯功能和preserve应用程序的崩溃之后自动重新启动。

I'm running an application from a shell script in an infinite loop (so if it crashes it reloads) on OS boot from a non-interactive session. The application is crashing in a non-reproducible way so I need a backtrace from the crash to debug the issue. Ideally, I'd just modify the shell script to include the GDB debugging + backtracing functionality and preserve the automatic restarting of the application following a crash.

这是可能的吗?

推荐答案

由于阿迪亚·库马尔;可接受的解决方案:

Thanks to Aditya Kumar; acceptable solution:

GDB -batch -ex运行-exBT$ {} my_program 2 - ;&放大器; 1 | grep的-v ^不叠。$

这篇关于GDB回溯没有用户输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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