有没有在C中调用堆栈转储的功能? [英] Is there a function to invoke a stack dump in C?

查看:150
本文介绍了有没有在C中调用堆栈转储的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以提供一个被调用以转储当前堆栈的C函数的实现?这是一个x86 linux系统。它可以通过两种方式调用:显式地由另一个函数,或崩溃后(可能作为一个陷阱/ int处理程序)。输出可以是屏幕还是文件,如参数(句柄)所示。一个明确的解释/评论堆栈如何解开显然是非常有帮助的。谢谢。

解决方案

backtrace()函数的文档位于 GNU LIBC手册


Can someone please provide an implementation of a C function that gets invoked to dump the current stack? It's for a x86 linux system. It can be invoked in 2 ways: explicitly by another function, or after a crash (probably as a trap/int handler). The output can be either to the screen or to a file, as indicated by a parameter (handle). A clear explanation/comments of how the stack is unwound would obviously be very helpful. Thank you.

解决方案

The documentation for the backtrace() function is in the GNU LIBC MANUAL.

这篇关于有没有在C中调用堆栈转储的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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