003 File Manager
Current Path:
/usr/src/contrib/llvm-project/lldb/source/Target
usr
/
src
/
contrib
/
llvm-project
/
lldb
/
source
/
Target
/
📁
..
📄
ABI.cpp
(9.36 KB)
📄
AssertFrameRecognizer.cpp
(5.4 KB)
📄
ExecutionContext.cpp
(18.19 KB)
📄
InstrumentationRuntime.cpp
(2.38 KB)
📄
InstrumentationRuntimeStopInfo.cpp
(1.2 KB)
📄
JITLoader.cpp
(1.07 KB)
📄
JITLoaderList.cpp
(1.94 KB)
📄
Language.cpp
(12.97 KB)
📄
LanguageRuntime.cpp
(9.71 KB)
📄
Memory.cpp
(15.12 KB)
📄
MemoryHistory.cpp
(943 B)
📄
MemoryRegionInfo.cpp
(1.55 KB)
📄
ModuleCache.cpp
(11.87 KB)
📄
OperatingSystem.cpp
(1.74 KB)
📄
PathMappingList.cpp
(9.73 KB)
📄
Platform.cpp
(66.82 KB)
📄
Process.cpp
(221.69 KB)
📄
Queue.cpp
(2.52 KB)
📄
QueueItem.cpp
(3 KB)
📄
QueueList.cpp
(1.68 KB)
📄
RegisterContext.cpp
(15.76 KB)
📄
RegisterContextUnwind.cpp
(86.86 KB)
📄
RegisterNumber.cpp
(3.34 KB)
📄
RemoteAwarePlatform.cpp
(16.06 KB)
📄
SectionLoadHistory.cpp
(6.39 KB)
📄
SectionLoadList.cpp
(9.57 KB)
📄
StackFrame.cpp
(70.8 KB)
📄
StackFrameList.cpp
(34.82 KB)
📄
StackFrameRecognizer.cpp
(7.27 KB)
📄
StackID.cpp
(3.39 KB)
📄
StopInfo.cpp
(44.17 KB)
📄
StructuredDataPlugin.cpp
(2.35 KB)
📄
SystemRuntime.cpp
(1.54 KB)
📄
Target.cpp
(146.79 KB)
📄
TargetList.cpp
(22.59 KB)
📄
TargetProperties.td
(15.71 KB)
📄
Thread.cpp
(70.22 KB)
📄
ThreadCollection.cpp
(2.18 KB)
📄
ThreadList.cpp
(24.9 KB)
📄
ThreadPlan.cpp
(9.54 KB)
📄
ThreadPlanBase.cpp
(6.32 KB)
📄
ThreadPlanCallFunction.cpp
(16.54 KB)
📄
ThreadPlanCallFunctionUsingABI.cpp
(2.35 KB)
📄
ThreadPlanCallOnFunctionExit.cpp
(3.3 KB)
📄
ThreadPlanCallUserExpression.cpp
(3.77 KB)
📄
ThreadPlanPython.cpp
(5.94 KB)
📄
ThreadPlanRunToAddress.cpp
(6.53 KB)
📄
ThreadPlanShouldStopHere.cpp
(5.82 KB)
📄
ThreadPlanStack.cpp
(14.76 KB)
📄
ThreadPlanStepInRange.cpp
(18.45 KB)
📄
ThreadPlanStepInstruction.cpp
(8.78 KB)
📄
ThreadPlanStepOut.cpp
(18.25 KB)
📄
ThreadPlanStepOverBreakpoint.cpp
(6.63 KB)
📄
ThreadPlanStepOverRange.cpp
(16.61 KB)
📄
ThreadPlanStepRange.cpp
(18.23 KB)
📄
ThreadPlanStepThrough.cpp
(8.79 KB)
📄
ThreadPlanStepUntil.cpp
(11.14 KB)
📄
ThreadPlanTracer.cpp
(7.78 KB)
📄
ThreadSpec.cpp
(4.46 KB)
📄
UnixSignals.cpp
(11.04 KB)
📄
UnwindAssembly.cpp
(1.09 KB)
📄
UnwindLLDB.cpp
(19.02 KB)
Editing: ThreadPlanPython.cpp
//===-- ThreadPlanPython.cpp ----------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "lldb/Target/ThreadPlan.h" #include "lldb/Core/Debugger.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/ScriptInterpreter.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanPython.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/State.h" using namespace lldb; using namespace lldb_private; // ThreadPlanPython ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name, StructuredDataImpl *args_data) : ThreadPlan(ThreadPlan::eKindPython, "Python based Thread Plan", thread, eVoteNoOpinion, eVoteNoOpinion), m_class_name(class_name), m_args_data(args_data), m_did_push(false) { SetIsMasterPlan(true); SetOkayToDiscard(true); SetPrivate(false); } ThreadPlanPython::~ThreadPlanPython() { // FIXME, do I need to decrement the ref count on this implementation object // to make it go away? } bool ThreadPlanPython::ValidatePlan(Stream *error) { if (!m_did_push) return true; if (!m_implementation_sp) { if (error) error->Printf("Error constructing Python ThreadPlan: %s", m_error_str.empty() ? "<unknown error>" : m_error_str.c_str()); return false; } return true; } ScriptInterpreter *ThreadPlanPython::GetScriptInterpreter() { return m_process.GetTarget().GetDebugger().GetScriptInterpreter(); } void ThreadPlanPython::DidPush() { // We set up the script side in DidPush, so that it can push other plans in // the constructor, and doesn't have to care about the details of DidPush. m_did_push = true; if (!m_class_name.empty()) { ScriptInterpreter *script_interp = GetScriptInterpreter(); if (script_interp) { m_implementation_sp = script_interp->CreateScriptedThreadPlan( m_class_name.c_str(), m_args_data, m_error_str, this->shared_from_this()); } } } bool ThreadPlanPython::ShouldStop(Event *event_ptr) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); bool should_stop = true; if (m_implementation_sp) { ScriptInterpreter *script_interp = GetScriptInterpreter(); if (script_interp) { bool script_error; should_stop = script_interp->ScriptedThreadPlanShouldStop( m_implementation_sp, event_ptr, script_error); if (script_error) SetPlanComplete(false); } } return should_stop; } bool ThreadPlanPython::IsPlanStale() { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); bool is_stale = true; if (m_implementation_sp) { ScriptInterpreter *script_interp = GetScriptInterpreter(); if (script_interp) { bool script_error; is_stale = script_interp->ScriptedThreadPlanIsStale(m_implementation_sp, script_error); if (script_error) SetPlanComplete(false); } } return is_stale; } bool ThreadPlanPython::DoPlanExplainsStop(Event *event_ptr) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); bool explains_stop = true; if (m_implementation_sp) { ScriptInterpreter *script_interp = GetScriptInterpreter(); if (script_interp) { bool script_error; explains_stop = script_interp->ScriptedThreadPlanExplainsStop( m_implementation_sp, event_ptr, script_error); if (script_error) SetPlanComplete(false); } } return explains_stop; } bool ThreadPlanPython::MischiefManaged() { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); bool mischief_managed = true; if (m_implementation_sp) { // I don't really need mischief_managed, since it's simpler to just call // SetPlanComplete in should_stop. mischief_managed = IsPlanComplete(); if (mischief_managed) m_implementation_sp.reset(); } return mischief_managed; } lldb::StateType ThreadPlanPython::GetPlanRunState() { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); lldb::StateType run_state = eStateRunning; if (m_implementation_sp) { ScriptInterpreter *script_interp = GetScriptInterpreter(); if (script_interp) { bool script_error; run_state = script_interp->ScriptedThreadPlanGetRunState( m_implementation_sp, script_error); } } return run_state; } // The ones below are not currently exported to Python. bool ThreadPlanPython::StopOthers() { // For now Python plans run all threads, but we should add some controls for // this. return false; } void ThreadPlanPython::GetDescription(Stream *s, lldb::DescriptionLevel level) { s->Printf("Python thread plan implemented by class %s.", m_class_name.c_str()); } bool ThreadPlanPython::WillStop() { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); return true; }
Upload File
Create Folder