Skip to content

Commit d4ac6fd

Browse files
committed
Auto merge of #2527 - devnexen:obsd_execinfo, r=JohnTitor
openbsd backtrace api addition
2 parents c781f0b + 2676fd3 commit d4ac6fd

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

libc-test/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ fn test_openbsd(target: &str) {
393393
headers! { cfg:
394394
"elf.h",
395395
"errno.h",
396+
"execinfo.h",
396397
"fcntl.h",
397398
"limits.h",
398399
"link.h",

libc-test/semver/openbsd.txt

+4
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,10 @@ arc4random_buf
913913
arc4random_uniform
914914
arphdr
915915
atof
916+
backtrace
917+
backtrace_symbols
918+
backtrace_symbols_fd
919+
backtrace_symbols_fmt
916920
bsearch
917921
caddr_t
918922
calloc_conceal

src/unix/bsd/netbsdlike/openbsd/mod.rs

+16
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,22 @@ extern "C" {
16061606
pub fn calloc_conceal(nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
16071607
}
16081608

1609+
#[link(name = "execinfo")]
1610+
extern "C" {
1611+
pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
1612+
pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
1613+
pub fn backtrace_symbols_fd(
1614+
addrlist: *const *mut ::c_void,
1615+
len: ::size_t,
1616+
fd: ::c_int,
1617+
) -> ::c_int;
1618+
pub fn backtrace_symbols_fmt(
1619+
addrlist: *const *mut ::c_void,
1620+
len: ::size_t,
1621+
fmt: *const ::c_char,
1622+
) -> *mut *mut ::c_char;
1623+
}
1624+
16091625
cfg_if! {
16101626
if #[cfg(libc_union)] {
16111627
extern {

0 commit comments

Comments
 (0)