41 ProcessSP process_sp(thread.GetProcess());
45 abi = process_sp->GetABI().get();
59 if (!
error.Success()) {
61 "Trying to put the stack in unreadable memory at: 0x%" PRIx64
".",
63 LLDB_LOGF(log,
"ThreadPlanCallFunction(%p): %s.",
static_cast<void *
>(
this),
71 "%s", llvm::toString(start_address.takeError()).c_str());
72 LLDB_LOGF(log,
"ThreadPlanCallFunction(%p): %s.",
static_cast<void *
>(
this),
83 "Original register state was:");
87 "checkpoint thread state.");
88 LLDB_LOGF(log,
"ThreadPlanCallFunction(%p): %s.",
static_cast<void *
>(
this),
102 m_valid(false), m_stop_other_threads(options.GetStopOthers()),
103 m_unwind_on_error(options.DoesUnwindOnError()),
104 m_ignore_breakpoints(options.DoesIgnoreBreakpoints()),
105 m_debug_execution(options.GetDebug()),
106 m_trap_exceptions(options.GetTrapExceptions()), m_function_addr(function),
107 m_start_addr(), m_function_sp(0), m_subplan_sp(),
108 m_cxx_language_runtime(nullptr), m_objc_language_runtime(nullptr),
109 m_stored_thread_state(), m_real_stop_info_sp(), m_constructor_errors(),
110 m_return_valobj_sp(), m_takedown_done(false),
111 m_should_clear_objc_exception_bp(false),
112 m_should_clear_cxx_exception_bp(false),
122 start_load_addr, args))
163 reg_idx < num_registers; ++reg_idx) {
187 "ThreadPlanCallFunction(%p): Failed to restore register state from "
188 "invalid plan that contained a saved register state.",
189 static_cast<void *
>(
this));
193 "ThreadPlanCallFunction(%p): Log called on "
194 "ThreadPlanCallFunction that was never valid.",
195 static_cast<void *
>(
this));
204 "ThreadPlanCallFunction(%p): DoTakedown called for thread "
205 "0x%4.4" PRIx64
", m_valid: %d complete: %d.\n",
209 thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC();
213 "ThreadPlanCallFunction(%p): DoTakedown failed to restore "
215 static_cast<void *
>(
this));
221 "Restored register state:");
224 "ThreadPlanCallFunction(%p): DoTakedown called as no-op for "
225 "thread 0x%4.4" PRIx64
", m_valid: %d complete: %d.\n",
234 s->
Printf(
"Function call thread plan");
236 s->
Printf(
"Thread plan to call 0x%" PRIx64,
247 error->PutCString(
"Unknown error");
281 "ThreadPlanCallFunction::PlanExplainsStop: Got stop reason - {0}.",
291 LLDB_LOGF(log,
"ThreadPlanCallFunction::PlanExplainsStop: The event is an "
292 "Interrupt, returning true.");
303 bp_site_sp =
m_process.GetBreakpointSiteList().FindByID(break_site_id);
305 uint32_t num_owners = bp_site_sp->GetNumberOfConstituents();
306 bool is_internal =
true;
307 for (uint32_t i = 0; i < num_owners; i++) {
308 Breakpoint &bp = bp_site_sp->GetConstituentAtIndex(i)->GetBreakpoint();
310 "ThreadPlanCallFunction::PlanExplainsStop: hit "
311 "breakpoint %d while calling function",
320 LLDB_LOGF(log,
"ThreadPlanCallFunction::PlanExplainsStop hit an "
321 "internal breakpoint, not stopping.");
328 "ThreadPlanCallFunction::PlanExplainsStop: we are ignoring "
329 "breakpoints, overriding breakpoint stop info ShouldStop, "
334 LLDB_LOGF(log,
"ThreadPlanCallFunction::PlanExplainsStop: we are not "
335 "ignoring breakpoints, overriding breakpoint stop info "
336 "ShouldStop, returning true");
389#ifndef SINGLE_STEP_EXPRESSIONS
405 LLDB_LOGF(log,
"ThreadPlanCallFunction(%p): Completed call function plan.",
406 static_cast<void *
>(
this));
454 LLDB_LOGF(log,
"ThreadPlanCallFunction::BreakpointsExplainStop - Hit an "
455 "exception breakpoint, setting plan complete.");
462 stop_info_sp->OverrideShouldStop(
true);
481 const bool persistent =
false;
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
virtual bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp, lldb::addr_t functionAddress, lldb::addr_t returnAddress, llvm::ArrayRef< lldb::addr_t > args) const =0
lldb::ValueObjectSP GetReturnValueObject(Thread &thread, CompilerType &type, bool persistent=true) const
virtual size_t GetRedZoneSize() const =0
A section + offset based address class.
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
bool IsInternal() const
Tell whether this breakpoint is an "internal" breakpoint.
Generic representation of a type in a programming language.
void PutCString(const char *cstr)
void PutString(llvm::StringRef str)
static bool GetInterruptedFromEvent(const Event *event_ptr)
virtual const RegisterInfo * GetRegisterInfoAtIndex(size_t reg)=0
virtual size_t GetRegisterCount()=0
virtual bool ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value)=0
lldb::break_id_t GetID() const
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t EOL()
Output and End of Line character to the stream.
llvm::Expected< lldb_private::Address > GetEntryPointAddress()
This method will return the address of the starting function for this binary, e.g.
StreamString m_constructor_errors
void SetStopOthers(bool new_value) override
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
bool ConstructorSetup(Thread &thread, ABI *&abi, lldb::addr_t &start_load_addr, lldb::addr_t &function_load_addr)
bool m_ignore_breakpoints
bool MischiefManaged() override
lldb::addr_t m_stop_address
lldb::StopInfoSP m_real_stop_info_sp
Vote ShouldReportStop(Event *event_ptr) override
bool m_should_clear_objc_exception_bp
bool StopOthers() override
void ReportRegisterState(const char *message)
ThreadPlanCallFunction(Thread &thread, const Address &function, const CompilerType &return_type, llvm::ArrayRef< lldb::addr_t > args, const EvaluateExpressionOptions &options)
LanguageRuntime * m_cxx_language_runtime
bool DoPlanExplainsStop(Event *event_ptr) override
bool BreakpointsExplainStop()
lldb::StateType GetPlanRunState() override
void RestoreThreadState() override
LanguageRuntime * m_objc_language_runtime
CompilerType m_return_type
bool ShouldStop(Event *event_ptr) override
lldb::ThreadPlanSP m_subplan_sp
~ThreadPlanCallFunction() override
bool m_stop_other_threads
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
lldb::ValueObjectSP m_return_valobj_sp
virtual void SetReturnValue()
bool m_should_clear_cxx_exception_bp
Thread::ThreadStateCheckpoint m_stored_thread_state
lldb::addr_t m_function_sp
virtual void DoTakedown(bool success)
virtual Vote ShouldReportStop(Event *event_ptr)
void SetPrivate(bool input)
ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vote report_stop_vote, Vote report_run_vote)
void SetPlanComplete(bool success=true)
Thread & GetThread()
Returns the Thread that is using this thread plan.
void SetOkayToDiscard(bool value)
virtual bool MischiefManaged()
bool SetIsControllingPlan(bool value)
lldb::StopInfoSP GetPrivateStopInfo()
void RestoreThreadStateFromCheckpoint(ThreadStateCheckpoint &saved_state)
virtual lldb::RegisterContextSP GetRegisterContext()=0
void SetStopInfoToNothing()
static std::string StopReasonAsString(lldb::StopReason reason)
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
void DumpRegisterValue(const RegisterValue ®_val, Stream &s, const RegisterInfo ®_info, bool prefix_with_name, bool prefix_with_alt_name, lldb::Format format, uint32_t reg_name_right_align_at=0, ExecutionContextScope *exe_scope=nullptr, bool print_flags=false, lldb::TargetSP target_sp=nullptr)
std::shared_ptr< lldb_private::BreakpointSite > BreakpointSiteSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
StateType
Process and Thread States.
@ eStateRunning
Process or thread is running and can't be examined.
@ eLanguageTypeObjC
Objective-C.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
StopReason
Thread stop reasons.
Every register is described in detail including its name, alternate name (optional),...