Adjust pc for better line number reporting with StackWalk64

This commit is contained in:
Jeremy 2023-09-24 18:21:41 -04:00
parent 97de21e977
commit 59b5e80256
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4
2 changed files with 5 additions and 2 deletions

View File

@ -79,7 +79,7 @@ def output_matches(output: str, params: Tuple[str]):
output = [line.strip().split("||") for line in output.split("\n")]
max_line_diff = MAX_LINE_DIFF
if "CPPTRACE_UNWIND_WITH_UNWIND" in params:
if "CPPTRACE_UNWIND_WITH_UNWIND" in params or "CPPTRACE_UNWIND_WITH_DBGHELP" in params:
max_line_diff = 0
errored = False

View File

@ -112,7 +112,10 @@ namespace detail {
if(skip) {
skip--;
} else {
trace.push_back(frame.AddrPC.Offset);
// On x86/x64/arm, as far as I can tell, the frame return address is always one after the call
// So we just decrement to get the pc back inside the `call` / `bl`
// This is done with _Unwind too but conditionally based on info from _Unwind_GetIPInfo.
trace.push_back(frame.AddrPC.Offset - 1);
}
} else {
// base