[Lldb-commits] [PATCH] D61921: [Target] Generalize language-specific behavior in ThreadPlanStepThrough
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue May 14 15:20:40 PDT 2019
xiaobai created this revision.
xiaobai added reviewers: jingham, JDevlieghere.
When creating a ThreadPlan to step through a trampoline, we ask the
ObjC language runtime and the CPP language runtime to come up with such a thread
plan if the dynamic loader fails to give us one. I don't see why this behavior
can't be language agnostic.
https://reviews.llvm.org/D61921
Files:
include/lldb/Target/CPPLanguageRuntime.h
include/lldb/Target/LanguageRuntime.h
include/lldb/Target/ObjCLanguageRuntime.h
source/Target/ThreadPlanStepThrough.cpp
Index: source/Target/ThreadPlanStepThrough.cpp
===================================================================
--- source/Target/ThreadPlanStepThrough.cpp
+++ source/Target/ThreadPlanStepThrough.cpp
@@ -85,22 +85,17 @@
m_sub_plan_sp =
loader->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
- // If that didn't come up with anything, try the ObjC runtime plugin:
- if (!m_sub_plan_sp.get()) {
- ObjCLanguageRuntime *objc_runtime =
- m_thread.GetProcess()->GetObjCLanguageRuntime();
- if (objc_runtime)
- m_sub_plan_sp =
- objc_runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
-
- CPPLanguageRuntime *cpp_runtime =
- m_thread.GetProcess()->GetCPPLanguageRuntime();
-
- // If the ObjC runtime did not provide us with a step though plan then if we
- // have it check the C++ runtime for a step though plan.
- if (!m_sub_plan_sp.get() && cpp_runtime)
- m_sub_plan_sp =
- cpp_runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
+ // If the DynamicLoader was unable to provide us with a ThreadPlan, then we
+ // try the LanguageRuntimes.
+ if (!m_sub_plan_sp) {
+ for (unsigned lang = eLanguageTypeUnknown;
+ !m_sub_plan_sp && lang < eNumLanguageTypes; lang++) {
+ if (auto runtime = m_thread.GetProcess()->GetLanguageRuntime(
+ static_cast<lldb::LanguageType>(lang))) {
+ m_sub_plan_sp =
+ runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
+ }
+ }
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Index: include/lldb/Target/ObjCLanguageRuntime.h
===================================================================
--- include/lldb/Target/ObjCLanguageRuntime.h
+++ include/lldb/Target/ObjCLanguageRuntime.h
@@ -216,9 +216,6 @@
virtual bool HasReadObjCLibrary() = 0;
- virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
- bool stop_others) = 0;
-
lldb::addr_t LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t sel);
void AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t sel,
Index: include/lldb/Target/LanguageRuntime.h
===================================================================
--- include/lldb/Target/LanguageRuntime.h
+++ include/lldb/Target/LanguageRuntime.h
@@ -143,6 +143,9 @@
return false;
}
+ virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
+ bool stop_others) = 0;
+
/// Identify whether a value is a language implementation detaul
/// that should be hidden from the user interface by default.
virtual bool IsRuntimeSupportValue(ValueObject &valobj) { return false; }
Index: include/lldb/Target/CPPLanguageRuntime.h
===================================================================
--- include/lldb/Target/CPPLanguageRuntime.h
+++ include/lldb/Target/CPPLanguageRuntime.h
@@ -61,7 +61,7 @@
/// \return
/// A ThreadPlan Shared pointer
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
- bool stop_others);
+ bool stop_others) override;
bool IsRuntimeSupportValue(ValueObject &valobj) override;
protected:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61921.199525.patch
Type: text/x-patch
Size: 3375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190514/6ec213be/attachment.bin>
More information about the lldb-commits
mailing list