Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openbsd backtrace api addition #2527

Merged
merged 1 commit into from Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions libc-test/build.rs
Expand Up @@ -393,6 +393,7 @@ fn test_openbsd(target: &str) {
headers! { cfg:
"elf.h",
"errno.h",
"execinfo.h",
"fcntl.h",
"limits.h",
"link.h",
Expand Down
4 changes: 4 additions & 0 deletions libc-test/semver/openbsd.txt
Expand Up @@ -913,6 +913,10 @@ arc4random_buf
arc4random_uniform
arphdr
atof
backtrace
backtrace_symbols
backtrace_symbols_fd
backtrace_symbols_fmt
bsearch
caddr_t
calloc_conceal
Expand Down
16 changes: 16 additions & 0 deletions src/unix/bsd/netbsdlike/openbsd/mod.rs
Expand Up @@ -1606,6 +1606,22 @@ extern "C" {
pub fn calloc_conceal(nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
}

#[link(name = "execinfo")]
extern "C" {
pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
pub fn backtrace_symbols_fd(
addrlist: *const *mut ::c_void,
len: ::size_t,
fd: ::c_int,
) -> ::c_int;
pub fn backtrace_symbols_fmt(
addrlist: *const *mut ::c_void,
len: ::size_t,
fmt: *const ::c_char,
) -> *mut *mut ::c_char;
}

cfg_if! {
if #[cfg(libc_union)] {
extern {
Expand Down