Skip to content

Commit 282257f

Browse files
committed
Auto merge of #2288 - devnexen:fbsd_backtrace, r=Amanieu
freebsd/dragonflybsd introduces backtrace api for debugging
2 parents 6568dac + 159368a commit 282257f

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,7 @@ fn test_freebsd(target: &str) {
17151715
"dlfcn.h",
17161716
"elf.h",
17171717
"errno.h",
1718+
"execinfo.h",
17181719
"fcntl.h",
17191720
"glob.h",
17201721
"grp.h",

libc-test/semver/dragonfly.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,9 @@ arc4random_buf
11541154
arc4random_uniform
11551155
arphdr
11561156
atof
1157+
backtrace
1158+
backtrace_symbols
1159+
backtrace_symbols_fd
11571160
bpf_dltlist
11581161
bpf_hdr
11591162
bpf_insn

libc-test/semver/freebsd.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,9 @@ arc4random_buf
13401340
arc4random_uniform
13411341
arphdr
13421342
atof
1343+
backtrace
1344+
backtrace_symbols
1345+
backtrace_symbols_fd
13431346
bpf_dltlist
13441347
bpf_hdr
13451348
bpf_insn

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,6 +1682,17 @@ extern "C" {
16821682
pub fn login_tty(fd: ::c_int) -> ::c_int;
16831683
}
16841684

1685+
#[link(name = "execinfo")]
1686+
extern "C" {
1687+
pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
1688+
pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
1689+
pub fn backtrace_symbols_fd(
1690+
addrlist: *const *mut ::c_void,
1691+
len: ::size_t,
1692+
fd: ::c_int,
1693+
) -> ::c_int;
1694+
}
1695+
16851696
cfg_if! {
16861697
if #[cfg(target_os = "freebsd")] {
16871698
mod freebsd;

0 commit comments

Comments
 (0)