This revision was automatically updated to reflect the committed changes.
Closed by commit rG701030c3ecba: In InitializeZerothFrame check for a CFA/AFA
or error out (authored by jasonmolenda).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143232/new/
https://reviews.llvm.org/D143232
Files:
lldb/source/Target/RegisterContextUnwind.cpp
Index: lldb/source/Target/RegisterContextUnwind.cpp
===================================================================
--- lldb/source/Target/RegisterContextUnwind.cpp
+++ lldb/source/Target/RegisterContextUnwind.cpp
@@ -37,6 +37,8 @@
#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/VASPrintf.h"
#include "lldb/lldb-private.h"
+
+#include <cassert>
#include <memory>
using namespace lldb;
@@ -289,6 +291,13 @@
} else
ReadFrameAddress(row_register_kind, active_row->GetAFAValue(), m_afa);
+ if (m_cfa == LLDB_INVALID_ADDRESS && m_afa == LLDB_INVALID_ADDRESS) {
+ UnwindLogMsg(
+ "could not read CFA or AFA values for first frame, not valid.");
+ m_frame_type = eNotAValidFrame;
+ return;
+ }
+
UnwindLogMsg("initialized frame current pc is 0x%" PRIx64 " cfa is 0x%"
PRIx64
" afa is 0x%" PRIx64 " using %s UnwindPlan",
(uint64_t)m_current_pc.GetLoadAddress(exe_ctx.GetTargetPtr()),
@@ -2116,6 +2125,14 @@
}
const RegisterInfo *reg_info = GetRegisterInfoAtIndex(lldb_regnum);
+ assert(reg_info);
+ if (!reg_info) {
+ UnwindLogMsg(
+ "Could not find RegisterInfo definition for lldb register number %d",
+ lldb_regnum);
+ return false;
+ }
+
RegisterValue reg_value;
// if this is frame 0 (currently executing frame), get the requested reg
// contents from the actual thread registers
Index: lldb/source/Target/RegisterContextUnwind.cpp
===================================================================
--- lldb/source/Target/RegisterContextUnwind.cpp
+++ lldb/source/Target/RegisterContextUnwind.cpp
@@ -37,6 +37,8 @@
#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/VASPrintf.h"
#include "lldb/lldb-private.h"
+
+#include <cassert>
#include <memory>
using namespace lldb;
@@ -289,6 +291,13 @@
} else
ReadFrameAddress(row_register_kind, active_row->GetAFAValue(), m_afa);
+ if (m_cfa == LLDB_INVALID_ADDRESS && m_afa == LLDB_INVALID_ADDRESS) {
+ UnwindLogMsg(
+ "could not read CFA or AFA values for first frame, not valid.");
+ m_frame_type = eNotAValidFrame;
+ return;
+ }
+
UnwindLogMsg("initialized frame current pc is 0x%" PRIx64 " cfa is 0x%" PRIx64
" afa is 0x%" PRIx64 " using %s UnwindPlan",
(uint64_t)m_current_pc.GetLoadAddress(exe_ctx.GetTargetPtr()),
@@ -2116,6 +2125,14 @@
}
const RegisterInfo *reg_info = GetRegisterInfoAtIndex(lldb_regnum);
+ assert(reg_info);
+ if (!reg_info) {
+ UnwindLogMsg(
+ "Could not find RegisterInfo definition for lldb register number %d",
+ lldb_regnum);
+ return false;
+ }
+
RegisterValue reg_value;
// if this is frame 0 (currently executing frame), get the requested reg
// contents from the actual thread registers
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits