msvc: add a workaround to fix backtrace (#4200)
parent
40fd924b15
commit
8c050eff07
|
@ -84,12 +84,14 @@ $if msvc {
|
||||||
frames := int( C.CaptureStackBackTrace(skipframes + 1, 100, backtraces, 0) )
|
frames := int( C.CaptureStackBackTrace(skipframes + 1, 100, backtraces, 0) )
|
||||||
for i:=0; i < frames; i++ {
|
for i:=0; i < frames; i++ {
|
||||||
// fugly pointer arithmetics follows ...
|
// fugly pointer arithmetics follows ...
|
||||||
s := voidptr( u64(backtraces) + u64(i*sizeof(voidptr)) )
|
// FIXME Remove temp variable
|
||||||
symfa_ok := C.SymFromAddr( handle, s, &offset, si )
|
tmp := u64(backtraces) + u64(i * sizeof(voidptr))
|
||||||
|
s := &voidptr(tmp)
|
||||||
|
symfa_ok := C.SymFromAddr( handle, *s, &offset, si )
|
||||||
if symfa_ok == 1 {
|
if symfa_ok == 1 {
|
||||||
nframe := frames - i - 1
|
nframe := frames - i - 1
|
||||||
mut lineinfo := ''
|
mut lineinfo := ''
|
||||||
symglfa_ok := C.SymGetLineFromAddr64(handle, s, &offset, &sline64)
|
symglfa_ok := C.SymGetLineFromAddr64(handle, *s, &offset, &sline64)
|
||||||
if symglfa_ok == 1 {
|
if symglfa_ok == 1 {
|
||||||
lineinfo = ' ${sline64.f_file_name}:${sline64.f_line_number}'
|
lineinfo = ' ${sline64.f_file_name}:${sline64.f_line_number}'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue