From 4369a4f3ccdfa48618207850c83cb214a4648771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Thu, 12 Apr 2018 13:24:07 +0200 Subject: [PATCH] Handle cleanly the absence of RBP --- src/DwarfInterpret.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/DwarfInterpret.cpp b/src/DwarfInterpret.cpp index e58398c..9420064 100644 --- a/src/DwarfInterpret.cpp +++ b/src/DwarfInterpret.cpp @@ -205,13 +205,17 @@ DwarfInterpret::UnwindContext DwarfInterpret::unwind_context( // An undefined RA means we've reached the end of the call stack throw FirstUnwindFrame(); } - new_context.rbp = interpret_dw_register( - cur_row, - lib::DWARF_X86_64_RBP, - ctx); - if(new_context.rbp == 0) { - // A null rbp means we've reached the end of the call stack - throw FirstUnwindFrame(); + try { + new_context.rbp = interpret_dw_register( + cur_row, + lib::DWARF_X86_64_RBP, + ctx); + if(new_context.rbp == 0) { + // A null rbp means we've reached the end of the call stack + throw FirstUnwindFrame(); + } + } catch(const std::out_of_range& e) { + new_context.rbp = 0; // The base pointer does not exist } new_context.rsp = interpret_dw_register(