forked from OSchip/llvm-project
[lldb] Inline invariant params to AppleThreadPlanStepThrough (NFC)
These two `AppleThreadPlanStepThrough` thread plans have parameterized behavior that is unutilized. To make their interface and implementation simpler, this change inlines those outside parameters. Differential Revision: https://reviews.llvm.org/D96276
This commit is contained in:
parent
5e8a246ac9
commit
2309392449
|
@ -1157,13 +1157,8 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
|
||||||
flag_value.GetScalar() = 0; // FIXME - Set to 0 when debugging is done.
|
flag_value.GetScalar() = 0; // FIXME - Set to 0 when debugging is done.
|
||||||
dispatch_values.PushValue(flag_value);
|
dispatch_values.PushValue(flag_value);
|
||||||
|
|
||||||
// The step through code might have to fill in the cache, so it
|
|
||||||
// is not safe to run only one thread. So we override the
|
|
||||||
// stop_others value passed in to us here:
|
|
||||||
const bool trampoline_stop_others = false;
|
|
||||||
ret_plan_sp = std::make_shared<AppleThreadPlanStepThroughObjCTrampoline>(
|
ret_plan_sp = std::make_shared<AppleThreadPlanStepThroughObjCTrampoline>(
|
||||||
thread, *this, dispatch_values, isa_addr, sel_addr,
|
thread, *this, dispatch_values, isa_addr, sel_addr);
|
||||||
trampoline_stop_others);
|
|
||||||
if (log) {
|
if (log) {
|
||||||
StreamString s;
|
StreamString s;
|
||||||
ret_plan_sp->GetDescription(&s, eDescriptionLevelFull);
|
ret_plan_sp->GetDescription(&s, eDescriptionLevelFull);
|
||||||
|
@ -1182,13 +1177,9 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
|
||||||
MsgsendMap::iterator pos;
|
MsgsendMap::iterator pos;
|
||||||
pos = m_opt_dispatch_map.find(curr_pc);
|
pos = m_opt_dispatch_map.find(curr_pc);
|
||||||
if (pos != m_opt_dispatch_map.end()) {
|
if (pos != m_opt_dispatch_map.end()) {
|
||||||
|
|
||||||
const char *opt_name = g_opt_dispatch_names[(*pos).second];
|
const char *opt_name = g_opt_dispatch_names[(*pos).second];
|
||||||
|
ret_plan_sp = std::make_shared<AppleThreadPlanStepThroughDirectDispatch>(
|
||||||
bool trampoline_stop_others = false;
|
thread, *this, opt_name);
|
||||||
LazyBool step_in_should_stop = eLazyBoolCalculate;
|
|
||||||
ret_plan_sp = std::make_shared<AppleThreadPlanStepThroughDirectDispatch> (
|
|
||||||
thread, *this, opt_name, trampoline_stop_others, step_in_should_stop);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,15 +30,13 @@ using namespace lldb_private;
|
||||||
AppleThreadPlanStepThroughObjCTrampoline::
|
AppleThreadPlanStepThroughObjCTrampoline::
|
||||||
AppleThreadPlanStepThroughObjCTrampoline(
|
AppleThreadPlanStepThroughObjCTrampoline(
|
||||||
Thread &thread, AppleObjCTrampolineHandler &trampoline_handler,
|
Thread &thread, AppleObjCTrampolineHandler &trampoline_handler,
|
||||||
ValueList &input_values, lldb::addr_t isa_addr, lldb::addr_t sel_addr,
|
ValueList &input_values, lldb::addr_t isa_addr, lldb::addr_t sel_addr)
|
||||||
bool stop_others)
|
|
||||||
: ThreadPlan(ThreadPlan::eKindGeneric,
|
: ThreadPlan(ThreadPlan::eKindGeneric,
|
||||||
"MacOSX Step through ObjC Trampoline", thread, eVoteNoOpinion,
|
"MacOSX Step through ObjC Trampoline", thread, eVoteNoOpinion,
|
||||||
eVoteNoOpinion),
|
eVoteNoOpinion),
|
||||||
m_trampoline_handler(trampoline_handler),
|
m_trampoline_handler(trampoline_handler),
|
||||||
m_args_addr(LLDB_INVALID_ADDRESS), m_input_values(input_values),
|
m_args_addr(LLDB_INVALID_ADDRESS), m_input_values(input_values),
|
||||||
m_isa_addr(isa_addr), m_sel_addr(sel_addr), m_impl_function(nullptr),
|
m_isa_addr(isa_addr), m_sel_addr(sel_addr), m_impl_function(nullptr) {}
|
||||||
m_stop_others(stop_others) {}
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
AppleThreadPlanStepThroughObjCTrampoline::
|
AppleThreadPlanStepThroughObjCTrampoline::
|
||||||
|
@ -66,7 +64,7 @@ bool AppleThreadPlanStepThroughObjCTrampoline::InitializeFunctionCaller() {
|
||||||
EvaluateExpressionOptions options;
|
EvaluateExpressionOptions options;
|
||||||
options.SetUnwindOnError(true);
|
options.SetUnwindOnError(true);
|
||||||
options.SetIgnoreBreakpoints(true);
|
options.SetIgnoreBreakpoints(true);
|
||||||
options.SetStopOthers(m_stop_others);
|
options.SetStopOthers(false);
|
||||||
GetThread().CalculateExecutionContext(exc_ctx);
|
GetThread().CalculateExecutionContext(exc_ctx);
|
||||||
m_func_sp = m_impl_function->GetThreadPlanToCallFunction(
|
m_func_sp = m_impl_function->GetThreadPlanToCallFunction(
|
||||||
exc_ctx, m_args_addr, options, diagnostics);
|
exc_ctx, m_args_addr, options, diagnostics);
|
||||||
|
@ -157,7 +155,7 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
|
||||||
const bool first_insn = true;
|
const bool first_insn = true;
|
||||||
const uint32_t frame_idx = 0;
|
const uint32_t frame_idx = 0;
|
||||||
m_run_to_sp = GetThread().QueueThreadPlanForStepOutNoShouldStop(
|
m_run_to_sp = GetThread().QueueThreadPlanForStepOutNoShouldStop(
|
||||||
abort_other_plans, &sc, first_insn, m_stop_others, eVoteNoOpinion,
|
abort_other_plans, &sc, first_insn, false, eVoteNoOpinion,
|
||||||
eVoteNoOpinion, frame_idx, status);
|
eVoteNoOpinion, frame_idx, status);
|
||||||
if (m_run_to_sp && status.Success())
|
if (m_run_to_sp && status.Success())
|
||||||
m_run_to_sp->SetPrivate(true);
|
m_run_to_sp->SetPrivate(true);
|
||||||
|
@ -179,7 +177,7 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
|
||||||
// Extract the target address from the value:
|
// Extract the target address from the value:
|
||||||
|
|
||||||
m_run_to_sp = std::make_shared<ThreadPlanRunToAddress>(
|
m_run_to_sp = std::make_shared<ThreadPlanRunToAddress>(
|
||||||
GetThread(), target_so_addr, m_stop_others);
|
GetThread(), target_so_addr, false);
|
||||||
PushPlan(m_run_to_sp);
|
PushPlan(m_run_to_sp);
|
||||||
return false;
|
return false;
|
||||||
} else if (GetThread().IsThreadPlanDone(m_run_to_sp.get())) {
|
} else if (GetThread().IsThreadPlanDone(m_run_to_sp.get())) {
|
||||||
|
@ -222,10 +220,9 @@ bool AppleThreadPlanStepThroughObjCTrampoline::WillStop() { return true; }
|
||||||
AppleThreadPlanStepThroughDirectDispatch ::
|
AppleThreadPlanStepThroughDirectDispatch ::
|
||||||
AppleThreadPlanStepThroughDirectDispatch(
|
AppleThreadPlanStepThroughDirectDispatch(
|
||||||
Thread &thread, AppleObjCTrampolineHandler &handler,
|
Thread &thread, AppleObjCTrampolineHandler &handler,
|
||||||
llvm::StringRef dispatch_func_name, bool stop_others,
|
llvm::StringRef dispatch_func_name)
|
||||||
LazyBool step_in_avoids_code_without_debug_info)
|
: ThreadPlanStepOut(thread, nullptr, true /* first instruction */, false,
|
||||||
: ThreadPlanStepOut(thread, nullptr, true /* first instruction */,
|
eVoteNoOpinion, eVoteNoOpinion,
|
||||||
stop_others, eVoteNoOpinion, eVoteNoOpinion,
|
|
||||||
0 /* Step out of zeroth frame */,
|
0 /* Step out of zeroth frame */,
|
||||||
eLazyBoolNo /* Our parent plan will decide this
|
eLazyBoolNo /* Our parent plan will decide this
|
||||||
when we are done */
|
when we are done */
|
||||||
|
@ -234,7 +231,7 @@ AppleThreadPlanStepThroughDirectDispatch ::
|
||||||
false /* Don't gather the return value */),
|
false /* Don't gather the return value */),
|
||||||
m_trampoline_handler(handler),
|
m_trampoline_handler(handler),
|
||||||
m_dispatch_func_name(std::string(dispatch_func_name)),
|
m_dispatch_func_name(std::string(dispatch_func_name)),
|
||||||
m_at_msg_send(false), m_stop_others(stop_others) {
|
m_at_msg_send(false) {
|
||||||
// Set breakpoints on the dispatch functions:
|
// Set breakpoints on the dispatch functions:
|
||||||
auto bkpt_callback = [&] (lldb::addr_t addr,
|
auto bkpt_callback = [&] (lldb::addr_t addr,
|
||||||
const AppleObjCTrampolineHandler
|
const AppleObjCTrampolineHandler
|
||||||
|
@ -249,20 +246,7 @@ AppleThreadPlanStepThroughDirectDispatch ::
|
||||||
// We'll set the step-out plan in the DidPush so it gets queued in the right
|
// We'll set the step-out plan in the DidPush so it gets queued in the right
|
||||||
// order.
|
// order.
|
||||||
|
|
||||||
bool avoid_nodebug = true;
|
if (GetThread().GetStepInAvoidsNoDebug())
|
||||||
|
|
||||||
switch (step_in_avoids_code_without_debug_info) {
|
|
||||||
case eLazyBoolYes:
|
|
||||||
avoid_nodebug = true;
|
|
||||||
break;
|
|
||||||
case eLazyBoolNo:
|
|
||||||
avoid_nodebug = false;
|
|
||||||
break;
|
|
||||||
case eLazyBoolCalculate:
|
|
||||||
avoid_nodebug = GetThread().GetStepInAvoidsNoDebug();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (avoid_nodebug)
|
|
||||||
GetFlags().Set(ThreadPlanShouldStopHere::eStepInAvoidNoDebug);
|
GetFlags().Set(ThreadPlanShouldStopHere::eStepInAvoidNoDebug);
|
||||||
else
|
else
|
||||||
GetFlags().Clear(ThreadPlanShouldStopHere::eStepInAvoidNoDebug);
|
GetFlags().Clear(ThreadPlanShouldStopHere::eStepInAvoidNoDebug);
|
||||||
|
@ -398,8 +382,8 @@ bool AppleThreadPlanStepThroughDirectDispatch::ShouldStop(Event *event_ptr) {
|
||||||
// There's no way we could have gotten here without an ObjC language
|
// There's no way we could have gotten here without an ObjC language
|
||||||
// runtime.
|
// runtime.
|
||||||
assert(objc_runtime);
|
assert(objc_runtime);
|
||||||
m_objc_step_through_sp
|
m_objc_step_through_sp =
|
||||||
= objc_runtime->GetStepThroughTrampolinePlan(GetThread(), m_stop_others);
|
objc_runtime->GetStepThroughTrampolinePlan(GetThread(), false);
|
||||||
// If we failed to find the target for this dispatch, just keep going and
|
// If we failed to find the target for this dispatch, just keep going and
|
||||||
// let the step out complete.
|
// let the step out complete.
|
||||||
if (!m_objc_step_through_sp) {
|
if (!m_objc_step_through_sp) {
|
||||||
|
|
|
@ -24,8 +24,7 @@ class AppleThreadPlanStepThroughObjCTrampoline : public ThreadPlan {
|
||||||
public:
|
public:
|
||||||
AppleThreadPlanStepThroughObjCTrampoline(
|
AppleThreadPlanStepThroughObjCTrampoline(
|
||||||
Thread &thread, AppleObjCTrampolineHandler &trampoline_handler,
|
Thread &thread, AppleObjCTrampolineHandler &trampoline_handler,
|
||||||
ValueList &values, lldb::addr_t isa_addr, lldb::addr_t sel_addr,
|
ValueList &values, lldb::addr_t isa_addr, lldb::addr_t sel_addr);
|
||||||
bool stop_others);
|
|
||||||
|
|
||||||
~AppleThreadPlanStepThroughObjCTrampoline() override;
|
~AppleThreadPlanStepThroughObjCTrampoline() override;
|
||||||
|
|
||||||
|
@ -39,7 +38,9 @@ public:
|
||||||
|
|
||||||
bool ShouldStop(Event *event_ptr) override;
|
bool ShouldStop(Event *event_ptr) override;
|
||||||
|
|
||||||
bool StopOthers() override { return m_stop_others; }
|
// The step through code might have to fill in the cache, so it is not safe
|
||||||
|
// to run only one thread.
|
||||||
|
bool StopOthers() override { return false; }
|
||||||
|
|
||||||
// The base class MischiefManaged does some cleanup - so you have to call it
|
// The base class MischiefManaged does some cleanup - so you have to call it
|
||||||
// in your MischiefManaged derived class.
|
// in your MischiefManaged derived class.
|
||||||
|
@ -69,15 +70,13 @@ private:
|
||||||
FunctionCaller *m_impl_function; /// This is a pointer to a impl function that
|
FunctionCaller *m_impl_function; /// This is a pointer to a impl function that
|
||||||
/// is owned by the client that pushes this
|
/// is owned by the client that pushes this
|
||||||
/// plan.
|
/// plan.
|
||||||
bool m_stop_others; /// Whether we should stop other threads.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AppleThreadPlanStepThroughDirectDispatch: public ThreadPlanStepOut {
|
class AppleThreadPlanStepThroughDirectDispatch: public ThreadPlanStepOut {
|
||||||
public:
|
public:
|
||||||
AppleThreadPlanStepThroughDirectDispatch(
|
AppleThreadPlanStepThroughDirectDispatch(Thread &thread,
|
||||||
Thread &thread, AppleObjCTrampolineHandler &handler,
|
AppleObjCTrampolineHandler &handler,
|
||||||
llvm::StringRef dispatch_func_name, bool stop_others,
|
llvm::StringRef dispatch_func_name);
|
||||||
LazyBool step_in_avoids_code_without_debug_info);
|
|
||||||
|
|
||||||
~AppleThreadPlanStepThroughDirectDispatch() override;
|
~AppleThreadPlanStepThroughDirectDispatch() override;
|
||||||
|
|
||||||
|
@ -85,7 +84,7 @@ public:
|
||||||
|
|
||||||
bool ShouldStop(Event *event_ptr) override;
|
bool ShouldStop(Event *event_ptr) override;
|
||||||
|
|
||||||
bool StopOthers() override { return m_stop_others; }
|
bool StopOthers() override { return false; }
|
||||||
|
|
||||||
bool MischiefManaged() override;
|
bool MischiefManaged() override;
|
||||||
|
|
||||||
|
@ -107,7 +106,6 @@ protected:
|
||||||
std::vector<lldb::BreakpointSP> m_msgSend_bkpts; /// Breakpoints on the objc
|
std::vector<lldb::BreakpointSP> m_msgSend_bkpts; /// Breakpoints on the objc
|
||||||
/// dispatch functions.
|
/// dispatch functions.
|
||||||
bool m_at_msg_send; /// Are we currently handling an msg_send
|
bool m_at_msg_send; /// Are we currently handling an msg_send
|
||||||
bool m_stop_others; /// Whether we should stop other threads.
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue