[Lldb-commits] [PATCH] D75007: When unwinding out of a trap handler, fetch the saved pc even if there's a return address register defined
Jason Molenda via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 24 16:18:22 PST 2020
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGedc4f4c9c9d9: Unwind past an interrupt handler correctly on arm or at pc==0 (authored by jasonmolenda).
Changed prior to commit:
https://reviews.llvm.org/D75007?vs=246056&id=246336#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75007/new/
https://reviews.llvm.org/D75007
Files:
lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
Index: lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
===================================================================
--- lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -328,9 +328,13 @@
// If we don't have a Module for some reason, we're not going to find
// symbol/function information - just stick in some reasonable defaults and
- // hope we can unwind past this frame.
+ // hope we can unwind past this frame. If we're above a trap handler,
+ // we may be at a bogus address because we jumped through a bogus function
+ // pointer and trapped, so don't force the arch default unwind plan in that
+ // case.
ModuleSP pc_module_sp(m_current_pc.GetModule());
- if (!m_current_pc.IsValid() || !pc_module_sp) {
+ if ((!m_current_pc.IsValid() || !pc_module_sp) &&
+ above_trap_handler == false) {
UnwindLogMsg("using architectural default unwind method");
// Test the pc value to see if we know it's in an unmapped/non-executable
@@ -1203,9 +1207,13 @@
// If we're fetching the saved pc and this UnwindPlan defines a
// ReturnAddress register (e.g. lr on arm), look for the return address
// register number in the UnwindPlan's row.
+ // If this is a trap handler frame, we have access to the complete
+ // register context when the interrupt/async signal was received, so
+ // we need to fetch the actual saved $pc value.
if (pc_regnum.IsValid() && pc_regnum == regnum &&
m_full_unwind_plan_sp->GetReturnAddressRegister() !=
- LLDB_INVALID_REGNUM) {
+ LLDB_INVALID_REGNUM &&
+ m_frame_type != eTrapHandlerFrame) {
return_address_reg.init(
m_thread, m_full_unwind_plan_sp->GetRegisterKind(),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75007.246336.patch
Type: text/x-patch
Size: 1838 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200225/a8089f0d/attachment.bin>
More information about the lldb-commits
mailing list