1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

msvc: add a workaround to fix backtrace (#4200)

This commit is contained in:
Alexey 2020-04-02 18:11:12 +03:00 committed by GitHub
parent 40fd924b15
commit 8c050eff07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,12 +84,14 @@ $if msvc {
frames := int( C.CaptureStackBackTrace(skipframes + 1, 100, backtraces, 0) )
for i:=0; i < frames; i++ {
// fugly pointer arithmetics follows ...
s := voidptr( u64(backtraces) + u64(i*sizeof(voidptr)) )
symfa_ok := C.SymFromAddr( handle, s, &offset, si )
// FIXME Remove temp variable
tmp := u64(backtraces) + u64(i * sizeof(voidptr))
s := &voidptr(tmp)
symfa_ok := C.SymFromAddr( handle, *s, &offset, si )
if symfa_ok == 1 {
nframe := frames - i - 1
mut lineinfo := ''
symglfa_ok := C.SymGetLineFromAddr64(handle, s, &offset, &sline64)
symglfa_ok := C.SymGetLineFromAddr64(handle, *s, &offset, &sline64)
if symglfa_ok == 1 {
lineinfo = ' ${sline64.f_file_name}:${sline64.f_line_number}'
}