Change layout of Frame_Location

This commit is contained in:
gingerBill
2024-04-28 12:49:17 +01:00
parent 6c185a5dca
commit 0fa269811a
2 changed files with 14 additions and 10 deletions
+6 -6
View File
@@ -41,7 +41,7 @@ _frames :: proc(ctx: ^Context, skip: uint, allocator: runtime.Allocator) -> []Fr
}
_resolve :: proc(ctx: ^Context, frame: Frame, allocator: runtime.Allocator) -> (result: runtime.Source_Code_Location) {
_resolve :: proc(ctx: ^Context, frame: Frame, allocator: runtime.Allocator) -> (fl: Frame_Location) {
intrinsics.atomic_store(&ctx.in_resolve, true)
defer intrinsics.atomic_store(&ctx.in_resolve, false)
@@ -54,17 +54,17 @@ _resolve :: proc(ctx: ^Context, frame: Frame, allocator: runtime.Allocator) -> (
symbol.SizeOfStruct = size_of(symbol)
symbol.MaxNameLen = 255
if win32.SymFromAddrW(ctx.impl.hProcess, win32.DWORD64(frame), &{}, symbol) {
result.procedure, _ = win32.wstring_to_utf8(&symbol.Name[0], -1, allocator)
fl.procedure, _ = win32.wstring_to_utf8(&symbol.Name[0], -1, allocator)
} else {
result.procedure = fmt.aprintf("(procedure: 0x%x)", frame, allocator=allocator)
fl.procedure = fmt.aprintf("(procedure: 0x%x)", frame, allocator=allocator)
}
line: win32.IMAGEHLP_LINE64
line.SizeOfStruct = size_of(line)
if win32.SymGetLineFromAddrW64(ctx.impl.hProcess, win32.DWORD64(frame), &{}, &line) {
result.file_path, _ = win32.wstring_to_utf8(line.FileName, -1, allocator)
result.line = i32(line.LineNumber)
fl.file_path, _ = win32.wstring_to_utf8(line.FileName, -1, allocator)
fl.line = i32(line.LineNumber)
}
return result
return
}