有没有办法在OpenBSD上以编程方式显示调用堆栈?

时间:2017-08-02 09:40:41

标签: c backtrace openbsd

Linux具有backtrace()功能,这是一个GNU扩展。

FreeBSD自版本10.0开始引入backtrace()函数,自7.0版开始引入NetBSD。

有没有办法在OpenBSD上实现这个目标?

2 个答案:

答案 0 :(得分:2)

不确定它何时首次出现,但 是OpenBSD 6.1的libexecinfo,它实现了backtrace()backtrace_symbols()函数:

{openbsd-amd64 ~}$ pkg_info libexecinfo
Information for inst:libexecinfo-0.3v0

Comment:
clone of backtrace facility found in the GNU libc

Description:
This is a quick-n-dirty BSD licensed clone of backtrace facility found
in the GNU libc, mainly intended for porting linuxish code to BSD
platforms, however it can be used at any platform which has a gcc
compiler.

Maintainer: The OpenBSD ports mailing-list <ports@openbsd.org>

WWW: https://github.com/conformal/backtrace/wiki

答案 1 :(得分:1)

在OpenBSD上,您可以使用this implementation