summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/Target/ThreadPlanCallFunction.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2017-04-02 17:24:58 +0000
committerdim <dim@FreeBSD.org>2017-04-02 17:24:58 +0000
commit60b571e49a90d38697b3aca23020d9da42fc7d7f (patch)
tree99351324c24d6cb146b6285b6caffa4d26fce188 /contrib/llvm/tools/lldb/source/Target/ThreadPlanCallFunction.cpp
parentbea1b22c7a9bce1dfdd73e6e5b65bc4752215180 (diff)
downloadFreeBSD-src-60b571e49a90d38697b3aca23020d9da42fc7d7f.zip
FreeBSD-src-60b571e49a90d38697b3aca23020d9da42fc7d7f.tar.gz
Update clang, llvm, lld, lldb, compiler-rt and libc++ to 4.0.0 release:
MFC r309142 (by emaste): Add WITH_LLD_AS_LD build knob If set it installs LLD as /usr/bin/ld. LLD (as of version 3.9) is not capable of linking the world and kernel, but can self-host and link many substantial applications. GNU ld continues to be used for the world and kernel build, regardless of how this knob is set. It is on by default for arm64, and off for all other CPU architectures. Sponsored by: The FreeBSD Foundation MFC r310840: Reapply 310775, now it also builds correctly if lldb is disabled: Move llvm-objdump from CLANG_EXTRAS to installed by default We currently install three tools from binutils 2.17.50: as, ld, and objdump. Work is underway to migrate to a permissively-licensed tool-chain, with one goal being the retirement of binutils 2.17.50. LLVM's llvm-objdump is intended to be compatible with GNU objdump although it is currently missing some options and may have formatting differences. Enable it by default for testing and further investigation. It may later be changed to install as /usr/bin/objdump, it becomes a fully viable replacement. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D8879 MFC r312855 (by emaste): Rename LLD_AS_LD to LLD_IS_LD, for consistency with CLANG_IS_CC Reported by: Dan McGregor <dan.mcgregor usask.ca> MFC r313559 | glebius | 2017-02-10 18:34:48 +0100 (Fri, 10 Feb 2017) | 5 lines Don't check struct rtentry on FreeBSD, it is an internal kernel structure. On other systems it may be API structure for SIOCADDRT/SIOCDELRT. Reviewed by: emaste, dim MFC r314152 (by jkim): Remove an assembler flag, which is redundant since r309124. The upstream took care of it by introducing a macro NO_EXEC_STACK_DIRECTIVE. http://llvm.org/viewvc/llvm-project?rev=273500&view=rev Reviewed by: dim MFC r314564: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 4.0.0 (branches/release_40 296509). The release will follow soon. Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11 support to build; see UPDATING for more information. Also note that as of 4.0.0, lld should be able to link the base system on amd64 and aarch64. See the WITH_LLD_IS_LLD setting in src.conf(5). Though please be aware that this is work in progress. Release notes for llvm, clang and lld will be available here: <http://releases.llvm.org/4.0.0/docs/ReleaseNotes.html> <http://releases.llvm.org/4.0.0/tools/clang/docs/ReleaseNotes.html> <http://releases.llvm.org/4.0.0/tools/lld/docs/ReleaseNotes.html> Thanks to Ed Maste, Jan Beich, Antoine Brodin and Eric Fiselier for their help. Relnotes: yes Exp-run: antoine PR: 215969, 216008 MFC r314708: For now, revert r287232 from upstream llvm trunk (by Daniil Fukalov): [SCEV] limit recursion depth of CompareSCEVComplexity Summary: CompareSCEVComplexity goes too deep (50+ on a quite a big unrolled loop) and runs almost infinite time. Added cache of "equal" SCEV pairs to earlier cutoff of further estimation. Recursion depth limit was also introduced as a parameter. Reviewers: sanjoy Subscribers: mzolotukhin, tstellarAMD, llvm-commits Differential Revision: https://reviews.llvm.org/D26389 This commit is the cause of excessive compile times on skein_block.c (and possibly other files) during kernel builds on amd64. We never saw the problematic behavior described in this upstream commit, so for now it is better to revert it. An upstream bug has been filed here: https://bugs.llvm.org/show_bug.cgi?id=32142 Reported by: mjg MFC r314795: Reapply r287232 from upstream llvm trunk (by Daniil Fukalov): [SCEV] limit recursion depth of CompareSCEVComplexity Summary: CompareSCEVComplexity goes too deep (50+ on a quite a big unrolled loop) and runs almost infinite time. Added cache of "equal" SCEV pairs to earlier cutoff of further estimation. Recursion depth limit was also introduced as a parameter. Reviewers: sanjoy Subscribers: mzolotukhin, tstellarAMD, llvm-commits Differential Revision: https://reviews.llvm.org/D26389 Pull in r296992 from upstream llvm trunk (by Sanjoy Das): [SCEV] Decrease the recursion threshold for CompareValueComplexity Fixes PR32142. r287232 accidentally increased the recursion threshold for CompareValueComplexity from 2 to 32. This change reverses that change by introducing a separate flag for CompareValueComplexity's threshold. The latter revision fixes the excessive compile times for skein_block.c. MFC r314907 | mmel | 2017-03-08 12:40:27 +0100 (Wed, 08 Mar 2017) | 7 lines Unbreak ARMv6 world. The new compiler_rt library imported with clang 4.0.0 have several fatal issues (non-functional __udivsi3 for example) with ARM specific instrict functions. As temporary workaround, until upstream solve these problems, disable all thumb[1][2] related feature. MFC r315016: Update clang, llvm, lld, lldb, compiler-rt and libc++ to 4.0.0 release. We were already very close to the last release candidate, so this is a pretty minor update. Relnotes: yes MFC r316005: Revert r314907, and pull in r298713 from upstream compiler-rt trunk (by Weiming Zhao): builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA. Summary: Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation mode (-mthumb, -marm), it reflect's capability of given CPU. Due to this: - use __tbumb__ and __thumb2__ insteand of __ARM_ARCH_ISA_THUMB - use '.thumb' directive consistently in all affected files - decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION() --------- Note: This patch doesn't fix broken Thumb1 variant of __udivsi3 ! Reviewers: weimingz, rengolin, compnerd Subscribers: aemerson, dim Differential Revision: https://reviews.llvm.org/D30938 Discussed with: mmel
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Target/ThreadPlanCallFunction.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Target/ThreadPlanCallFunction.cpp885
1 files changed, 406 insertions, 479 deletions
diff --git a/contrib/llvm/tools/lldb/source/Target/ThreadPlanCallFunction.cpp b/contrib/llvm/tools/lldb/source/Target/ThreadPlanCallFunction.cpp
index 01ca126..68fd503 100644
--- a/contrib/llvm/tools/lldb/source/Target/ThreadPlanCallFunction.cpp
+++ b/contrib/llvm/tools/lldb/source/Target/ThreadPlanCallFunction.cpp
@@ -34,555 +34,482 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// ThreadPlanCallFunction: Plan to call a single function
//----------------------------------------------------------------------
-bool
-ThreadPlanCallFunction::ConstructorSetup (Thread &thread,
- ABI *& abi,
- lldb::addr_t &start_load_addr,
- lldb::addr_t &function_load_addr)
-{
- SetIsMasterPlan (true);
- SetOkayToDiscard (false);
- SetPrivate (true);
-
- ProcessSP process_sp (thread.GetProcess());
- if (!process_sp)
- return false;
+bool ThreadPlanCallFunction::ConstructorSetup(
+ Thread &thread, ABI *&abi, lldb::addr_t &start_load_addr,
+ lldb::addr_t &function_load_addr) {
+ SetIsMasterPlan(true);
+ SetOkayToDiscard(false);
+ SetPrivate(true);
+
+ ProcessSP process_sp(thread.GetProcess());
+ if (!process_sp)
+ return false;
- abi = process_sp->GetABI().get();
+ abi = process_sp->GetABI().get();
- if (!abi)
- return false;
+ if (!abi)
+ return false;
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP));
- SetBreakpoints();
+ SetBreakpoints();
- m_function_sp = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize();
- // If we can't read memory at the point of the process where we are planning to put our function, we're
- // not going to get any further...
- Error error;
- process_sp->ReadUnsignedIntegerFromMemory(m_function_sp, 4, 0, error);
- if (!error.Success())
- {
- m_constructor_errors.Printf ("Trying to put the stack in unreadable memory at: 0x%" PRIx64 ".", m_function_sp);
- if (log)
- log->Printf ("ThreadPlanCallFunction(%p): %s.",
- static_cast<void*>(this),
- m_constructor_errors.GetData());
- return false;
- }
+ m_function_sp = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize();
+ // If we can't read memory at the point of the process where we are planning
+ // to put our function, we're
+ // not going to get any further...
+ Error error;
+ process_sp->ReadUnsignedIntegerFromMemory(m_function_sp, 4, 0, error);
+ if (!error.Success()) {
+ m_constructor_errors.Printf(
+ "Trying to put the stack in unreadable memory at: 0x%" PRIx64 ".",
+ m_function_sp);
+ if (log)
+ log->Printf("ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
+ m_constructor_errors.GetData());
+ return false;
+ }
- Module *exe_module = GetTarget().GetExecutableModulePointer();
+ Module *exe_module = GetTarget().GetExecutableModulePointer();
- if (exe_module == nullptr)
- {
- m_constructor_errors.Printf ("Can't execute code without an executable module.");
- if (log)
- log->Printf ("ThreadPlanCallFunction(%p): %s.",
- static_cast<void*>(this),
- m_constructor_errors.GetData());
- return false;
+ if (exe_module == nullptr) {
+ m_constructor_errors.Printf(
+ "Can't execute code without an executable module.");
+ if (log)
+ log->Printf("ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
+ m_constructor_errors.GetData());
+ return false;
+ } else {
+ ObjectFile *objectFile = exe_module->GetObjectFile();
+ if (!objectFile) {
+ m_constructor_errors.Printf(
+ "Could not find object file for module \"%s\".",
+ exe_module->GetFileSpec().GetFilename().AsCString());
+
+ if (log)
+ log->Printf("ThreadPlanCallFunction(%p): %s.",
+ static_cast<void *>(this), m_constructor_errors.GetData());
+ return false;
}
- else
- {
- ObjectFile *objectFile = exe_module->GetObjectFile();
- if (!objectFile)
- {
- m_constructor_errors.Printf ("Could not find object file for module \"%s\".",
- exe_module->GetFileSpec().GetFilename().AsCString());
-
- if (log)
- log->Printf ("ThreadPlanCallFunction(%p): %s.",
- static_cast<void*>(this),
- m_constructor_errors.GetData());
- return false;
- }
- m_start_addr = objectFile->GetEntryPointAddress();
- if (!m_start_addr.IsValid())
- {
- m_constructor_errors.Printf ("Could not find entry point address for executable module \"%s\".",
- exe_module->GetFileSpec().GetFilename().AsCString());
- if (log)
- log->Printf ("ThreadPlanCallFunction(%p): %s.",
- static_cast<void*>(this),
- m_constructor_errors.GetData());
- return false;
- }
+ m_start_addr = objectFile->GetEntryPointAddress();
+ if (!m_start_addr.IsValid()) {
+ m_constructor_errors.Printf(
+ "Could not find entry point address for executable module \"%s\".",
+ exe_module->GetFileSpec().GetFilename().AsCString());
+ if (log)
+ log->Printf("ThreadPlanCallFunction(%p): %s.",
+ static_cast<void *>(this), m_constructor_errors.GetData());
+ return false;
}
+ }
- start_load_addr = m_start_addr.GetLoadAddress (&GetTarget());
+ start_load_addr = m_start_addr.GetLoadAddress(&GetTarget());
- // Checkpoint the thread state so we can restore it later.
- if (log && log->GetVerbose())
- ReportRegisterState ("About to checkpoint thread before function call. Original register state was:");
+ // Checkpoint the thread state so we can restore it later.
+ if (log && log->GetVerbose())
+ ReportRegisterState("About to checkpoint thread before function call. "
+ "Original register state was:");
- if (!thread.CheckpointThreadState (m_stored_thread_state))
- {
- m_constructor_errors.Printf ("Setting up ThreadPlanCallFunction, failed to checkpoint thread state.");
- if (log)
- log->Printf ("ThreadPlanCallFunction(%p): %s.",
- static_cast<void*>(this),
- m_constructor_errors.GetData());
- return false;
- }
- function_load_addr = m_function_addr.GetLoadAddress (&GetTarget());
+ if (!thread.CheckpointThreadState(m_stored_thread_state)) {
+ m_constructor_errors.Printf("Setting up ThreadPlanCallFunction, failed to "
+ "checkpoint thread state.");
+ if (log)
+ log->Printf("ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
+ m_constructor_errors.GetData());
+ return false;
+ }
+ function_load_addr = m_function_addr.GetLoadAddress(&GetTarget());
- return true;
+ return true;
}
-ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
- const Address &function,
- const CompilerType &return_type,
- llvm::ArrayRef<addr_t> args,
- const EvaluateExpressionOptions &options) :
- ThreadPlan (ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion),
- m_valid (false),
- m_stop_other_threads (options.GetStopOthers()),
- m_unwind_on_error (options.DoesUnwindOnError()),
- m_ignore_breakpoints (options.DoesIgnoreBreakpoints()),
- m_debug_execution (options.GetDebug()),
- m_trap_exceptions (options.GetTrapExceptions()),
- m_function_addr (function),
- m_function_sp (0),
- m_takedown_done (false),
- m_should_clear_objc_exception_bp(false),
- m_should_clear_cxx_exception_bp (false),
- m_stop_address (LLDB_INVALID_ADDRESS),
- m_return_type (return_type)
-{
- lldb::addr_t start_load_addr = LLDB_INVALID_ADDRESS;
- lldb::addr_t function_load_addr = LLDB_INVALID_ADDRESS;
- ABI *abi = nullptr;
-
- if (!ConstructorSetup (thread, abi, start_load_addr, function_load_addr))
- return;
-
- if (!abi->PrepareTrivialCall(thread,
- m_function_sp,
- function_load_addr,
- start_load_addr,
- args))
- return;
-
- ReportRegisterState ("Function call was set up. Register state was:");
-
- m_valid = true;
+ThreadPlanCallFunction::ThreadPlanCallFunction(
+ Thread &thread, const Address &function, const CompilerType &return_type,
+ llvm::ArrayRef<addr_t> args, const EvaluateExpressionOptions &options)
+ : ThreadPlan(ThreadPlan::eKindCallFunction, "Call function plan", thread,
+ eVoteNoOpinion, eVoteNoOpinion),
+ m_valid(false), m_stop_other_threads(options.GetStopOthers()),
+ m_unwind_on_error(options.DoesUnwindOnError()),
+ m_ignore_breakpoints(options.DoesIgnoreBreakpoints()),
+ m_debug_execution(options.GetDebug()),
+ m_trap_exceptions(options.GetTrapExceptions()), m_function_addr(function),
+ m_function_sp(0), m_takedown_done(false),
+ m_should_clear_objc_exception_bp(false),
+ m_should_clear_cxx_exception_bp(false),
+ m_stop_address(LLDB_INVALID_ADDRESS), m_return_type(return_type) {
+ lldb::addr_t start_load_addr = LLDB_INVALID_ADDRESS;
+ lldb::addr_t function_load_addr = LLDB_INVALID_ADDRESS;
+ ABI *abi = nullptr;
+
+ if (!ConstructorSetup(thread, abi, start_load_addr, function_load_addr))
+ return;
+
+ if (!abi->PrepareTrivialCall(thread, m_function_sp, function_load_addr,
+ start_load_addr, args))
+ return;
+
+ ReportRegisterState("Function call was set up. Register state was:");
+
+ m_valid = true;
}
-ThreadPlanCallFunction::ThreadPlanCallFunction(Thread &thread,
- const Address &function,
- const EvaluateExpressionOptions &options) :
- ThreadPlan(ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion),
- m_valid(false),
- m_stop_other_threads(options.GetStopOthers()),
- m_unwind_on_error(options.DoesUnwindOnError()),
- m_ignore_breakpoints(options.DoesIgnoreBreakpoints()),
- m_debug_execution(options.GetDebug()),
- m_trap_exceptions(options.GetTrapExceptions()),
- m_function_addr(function),
- m_function_sp(0),
- m_takedown_done(false),
- m_should_clear_objc_exception_bp(false),
- m_should_clear_cxx_exception_bp(false),
- m_stop_address(LLDB_INVALID_ADDRESS),
- m_return_type(CompilerType())
-{
+ThreadPlanCallFunction::ThreadPlanCallFunction(
+ Thread &thread, const Address &function,
+ const EvaluateExpressionOptions &options)
+ : ThreadPlan(ThreadPlan::eKindCallFunction, "Call function plan", thread,
+ eVoteNoOpinion, eVoteNoOpinion),
+ m_valid(false), m_stop_other_threads(options.GetStopOthers()),
+ m_unwind_on_error(options.DoesUnwindOnError()),
+ m_ignore_breakpoints(options.DoesIgnoreBreakpoints()),
+ m_debug_execution(options.GetDebug()),
+ m_trap_exceptions(options.GetTrapExceptions()), m_function_addr(function),
+ m_function_sp(0), m_takedown_done(false),
+ m_should_clear_objc_exception_bp(false),
+ m_should_clear_cxx_exception_bp(false),
+ m_stop_address(LLDB_INVALID_ADDRESS), m_return_type(CompilerType()) {}
+
+ThreadPlanCallFunction::~ThreadPlanCallFunction() {
+ DoTakedown(PlanSucceeded());
}
-ThreadPlanCallFunction::~ThreadPlanCallFunction ()
-{
- DoTakedown(PlanSucceeded());
-}
+void ThreadPlanCallFunction::ReportRegisterState(const char *message) {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP |
+ LIBLLDB_LOG_VERBOSE));
+ if (log) {
+ StreamString strm;
+ RegisterContext *reg_ctx = m_thread.GetRegisterContext().get();
-void
-ThreadPlanCallFunction::ReportRegisterState (const char *message)
-{
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_VERBOSE));
- if (log)
- {
- StreamString strm;
- RegisterContext *reg_ctx = m_thread.GetRegisterContext().get();
-
- log->PutCString(message);
-
- RegisterValue reg_value;
-
- for (uint32_t reg_idx = 0, num_registers = reg_ctx->GetRegisterCount();
- reg_idx < num_registers;
- ++reg_idx)
- {
- const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex (reg_idx);
- if (reg_ctx->ReadRegister(reg_info, reg_value))
- {
- reg_value.Dump(&strm, reg_info, true, false, eFormatDefault);
- strm.EOL();
- }
- }
- log->PutCString(strm.GetData());
- }
-}
+ log->PutCString(message);
-void
-ThreadPlanCallFunction::DoTakedown (bool success)
-{
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
+ RegisterValue reg_value;
- if (!m_valid)
- {
- //Don't call DoTakedown if we were never valid to begin with.
- if (log)
- log->Printf ("ThreadPlanCallFunction(%p): Log called on ThreadPlanCallFunction that was never valid.",
- static_cast<void*>(this));
- return;
+ for (uint32_t reg_idx = 0, num_registers = reg_ctx->GetRegisterCount();
+ reg_idx < num_registers; ++reg_idx) {
+ const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex(reg_idx);
+ if (reg_ctx->ReadRegister(reg_info, reg_value)) {
+ reg_value.Dump(&strm, reg_info, true, false, eFormatDefault);
+ strm.EOL();
+ }
}
+ log->PutString(strm.GetString());
+ }
+}
- if (!m_takedown_done)
- {
- if (success)
- {
- SetReturnValue();
- }
- if (log)
- log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called for thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
- static_cast<void*>(this), m_thread.GetID(), m_valid,
- IsPlanComplete());
- m_takedown_done = true;
- m_stop_address = m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC();
- m_real_stop_info_sp = GetPrivateStopInfo ();
- if (!m_thread.RestoreRegisterStateFromCheckpoint(m_stored_thread_state))
- {
- if (log)
- log->Printf("ThreadPlanCallFunction(%p): DoTakedown failed to restore register state",
- static_cast<void*>(this));
- }
- SetPlanComplete(success);
- ClearBreakpoints();
- if (log && log->GetVerbose())
- ReportRegisterState ("Restoring thread state after function call. Restored register state:");
+void ThreadPlanCallFunction::DoTakedown(bool success) {
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP));
+
+ if (!m_valid) {
+ // Don't call DoTakedown if we were never valid to begin with.
+ if (log)
+ log->Printf("ThreadPlanCallFunction(%p): Log called on "
+ "ThreadPlanCallFunction that was never valid.",
+ static_cast<void *>(this));
+ return;
+ }
+
+ if (!m_takedown_done) {
+ if (success) {
+ SetReturnValue();
}
- else
- {
- if (log)
- log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called as no-op for thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
- static_cast<void*>(this), m_thread.GetID(), m_valid,
- IsPlanComplete());
+ if (log)
+ log->Printf("ThreadPlanCallFunction(%p): DoTakedown called for thread "
+ "0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
+ static_cast<void *>(this), m_thread.GetID(), m_valid,
+ IsPlanComplete());
+ m_takedown_done = true;
+ m_stop_address =
+ m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC();
+ m_real_stop_info_sp = GetPrivateStopInfo();
+ if (!m_thread.RestoreRegisterStateFromCheckpoint(m_stored_thread_state)) {
+ if (log)
+ log->Printf("ThreadPlanCallFunction(%p): DoTakedown failed to restore "
+ "register state",
+ static_cast<void *>(this));
}
+ SetPlanComplete(success);
+ ClearBreakpoints();
+ if (log && log->GetVerbose())
+ ReportRegisterState("Restoring thread state after function call. "
+ "Restored register state:");
+ } else {
+ if (log)
+ log->Printf("ThreadPlanCallFunction(%p): DoTakedown called as no-op for "
+ "thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
+ static_cast<void *>(this), m_thread.GetID(), m_valid,
+ IsPlanComplete());
+ }
}
-void
-ThreadPlanCallFunction::WillPop ()
-{
- DoTakedown(PlanSucceeded());
-}
+void ThreadPlanCallFunction::WillPop() { DoTakedown(PlanSucceeded()); }
-void
-ThreadPlanCallFunction::GetDescription (Stream *s, DescriptionLevel level)
-{
- if (level == eDescriptionLevelBrief)
- {
- s->Printf("Function call thread plan");
- }
- else
- {
- TargetSP target_sp (m_thread.CalculateTarget());
- s->Printf("Thread plan to call 0x%" PRIx64, m_function_addr.GetLoadAddress(target_sp.get()));
- }
+void ThreadPlanCallFunction::GetDescription(Stream *s, DescriptionLevel level) {
+ if (level == eDescriptionLevelBrief) {
+ s->Printf("Function call thread plan");
+ } else {
+ TargetSP target_sp(m_thread.CalculateTarget());
+ s->Printf("Thread plan to call 0x%" PRIx64,
+ m_function_addr.GetLoadAddress(target_sp.get()));
+ }
}
-bool
-ThreadPlanCallFunction::ValidatePlan (Stream *error)
-{
- if (!m_valid)
- {
- if (error)
- {
- if (m_constructor_errors.GetSize() > 0)
- error->PutCString (m_constructor_errors.GetData());
- else
- error->PutCString ("Unknown error");
- }
- return false;
+bool ThreadPlanCallFunction::ValidatePlan(Stream *error) {
+ if (!m_valid) {
+ if (error) {
+ if (m_constructor_errors.GetSize() > 0)
+ error->PutCString(m_constructor_errors.GetString());
+ else
+ error->PutCString("Unknown error");
}
+ return false;
+ }
- return true;
+ return true;
}
-Vote
-ThreadPlanCallFunction::ShouldReportStop(Event *event_ptr)
-{
- if (m_takedown_done || IsPlanComplete())
- return eVoteYes;
- else
- return ThreadPlan::ShouldReportStop(event_ptr);
+Vote ThreadPlanCallFunction::ShouldReportStop(Event *event_ptr) {
+ if (m_takedown_done || IsPlanComplete())
+ return eVoteYes;
+ else
+ return ThreadPlan::ShouldReportStop(event_ptr);
}
-bool
-ThreadPlanCallFunction::DoPlanExplainsStop (Event *event_ptr)
-{
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP|LIBLLDB_LOG_PROCESS));
- m_real_stop_info_sp = GetPrivateStopInfo ();
-
- // If our subplan knows why we stopped, even if it's done (which would forward the question to us)
- // we answer yes.
- if (m_subplan_sp && m_subplan_sp->PlanExplainsStop(event_ptr))
- {
- SetPlanComplete();
- return true;
- }
-
- // Check if the breakpoint is one of ours.
-
- StopReason stop_reason;
- if (!m_real_stop_info_sp)
- stop_reason = eStopReasonNone;
- else
- stop_reason = m_real_stop_info_sp->GetStopReason();
+bool ThreadPlanCallFunction::DoPlanExplainsStop(Event *event_ptr) {
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP |
+ LIBLLDB_LOG_PROCESS));
+ m_real_stop_info_sp = GetPrivateStopInfo();
+
+ // If our subplan knows why we stopped, even if it's done (which would forward
+ // the question to us)
+ // we answer yes.
+ if (m_subplan_sp && m_subplan_sp->PlanExplainsStop(event_ptr)) {
+ SetPlanComplete();
+ return true;
+ }
+
+ // Check if the breakpoint is one of ours.
+
+ StopReason stop_reason;
+ if (!m_real_stop_info_sp)
+ stop_reason = eStopReasonNone;
+ else
+ stop_reason = m_real_stop_info_sp->GetStopReason();
+ if (log)
+ log->Printf(
+ "ThreadPlanCallFunction::PlanExplainsStop: Got stop reason - %s.",
+ Thread::StopReasonAsCString(stop_reason));
+
+ if (stop_reason == eStopReasonBreakpoint && BreakpointsExplainStop())
+ return true;
+
+ // One more quirk here. If this event was from Halt interrupting the target,
+ // then we should not consider
+ // ourselves complete. Return true to acknowledge the stop.
+ if (Process::ProcessEventData::GetInterruptedFromEvent(event_ptr)) {
if (log)
- log->Printf ("ThreadPlanCallFunction::PlanExplainsStop: Got stop reason - %s.", Thread::StopReasonAsCString(stop_reason));
-
- if (stop_reason == eStopReasonBreakpoint && BreakpointsExplainStop())
- return true;
-
- // One more quirk here. If this event was from Halt interrupting the target, then we should not consider
- // ourselves complete. Return true to acknowledge the stop.
- if (Process::ProcessEventData::GetInterruptedFromEvent(event_ptr))
- {
+ log->Printf("ThreadPlanCallFunction::PlanExplainsStop: The event is an "
+ "Interrupt, returning true.");
+ return true;
+ }
+ // We control breakpoints separately from other "stop reasons." So first,
+ // check the case where we stopped for an internal breakpoint, in that case,
+ // continue on.
+ // If it is not an internal breakpoint, consult m_ignore_breakpoints.
+
+ if (stop_reason == eStopReasonBreakpoint) {
+ ProcessSP process_sp(m_thread.CalculateProcess());
+ uint64_t break_site_id = m_real_stop_info_sp->GetValue();
+ BreakpointSiteSP bp_site_sp;
+ if (process_sp)
+ bp_site_sp = process_sp->GetBreakpointSiteList().FindByID(break_site_id);
+ if (bp_site_sp) {
+ uint32_t num_owners = bp_site_sp->GetNumberOfOwners();
+ bool is_internal = true;
+ for (uint32_t i = 0; i < num_owners; i++) {
+ Breakpoint &bp = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
if (log)
- log->Printf ("ThreadPlanCallFunction::PlanExplainsStop: The event is an Interrupt, returning true.");
- return true;
- }
- // We control breakpoints separately from other "stop reasons." So first,
- // check the case where we stopped for an internal breakpoint, in that case, continue on.
- // If it is not an internal breakpoint, consult m_ignore_breakpoints.
-
- if (stop_reason == eStopReasonBreakpoint)
- {
- ProcessSP process_sp (m_thread.CalculateProcess());
- uint64_t break_site_id = m_real_stop_info_sp->GetValue();
- BreakpointSiteSP bp_site_sp;
- if (process_sp)
- bp_site_sp = process_sp->GetBreakpointSiteList().FindByID(break_site_id);
- if (bp_site_sp)
- {
- uint32_t num_owners = bp_site_sp->GetNumberOfOwners();
- bool is_internal = true;
- for (uint32_t i = 0; i < num_owners; i++)
- {
- Breakpoint &bp = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
- if (log)
- log->Printf ("ThreadPlanCallFunction::PlanExplainsStop: hit breakpoint %d while calling function", bp.GetID());
-
- if (!bp.IsInternal())
- {
- is_internal = false;
- break;
- }
- }
- if (is_internal)
- {
- if (log)
- log->Printf ("ThreadPlanCallFunction::PlanExplainsStop hit an internal breakpoint, not stopping.");
- return false;
- }
- }
+ log->Printf("ThreadPlanCallFunction::PlanExplainsStop: hit "
+ "breakpoint %d while calling function",
+ bp.GetID());
- if (m_ignore_breakpoints)
- {
- if (log)
- log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are ignoring breakpoints, overriding breakpoint stop info ShouldStop, returning true");
- m_real_stop_info_sp->OverrideShouldStop(false);
- return true;
- }
- else
- {
- if (log)
- log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are not ignoring breakpoints, overriding breakpoint stop info ShouldStop, returning true");
- m_real_stop_info_sp->OverrideShouldStop(true);
- return false;
+ if (!bp.IsInternal()) {
+ is_internal = false;
+ break;
}
- }
- else if (!m_unwind_on_error)
- {
- // If we don't want to discard this plan, than any stop we don't understand should be propagated up the stack.
+ }
+ if (is_internal) {
+ if (log)
+ log->Printf("ThreadPlanCallFunction::PlanExplainsStop hit an "
+ "internal breakpoint, not stopping.");
return false;
+ }
}
- else
- {
- // If the subplan is running, any crashes are attributable to us.
- // If we want to discard the plan, then we say we explain the stop
- // but if we are going to be discarded, let whoever is above us
- // explain the stop.
- // But don't discard the plan if the stop would restart itself (for instance if it is a
- // signal that is set not to stop. Check that here first. We just say we explain the stop
- // but aren't done and everything will continue on from there.
-
- if (m_real_stop_info_sp && m_real_stop_info_sp->ShouldStopSynchronous(event_ptr))
- {
- SetPlanComplete(false);
- return m_subplan_sp ? m_unwind_on_error : false;
- }
- else
- return true;
- }
-}
-bool
-ThreadPlanCallFunction::ShouldStop (Event *event_ptr)
-{
- // We do some computation in DoPlanExplainsStop that may or may not set the plan as complete.
- // We need to do that here to make sure our state is correct.
- DoPlanExplainsStop(event_ptr);
-
- if (IsPlanComplete())
- {
- ReportRegisterState ("Function completed. Register state was:");
- return true;
- }
- else
- {
- return false;
+ if (m_ignore_breakpoints) {
+ if (log)
+ log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are ignoring "
+ "breakpoints, overriding breakpoint stop info ShouldStop, "
+ "returning true");
+ m_real_stop_info_sp->OverrideShouldStop(false);
+ return true;
+ } else {
+ if (log)
+ log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are not "
+ "ignoring breakpoints, overriding breakpoint stop info "
+ "ShouldStop, returning true");
+ m_real_stop_info_sp->OverrideShouldStop(true);
+ return false;
}
+ } else if (!m_unwind_on_error) {
+ // If we don't want to discard this plan, than any stop we don't understand
+ // should be propagated up the stack.
+ return false;
+ } else {
+ // If the subplan is running, any crashes are attributable to us.
+ // If we want to discard the plan, then we say we explain the stop
+ // but if we are going to be discarded, let whoever is above us
+ // explain the stop.
+ // But don't discard the plan if the stop would restart itself (for instance
+ // if it is a
+ // signal that is set not to stop. Check that here first. We just say we
+ // explain the stop
+ // but aren't done and everything will continue on from there.
+
+ if (m_real_stop_info_sp &&
+ m_real_stop_info_sp->ShouldStopSynchronous(event_ptr)) {
+ SetPlanComplete(false);
+ return m_subplan_sp ? m_unwind_on_error : false;
+ } else
+ return true;
+ }
}
-bool
-ThreadPlanCallFunction::StopOthers ()
-{
- return m_stop_other_threads;
-}
+bool ThreadPlanCallFunction::ShouldStop(Event *event_ptr) {
+ // We do some computation in DoPlanExplainsStop that may or may not set the
+ // plan as complete.
+ // We need to do that here to make sure our state is correct.
+ DoPlanExplainsStop(event_ptr);
-StateType
-ThreadPlanCallFunction::GetPlanRunState ()
-{
- return eStateRunning;
+ if (IsPlanComplete()) {
+ ReportRegisterState("Function completed. Register state was:");
+ return true;
+ } else {
+ return false;
+ }
}
-void
-ThreadPlanCallFunction::DidPush ()
-{
-//#define SINGLE_STEP_EXPRESSIONS
-
- // Now set the thread state to "no reason" so we don't run with whatever signal was outstanding...
- // Wait till the plan is pushed so we aren't changing the stop info till we're about to run.
-
- GetThread().SetStopInfoToNothing();
-
+bool ThreadPlanCallFunction::StopOthers() { return m_stop_other_threads; }
+
+StateType ThreadPlanCallFunction::GetPlanRunState() { return eStateRunning; }
+
+void ThreadPlanCallFunction::DidPush() {
+ //#define SINGLE_STEP_EXPRESSIONS
+
+ // Now set the thread state to "no reason" so we don't run with whatever
+ // signal was outstanding...
+ // Wait till the plan is pushed so we aren't changing the stop info till we're
+ // about to run.
+
+ GetThread().SetStopInfoToNothing();
+
#ifndef SINGLE_STEP_EXPRESSIONS
- m_subplan_sp.reset(new ThreadPlanRunToAddress(m_thread, m_start_addr, m_stop_other_threads));
-
- m_thread.QueueThreadPlan(m_subplan_sp, false);
- m_subplan_sp->SetPrivate (true);
+ m_subplan_sp.reset(
+ new ThreadPlanRunToAddress(m_thread, m_start_addr, m_stop_other_threads));
+
+ m_thread.QueueThreadPlan(m_subplan_sp, false);
+ m_subplan_sp->SetPrivate(true);
#endif
}
-bool
-ThreadPlanCallFunction::WillStop ()
-{
- return true;
-}
+bool ThreadPlanCallFunction::WillStop() { return true; }
-bool
-ThreadPlanCallFunction::MischiefManaged ()
-{
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+bool ThreadPlanCallFunction::MischiefManaged() {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- if (IsPlanComplete())
- {
- if (log)
- log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.",
- static_cast<void*>(this));
+ if (IsPlanComplete()) {
+ if (log)
+ log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.",
+ static_cast<void *>(this));
- ThreadPlan::MischiefManaged ();
- return true;
- }
- else
- {
- return false;
- }
+ ThreadPlan::MischiefManaged();
+ return true;
+ } else {
+ return false;
+ }
}
-void
-ThreadPlanCallFunction::SetBreakpoints ()
-{
- ProcessSP process_sp (m_thread.CalculateProcess());
- if (m_trap_exceptions && process_sp)
- {
- m_cxx_language_runtime = process_sp->GetLanguageRuntime(eLanguageTypeC_plus_plus);
- m_objc_language_runtime = process_sp->GetLanguageRuntime(eLanguageTypeObjC);
-
- if (m_cxx_language_runtime)
- {
- m_should_clear_cxx_exception_bp = !m_cxx_language_runtime->ExceptionBreakpointsAreSet();
- m_cxx_language_runtime->SetExceptionBreakpoints();
- }
- if (m_objc_language_runtime)
- {
- m_should_clear_objc_exception_bp = !m_objc_language_runtime->ExceptionBreakpointsAreSet();
- m_objc_language_runtime->SetExceptionBreakpoints();
- }
+void ThreadPlanCallFunction::SetBreakpoints() {
+ ProcessSP process_sp(m_thread.CalculateProcess());
+ if (m_trap_exceptions && process_sp) {
+ m_cxx_language_runtime =
+ process_sp->GetLanguageRuntime(eLanguageTypeC_plus_plus);
+ m_objc_language_runtime = process_sp->GetLanguageRuntime(eLanguageTypeObjC);
+
+ if (m_cxx_language_runtime) {
+ m_should_clear_cxx_exception_bp =
+ !m_cxx_language_runtime->ExceptionBreakpointsAreSet();
+ m_cxx_language_runtime->SetExceptionBreakpoints();
+ }
+ if (m_objc_language_runtime) {
+ m_should_clear_objc_exception_bp =
+ !m_objc_language_runtime->ExceptionBreakpointsAreSet();
+ m_objc_language_runtime->SetExceptionBreakpoints();
}
+ }
}
-void
-ThreadPlanCallFunction::ClearBreakpoints ()
-{
- if (m_trap_exceptions)
- {
- if (m_cxx_language_runtime && m_should_clear_cxx_exception_bp)
- m_cxx_language_runtime->ClearExceptionBreakpoints();
- if (m_objc_language_runtime && m_should_clear_objc_exception_bp)
- m_objc_language_runtime->ClearExceptionBreakpoints();
- }
+void ThreadPlanCallFunction::ClearBreakpoints() {
+ if (m_trap_exceptions) {
+ if (m_cxx_language_runtime && m_should_clear_cxx_exception_bp)
+ m_cxx_language_runtime->ClearExceptionBreakpoints();
+ if (m_objc_language_runtime && m_should_clear_objc_exception_bp)
+ m_objc_language_runtime->ClearExceptionBreakpoints();
+ }
}
-bool
-ThreadPlanCallFunction::BreakpointsExplainStop()
-{
- StopInfoSP stop_info_sp = GetPrivateStopInfo ();
-
- if (m_trap_exceptions)
- {
- if ((m_cxx_language_runtime &&
- m_cxx_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp))
- ||(m_objc_language_runtime &&
- m_objc_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp)))
- {
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
- if (log)
- log->Printf ("ThreadPlanCallFunction::BreakpointsExplainStop - Hit an exception breakpoint, setting plan complete.");
-
- SetPlanComplete(false);
-
- // If the user has set the ObjC language breakpoint, it would normally get priority over our internal
- // catcher breakpoint, but in this case we can't let that happen, so force the ShouldStop here.
- stop_info_sp->OverrideShouldStop (true);
- return true;
- }
+bool ThreadPlanCallFunction::BreakpointsExplainStop() {
+ StopInfoSP stop_info_sp = GetPrivateStopInfo();
+
+ if (m_trap_exceptions) {
+ if ((m_cxx_language_runtime &&
+ m_cxx_language_runtime->ExceptionBreakpointsExplainStop(
+ stop_info_sp)) ||
+ (m_objc_language_runtime &&
+ m_objc_language_runtime->ExceptionBreakpointsExplainStop(
+ stop_info_sp))) {
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP));
+ if (log)
+ log->Printf("ThreadPlanCallFunction::BreakpointsExplainStop - Hit an "
+ "exception breakpoint, setting plan complete.");
+
+ SetPlanComplete(false);
+
+ // If the user has set the ObjC language breakpoint, it would normally get
+ // priority over our internal
+ // catcher breakpoint, but in this case we can't let that happen, so force
+ // the ShouldStop here.
+ stop_info_sp->OverrideShouldStop(true);
+ return true;
}
-
- return false;
+ }
+
+ return false;
}
-void
-ThreadPlanCallFunction::SetStopOthers (bool new_value)
-{
- m_subplan_sp->SetStopOthers(new_value);
+void ThreadPlanCallFunction::SetStopOthers(bool new_value) {
+ m_subplan_sp->SetStopOthers(new_value);
}
-bool
-ThreadPlanCallFunction::RestoreThreadState()
-{
- return GetThread().RestoreThreadStateFromCheckpoint(m_stored_thread_state);
+bool ThreadPlanCallFunction::RestoreThreadState() {
+ return GetThread().RestoreThreadStateFromCheckpoint(m_stored_thread_state);
}
-void
-ThreadPlanCallFunction::SetReturnValue()
-{
- ProcessSP process_sp(m_thread.GetProcess());
- const ABI *abi = process_sp ? process_sp->GetABI().get() : nullptr;
- if (abi && m_return_type.IsValid())
- {
- const bool persistent = false;
- m_return_valobj_sp = abi->GetReturnValueObject(m_thread, m_return_type, persistent);
- }
+void ThreadPlanCallFunction::SetReturnValue() {
+ ProcessSP process_sp(m_thread.GetProcess());
+ const ABI *abi = process_sp ? process_sp->GetABI().get() : nullptr;
+ if (abi && m_return_type.IsValid()) {
+ const bool persistent = false;
+ m_return_valobj_sp =
+ abi->GetReturnValueObject(m_thread, m_return_type, persistent);
+ }
}
OpenPOWER on IntegriCloud