[Lldb-commits] [lldb] r362164 - [Target] Generalize language-specific behavior in ThreadPlanStepThrough
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Thu May 30 15:00:18 PDT 2019
Author: xiaobai
Date: Thu May 30 15:00:18 2019
New Revision: 362164
URL: http://llvm.org/viewvc/llvm-project?rev=362164&view=rev
Log:
[Target] Generalize language-specific behavior in ThreadPlanStepThrough
Summary:
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.
Differential Revision: https://reviews.llvm.org/D61921
Modified:
lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
lldb/trunk/include/lldb/Target/LanguageRuntime.h
lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
Modified: lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h?rev=362164&r1=362163&r2=362164&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h Thu May 30 15:00:18 2019
@@ -61,7 +61,7 @@ public:
/// \return
/// A ThreadPlan Shared pointer
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
- bool stop_others);
+ bool stop_others) override;
bool IsRuntimeSupportValue(ValueObject &valobj) override;
protected:
Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=362164&r1=362163&r2=362164&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Thu May 30 15:00:18 2019
@@ -143,6 +143,9 @@ public:
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; }
Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h?rev=362164&r1=362163&r2=362164&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h Thu May 30 15:00:18 2019
@@ -216,9 +216,6 @@ public:
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,
Modified: lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepThrough.cpp?rev=362164&r1=362163&r2=362164&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepThrough.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepThrough.cpp Thu May 30 15:00:18 2019
@@ -8,9 +8,8 @@
#include "lldb/Target/ThreadPlanStepThrough.h"
#include "lldb/Breakpoint/Breakpoint.h"
-#include "lldb/Target/CPPLanguageRuntime.h"
#include "lldb/Target/DynamicLoader.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Target.h"
@@ -85,22 +84,17 @@ void ThreadPlanStepThrough::LookForPlanT
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)
+ // If the DynamicLoader was unable to provide us with a ThreadPlan, then we
+ // try the LanguageRuntimes.
+ if (!m_sub_plan_sp) {
+ for (LanguageRuntime *runtime :
+ m_thread.GetProcess()->GetLanguageRuntimes()) {
m_sub_plan_sp =
- objc_runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
+ 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 (m_sub_plan_sp)
+ break;
+ }
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
More information about the lldb-commits
mailing list