mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
freebsd: backtrace
This commit is contained in:
parent
30042ab54b
commit
837af9b230
@ -99,6 +99,12 @@ pub fn eprintln(s string) {
|
|||||||
C.fflush(stderr)
|
C.fflush(stderr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
$if freebsd {
|
||||||
|
C.fprintf(stderr, '%.*s\n', s.len, s.str)
|
||||||
|
C.fflush(stderr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// TODO issues with stderr and cross compiling for Linux
|
// TODO issues with stderr and cross compiling for Linux
|
||||||
println(s)
|
println(s)
|
||||||
}
|
}
|
||||||
@ -171,4 +177,3 @@ pub fn is_atty(fd int) int {
|
|||||||
return C.isatty(fd)
|
return C.isatty(fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ fn print_backtrace_skipping_top_frames_nix(xskipframes int) bool {
|
|||||||
skipframes := xskipframes + 2
|
skipframes := xskipframes + 2
|
||||||
$if mac { return print_backtrace_skipping_top_frames_mac(skipframes) }
|
$if mac { return print_backtrace_skipping_top_frames_mac(skipframes) }
|
||||||
$if linux { return print_backtrace_skipping_top_frames_linux(skipframes) }
|
$if linux { return print_backtrace_skipping_top_frames_linux(skipframes) }
|
||||||
|
$if freebsd { return print_backtrace_skipping_top_frames_freebsd(skipframes) }
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,6 +33,15 @@ fn print_backtrace_skipping_top_frames_mac(skipframes int) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn print_backtrace_skipping_top_frames_freebsd(skipframes int) bool {
|
||||||
|
$if freebsd {
|
||||||
|
buffer := [100]byteptr
|
||||||
|
nr_ptrs := C.backtrace(*voidptr(buffer), 100)
|
||||||
|
C.backtrace_symbols_fd(*voidptr(&buffer[skipframes]), nr_ptrs-skipframes, 1)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
|
fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
|
||||||
$if tinyc {
|
$if tinyc {
|
||||||
println('TODO: print_backtrace_skipping_top_frames_linux $skipframes with tcc fails tests with "stack smashing detected" .')
|
println('TODO: print_backtrace_skipping_top_frames_linux $skipframes with tcc fails tests with "stack smashing detected" .')
|
||||||
|
@ -309,6 +309,7 @@ fn platform_postfix_to_ifdefguard(name string) string {
|
|||||||
'_nix.v' { '#ifndef _WIN32' }
|
'_nix.v' { '#ifndef _WIN32' }
|
||||||
'_lin.v', '_linux.v' { '#ifdef __linux__' }
|
'_lin.v', '_linux.v' { '#ifdef __linux__' }
|
||||||
'_mac.v', '_darwin.v' { '#ifdef __APPLE__' }
|
'_mac.v', '_darwin.v' { '#ifdef __APPLE__' }
|
||||||
|
'_bsd.v', '_freebsd.v '{ '#ifdef __FreeBSD__'}
|
||||||
'_solaris.v' { '#ifdef __sun' }
|
'_solaris.v' { '#ifdef __sun' }
|
||||||
'_haiku.v' { '#ifdef __haiku__' }
|
'_haiku.v' { '#ifdef __haiku__' }
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user