From f483155e078026395ef6bfbf4382aef642e57796 Mon Sep 17 00:00:00 2001 From: Nikolai Nosov Date: Sat, 2 May 2020 13:56:39 +0400 Subject: [PATCH] special handling of CFA pseudo register since libunwind provides wron value --- src/libpst.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libpst.c b/src/libpst.c index ef4e392..9451ffa 100644 --- a/src/libpst.c +++ b/src/libpst.c @@ -70,6 +70,12 @@ pst_function* pst_function_next(pst_handler* handler, pst_function* current) int pst_get_register(pst_function* fn, int regno, unw_word_t* val) { + if(regno == UNW_X86_64_CFA) { + // intentionally return our own CFA obtained using libdw since libunwind returns wrong register value + *val = fn->info.cfa; + return 0; + } + return unw_get_reg(&fn->context, regno, val); }