diff options
Diffstat (limited to 'source/API')
32 files changed, 1433 insertions, 747 deletions
diff --git a/source/API/SBAddress.cpp b/source/API/SBAddress.cpp index d6e32b6..f95fcb8 100644 --- a/source/API/SBAddress.cpp +++ b/source/API/SBAddress.cpp @@ -14,7 +14,9 @@ #include "lldb/Core/Address.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" +#include "lldb/Core/StreamString.h" #include "lldb/Host/Mutex.h" +#include "lldb/Symbol/LineEntry.h" #include "lldb/Target/Target.h" diff --git a/source/API/SBAttachInfo.cpp b/source/API/SBAttachInfo.cpp new file mode 100644 index 0000000..07446df --- /dev/null +++ b/source/API/SBAttachInfo.cpp @@ -0,0 +1,242 @@ +//===-- SBAttachInfo.cpp ----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/API/SBAttachInfo.h" + +#include "lldb/API/SBFileSpec.h" +#include "lldb/API/SBListener.h" +#include "lldb/Target/Process.h" + +using namespace lldb; +using namespace lldb_private; + + +SBAttachInfo::SBAttachInfo () : + m_opaque_sp (new ProcessAttachInfo()) +{ +} + +SBAttachInfo::SBAttachInfo (lldb::pid_t pid) : + m_opaque_sp (new ProcessAttachInfo()) +{ + m_opaque_sp->SetProcessID (pid); +} + +SBAttachInfo::SBAttachInfo (const char *path, bool wait_for) : + m_opaque_sp (new ProcessAttachInfo()) +{ + if (path && path[0]) + m_opaque_sp->GetExecutableFile().SetFile(path, false); + m_opaque_sp->SetWaitForLaunch (wait_for); +} + +SBAttachInfo::SBAttachInfo (const SBAttachInfo &rhs) : + m_opaque_sp (new ProcessAttachInfo()) +{ + *m_opaque_sp = *rhs.m_opaque_sp; +} + +SBAttachInfo::~SBAttachInfo() +{ +} + +lldb_private::ProcessAttachInfo & +SBAttachInfo::ref () +{ + return *m_opaque_sp; +} + +SBAttachInfo & +SBAttachInfo::operator = (const SBAttachInfo &rhs) +{ + if (this != &rhs) + *m_opaque_sp = *rhs.m_opaque_sp; + return *this; +} + +lldb::pid_t +SBAttachInfo::GetProcessID () +{ + return m_opaque_sp->GetProcessID(); +} + +void +SBAttachInfo::SetProcessID (lldb::pid_t pid) +{ + m_opaque_sp->SetProcessID (pid); +} + + +uint32_t +SBAttachInfo::GetResumeCount () +{ + return m_opaque_sp->GetResumeCount(); +} + +void +SBAttachInfo::SetResumeCount (uint32_t c) +{ + m_opaque_sp->SetResumeCount (c); +} + +const char * +SBAttachInfo::GetProcessPluginName () +{ + return m_opaque_sp->GetProcessPluginName(); +} + +void +SBAttachInfo::SetProcessPluginName (const char *plugin_name) +{ + return m_opaque_sp->SetProcessPluginName (plugin_name); +} + +void +SBAttachInfo::SetExecutable (const char *path) +{ + if (path && path[0]) + m_opaque_sp->GetExecutableFile().SetFile(path, false); + else + m_opaque_sp->GetExecutableFile().Clear(); +} + +void +SBAttachInfo::SetExecutable (SBFileSpec exe_file) +{ + if (exe_file.IsValid()) + m_opaque_sp->GetExecutableFile() = exe_file.ref(); + else + m_opaque_sp->GetExecutableFile().Clear(); +} + +bool +SBAttachInfo::GetWaitForLaunch () +{ + return m_opaque_sp->GetWaitForLaunch(); +} + +void +SBAttachInfo::SetWaitForLaunch (bool b) +{ + m_opaque_sp->SetWaitForLaunch (b); +} + +bool +SBAttachInfo::GetIgnoreExisting () +{ + return m_opaque_sp->GetIgnoreExisting(); +} + +void +SBAttachInfo::SetIgnoreExisting (bool b) +{ + m_opaque_sp->SetIgnoreExisting (b); +} + +uint32_t +SBAttachInfo::GetUserID() +{ + return m_opaque_sp->GetUserID(); +} + +uint32_t +SBAttachInfo::GetGroupID() +{ + return m_opaque_sp->GetGroupID(); +} + +bool +SBAttachInfo::UserIDIsValid () +{ + return m_opaque_sp->UserIDIsValid(); +} + +bool +SBAttachInfo::GroupIDIsValid () +{ + return m_opaque_sp->GroupIDIsValid(); +} + +void +SBAttachInfo::SetUserID (uint32_t uid) +{ + m_opaque_sp->SetUserID (uid); +} + +void +SBAttachInfo::SetGroupID (uint32_t gid) +{ + m_opaque_sp->SetGroupID (gid); +} + +uint32_t +SBAttachInfo::GetEffectiveUserID() +{ + return m_opaque_sp->GetEffectiveUserID(); +} + +uint32_t +SBAttachInfo::GetEffectiveGroupID() +{ + return m_opaque_sp->GetEffectiveGroupID(); +} + +bool +SBAttachInfo::EffectiveUserIDIsValid () +{ + return m_opaque_sp->EffectiveUserIDIsValid(); +} + +bool +SBAttachInfo::EffectiveGroupIDIsValid () +{ + return m_opaque_sp->EffectiveGroupIDIsValid (); +} + +void +SBAttachInfo::SetEffectiveUserID (uint32_t uid) +{ + m_opaque_sp->SetEffectiveUserID(uid); +} + +void +SBAttachInfo::SetEffectiveGroupID (uint32_t gid) +{ + m_opaque_sp->SetEffectiveGroupID(gid); +} + +lldb::pid_t +SBAttachInfo::GetParentProcessID () +{ + return m_opaque_sp->GetParentProcessID(); +} + +void +SBAttachInfo::SetParentProcessID (lldb::pid_t pid) +{ + m_opaque_sp->SetParentProcessID (pid); +} + +bool +SBAttachInfo::ParentProcessIDIsValid() +{ + return m_opaque_sp->ParentProcessIDIsValid(); +} + +SBListener +SBAttachInfo::GetListener () +{ + return SBListener(m_opaque_sp->GetListener()); +} + +void +SBAttachInfo::SetListener (SBListener &listener) +{ + m_opaque_sp->SetListener(listener.GetSP()); +} diff --git a/source/API/SBCommandInterpreter.cpp b/source/API/SBCommandInterpreter.cpp index 193d06e..d901e72 100644 --- a/source/API/SBCommandInterpreter.cpp +++ b/source/API/SBCommandInterpreter.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/lldb-types.h" #include "lldb/Core/SourceManager.h" #include "lldb/Core/Listener.h" @@ -20,6 +18,7 @@ #include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBCommandReturnObject.h" #include "lldb/API/SBCommandInterpreter.h" +#include "lldb/API/SBEvent.h" #include "lldb/API/SBExecutionContext.h" #include "lldb/API/SBProcess.h" #include "lldb/API/SBTarget.h" @@ -446,6 +445,37 @@ SBCommandInterpreter::GetDebugger () return sb_debugger; } +bool +SBCommandInterpreter::GetPromptOnQuit() +{ + if (m_opaque_ptr) + return m_opaque_ptr->GetPromptOnQuit(); + return false; +} + +void +SBCommandInterpreter::SetPromptOnQuit (bool b) +{ + if (m_opaque_ptr) + m_opaque_ptr->SetPromptOnQuit(b); +} + +void +SBCommandInterpreter::ResolveCommand(const char *command_line, SBCommandReturnObject &result) +{ + result.Clear(); + if (command_line && m_opaque_ptr) + { + m_opaque_ptr->ResolveCommand(command_line, result.ref()); + } + else + { + result->AppendError("SBCommandInterpreter or the command line is not valid"); + result->SetStatus(eReturnStatusFailed); + } +} + + CommandInterpreter * SBCommandInterpreter::get () { @@ -532,7 +562,7 @@ SBCommandInterpreter::GetBroadcaster () const char * SBCommandInterpreter::GetBroadcasterClass () { - return Communication::GetStaticBroadcasterClass().AsCString(); + return CommandInterpreter::GetStaticBroadcasterClass().AsCString(); } const char * @@ -548,6 +578,12 @@ SBCommandInterpreter::GetArgumentDescriptionAsCString (const lldb::CommandArgume } bool +SBCommandInterpreter::EventIsCommandInterpreterEvent (const lldb::SBEvent &event) +{ + return event.GetBroadcasterClass() == SBCommandInterpreter::GetBroadcasterClass(); +} + +bool SBCommandInterpreter::SetCommandOverrideCallback (const char *command_name, lldb::CommandOverrideCallback callback, void *baton) @@ -566,170 +602,6 @@ SBCommandInterpreter::SetCommandOverrideCallback (const char *command_name, return false; } -#ifndef LLDB_DISABLE_PYTHON - -// Defined in the SWIG source file -extern "C" void -init_lldb(void); - -// these are the Pythonic implementations of the required callbacks -// these are scripting-language specific, which is why they belong here -// we still need to use function pointers to them instead of relying -// on linkage-time resolution because the SWIG stuff and this file -// get built at different times -extern "C" bool -LLDBSwigPythonBreakpointCallbackFunction (const char *python_function_name, - const char *session_dictionary_name, - const lldb::StackFrameSP& sb_frame, - const lldb::BreakpointLocationSP& sb_bp_loc); - -extern "C" bool -LLDBSwigPythonWatchpointCallbackFunction (const char *python_function_name, - const char *session_dictionary_name, - const lldb::StackFrameSP& sb_frame, - const lldb::WatchpointSP& sb_wp); - -extern "C" bool -LLDBSwigPythonCallTypeScript (const char *python_function_name, - void *session_dictionary, - const lldb::ValueObjectSP& valobj_sp, - void** pyfunct_wrapper, - const lldb::TypeSummaryOptionsSP& options_sp, - std::string& retval); - -extern "C" void* -LLDBSwigPythonCreateSyntheticProvider (const char *python_class_name, - const char *session_dictionary_name, - const lldb::ValueObjectSP& valobj_sp); - - -extern "C" void* -LLDBSwigPythonCreateScriptedThreadPlan (const char *python_class_name, - const char *session_dictionary_name, - const lldb::ThreadPlanSP& thread_plan_sp); - -extern "C" bool -LLDBSWIGPythonCallThreadPlan (void *implementor, - const char *method_name, - Event *event_sp, - bool &got_error); - -extern "C" uint32_t -LLDBSwigPython_CalculateNumChildren (void *implementor); - -extern "C" void * -LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx); - -extern "C" int -LLDBSwigPython_GetIndexOfChildWithName (void *implementor, const char* child_name); - -extern "C" void * -LLDBSWIGPython_CastPyObjectToSBValue (void* data); - -extern lldb::ValueObjectSP -LLDBSWIGPython_GetValueObjectSPFromSBValue (void* data); - -extern "C" bool -LLDBSwigPython_UpdateSynthProviderInstance (void* implementor); - -extern "C" bool -LLDBSwigPython_MightHaveChildrenSynthProviderInstance (void* implementor); - -extern "C" void * -LLDBSwigPython_GetValueSynthProviderInstance (void* implementor); - -extern "C" bool -LLDBSwigPythonCallCommand (const char *python_function_name, - const char *session_dictionary_name, - lldb::DebuggerSP& debugger, - const char* args, - lldb_private::CommandReturnObject &cmd_retobj, - lldb::ExecutionContextRefSP exe_ctx_ref_sp); - -extern "C" bool -LLDBSwigPythonCallModuleInit (const char *python_module_name, - const char *session_dictionary_name, - lldb::DebuggerSP& debugger); - -extern "C" void* -LLDBSWIGPythonCreateOSPlugin (const char *python_class_name, - const char *session_dictionary_name, - const lldb::ProcessSP& process_sp); - -extern "C" bool -LLDBSWIGPythonRunScriptKeywordProcess (const char* python_function_name, - const char* session_dictionary_name, - lldb::ProcessSP& process, - std::string& output); - -extern "C" bool -LLDBSWIGPythonRunScriptKeywordThread (const char* python_function_name, - const char* session_dictionary_name, - lldb::ThreadSP& thread, - std::string& output); - -extern "C" bool -LLDBSWIGPythonRunScriptKeywordTarget (const char* python_function_name, - const char* session_dictionary_name, - lldb::TargetSP& target, - std::string& output); - -extern "C" bool -LLDBSWIGPythonRunScriptKeywordFrame (const char* python_function_name, - const char* session_dictionary_name, - lldb::StackFrameSP& frame, - std::string& output); - -extern "C" bool -LLDBSWIGPythonRunScriptKeywordValue (const char* python_function_name, - const char* session_dictionary_name, - lldb::ValueObjectSP& value, - std::string& output); - -extern "C" void* -LLDBSWIGPython_GetDynamicSetting (void* module, - const char* setting, - const lldb::TargetSP& target_sp); - - -#endif - -void -SBCommandInterpreter::InitializeSWIG () -{ - static bool g_initialized = false; - if (!g_initialized) - { - g_initialized = true; -#ifndef LLDB_DISABLE_PYTHON - ScriptInterpreter::InitializeInterpreter (init_lldb, - LLDBSwigPythonBreakpointCallbackFunction, - LLDBSwigPythonWatchpointCallbackFunction, - LLDBSwigPythonCallTypeScript, - LLDBSwigPythonCreateSyntheticProvider, - LLDBSwigPython_CalculateNumChildren, - LLDBSwigPython_GetChildAtIndex, - LLDBSwigPython_GetIndexOfChildWithName, - LLDBSWIGPython_CastPyObjectToSBValue, - LLDBSWIGPython_GetValueObjectSPFromSBValue, - LLDBSwigPython_UpdateSynthProviderInstance, - LLDBSwigPython_MightHaveChildrenSynthProviderInstance, - LLDBSwigPython_GetValueSynthProviderInstance, - LLDBSwigPythonCallCommand, - LLDBSwigPythonCallModuleInit, - LLDBSWIGPythonCreateOSPlugin, - LLDBSWIGPythonRunScriptKeywordProcess, - LLDBSWIGPythonRunScriptKeywordThread, - LLDBSWIGPythonRunScriptKeywordTarget, - LLDBSWIGPythonRunScriptKeywordFrame, - LLDBSWIGPythonRunScriptKeywordValue, - LLDBSWIGPython_GetDynamicSetting, - LLDBSwigPythonCreateScriptedThreadPlan, - LLDBSWIGPythonCallThreadPlan); -#endif - } -} - lldb::SBCommand SBCommandInterpreter::AddMultiwordCommand (const char* name, const char* help) { @@ -780,6 +652,28 @@ SBCommand::GetHelp () return NULL; } +const char* +SBCommand::GetHelpLong () +{ + if (IsValid ()) + return m_opaque_sp->GetHelpLong (); + return NULL; +} + +void +SBCommand::SetHelp (const char* help) +{ + if (IsValid()) + m_opaque_sp->SetHelp(help); +} + +void +SBCommand::SetHelpLong (const char* help) +{ + if (IsValid()) + m_opaque_sp->SetHelpLong(help); +} + lldb::SBCommand SBCommand::AddMultiwordCommand (const char* name, const char* help) { @@ -809,3 +703,17 @@ SBCommand::AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, c return lldb::SBCommand(); } +uint32_t +SBCommand::GetFlags () +{ + if (!IsValid()) + return 0; + return m_opaque_sp->GetFlags().Get(); +} + +void +SBCommand::SetFlags (uint32_t flags) +{ + if (IsValid()) + m_opaque_sp->GetFlags().Set(flags); +} diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp index a95f2ff..df2019f 100644 --- a/source/API/SBDebugger.cpp +++ b/source/API/SBDebugger.cpp @@ -7,12 +7,11 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBDebugger.h" #include "lldb/lldb-private.h" +#include "lldb/API/SystemInitializerFull.h" #include "lldb/API/SBListener.h" #include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBCommandInterpreter.h" @@ -33,46 +32,24 @@ #include "lldb/API/SBTypeSummary.h" #include "lldb/API/SBTypeSynthetic.h" - #include "lldb/Core/Debugger.h" #include "lldb/Core/State.h" #include "lldb/Core/StreamFile.h" #include "lldb/DataFormatters/DataVisualization.h" +#include "lldb/Initialization/SystemLifetimeManager.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/OptionGroupPlatform.h" #include "lldb/Target/Process.h" #include "lldb/Target/TargetList.h" +#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/DynamicLibrary.h" using namespace lldb; using namespace lldb_private; -SBInputReader::SBInputReader() -{ -} -SBInputReader::~SBInputReader() -{ -} - -SBError -SBInputReader::Initialize(lldb::SBDebugger& sb_debugger, unsigned long (*)(void*, lldb::SBInputReader*, lldb::InputReaderAction, char const*, unsigned long), void*, lldb::InputReaderGranularity, char const*, char const*, bool) -{ - return SBError(); -} - -void -SBInputReader::SetIsDone(bool) -{ -} -bool -SBInputReader::IsActive() const -{ - return false; -} - static llvm::sys::DynamicLibrary LoadPlugin (const lldb::DebuggerSP &debugger_sp, const FileSpec& spec, Error& error) { @@ -107,6 +84,34 @@ LoadPlugin (const lldb::DebuggerSP &debugger_sp, const FileSpec& spec, Error& er return llvm::sys::DynamicLibrary(); } +static llvm::ManagedStatic<SystemLifetimeManager> g_debugger_lifetime; + +SBInputReader::SBInputReader() +{ +} +SBInputReader::~SBInputReader() +{ +} + +SBError +SBInputReader::Initialize(lldb::SBDebugger &sb_debugger, + unsigned long (*)(void *, lldb::SBInputReader *, lldb::InputReaderAction, char const *, + unsigned long), + void *, lldb::InputReaderGranularity, char const *, char const *, bool) +{ + return SBError(); +} + +void +SBInputReader::SetIsDone(bool) +{ +} +bool +SBInputReader::IsActive() const +{ + return false; +} + void SBDebugger::Initialize () { @@ -115,15 +120,13 @@ SBDebugger::Initialize () if (log) log->Printf ("SBDebugger::Initialize ()"); - SBCommandInterpreter::InitializeSWIG (); - - Debugger::Initialize(LoadPlugin); + g_debugger_lifetime->Initialize(llvm::make_unique<SystemInitializerFull>(), LoadPlugin); } void SBDebugger::Terminate () { - Debugger::Terminate(); + g_debugger_lifetime->Terminate(); } void diff --git a/source/API/SBEvent.cpp b/source/API/SBEvent.cpp index c62c495..164636d 100644 --- a/source/API/SBEvent.cpp +++ b/source/API/SBEvent.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBEvent.h" #include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBStream.h" diff --git a/source/API/SBExpressionOptions.cpp b/source/API/SBExpressionOptions.cpp index 448ff4c..43b7d03 100644 --- a/source/API/SBExpressionOptions.cpp +++ b/source/API/SBExpressionOptions.cpp @@ -185,6 +185,17 @@ SBExpressionOptions::SetSuppressPersistentResult (bool b) return m_opaque_ap->SetResultIsInternal (b); } +const char * +SBExpressionOptions::GetPrefix () const +{ + return m_opaque_ap->GetPrefix(); +} + +void +SBExpressionOptions::SetPrefix (const char *prefix) +{ + return m_opaque_ap->SetPrefix(prefix); +} EvaluateExpressionOptions * SBExpressionOptions::get() const diff --git a/source/API/SBFileSpec.cpp b/source/API/SBFileSpec.cpp index 8d63fc5..dd7435d 100644 --- a/source/API/SBFileSpec.cpp +++ b/source/API/SBFileSpec.cpp @@ -93,9 +93,8 @@ SBFileSpec::ResolvePath (const char *src_path, char *dst_path, size_t dst_len) { llvm::SmallString<64> result(src_path); lldb_private::FileSpec::Resolve (result); - size_t result_length = std::min(dst_len-1, result.size()); - ::strncpy(dst_path, result.c_str(), result_length + 1); - return result_length; + ::snprintf(dst_path, dst_len, "%s", result.c_str()); + return std::min(dst_len-1, result.size()); } const char * @@ -120,18 +119,19 @@ SBFileSpec::GetFilename() const const char * SBFileSpec::GetDirectory() const { - const char *s = m_opaque_ap->GetDirectory().AsCString(); + FileSpec directory{*m_opaque_ap}; + directory.GetFilename().Clear(); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { - if (s) + if (directory) log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"", - static_cast<void*>(m_opaque_ap.get()), s); + static_cast<void*>(m_opaque_ap.get()), directory.GetCString()); else log->Printf ("SBFileSpec(%p)::GetDirectory () => NULL", static_cast<void*>(m_opaque_ap.get())); } - return s; + return directory.GetCString(); } void diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp index 325f40f..e845aef 100644 --- a/source/API/SBFrame.cpp +++ b/source/API/SBFrame.cpp @@ -21,6 +21,7 @@ #include "lldb/Core/StreamFile.h" #include "lldb/Core/ValueObjectRegister.h" #include "lldb/Core/ValueObjectVariable.h" +#include "lldb/Expression/ClangPersistentVariables.h" #include "lldb/Expression/ClangUserExpression.h" #include "lldb/Host/Host.h" #include "lldb/Symbol/Block.h" @@ -44,6 +45,7 @@ #include "lldb/API/SBStream.h" #include "lldb/API/SBSymbolContext.h" #include "lldb/API/SBThread.h" +#include "lldb/API/SBVariablesOptions.h" using namespace lldb; using namespace lldb_private; @@ -452,6 +454,17 @@ SBFrame::GetFrameID () const return frame_idx; } +lldb::addr_t +SBFrame::GetCFA () const +{ + ExecutionContext exe_ctx(m_opaque_sp.get()); + StackFrame *frame = exe_ctx.GetFramePtr(); + if (frame) + return frame->GetStackID().GetCallFrameAddress(); + return LLDB_INVALID_ADDRESS; +} + + addr_t SBFrame::GetPC () const { @@ -868,32 +881,30 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy case eValueTypeVariableArgument: // function argument variables case eValueTypeVariableLocal: // function local variables { - SymbolContext sc (frame->GetSymbolContext (eSymbolContextBlock)); + SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock)); const bool can_create = true; const bool get_parent_variables = true; const bool stop_if_block_is_inlined_function = true; - if (sc.block && sc.block->AppendVariables (can_create, - get_parent_variables, - stop_if_block_is_inlined_function, - &variable_list)) + if (sc.block) + sc.block->AppendVariables(can_create, + get_parent_variables, + stop_if_block_is_inlined_function, + &variable_list); + if (value_type == eValueTypeVariableGlobal) { - if (value_type == eValueTypeVariableGlobal) - { - const bool get_file_globals = true; - VariableList* frame_vars = frame->GetVariableList(get_file_globals); - if (frame_vars) - frame_vars->AppendVariablesIfUnique(variable_list); - } - ConstString const_name(name); - VariableSP variable_sp(variable_list.FindVariable(const_name,value_type)); - if (variable_sp) - { - value_sp = frame->GetValueObjectForFrameVariable (variable_sp, eNoDynamicValues); - sb_value.SetSP (value_sp, use_dynamic); - break; - } + const bool get_file_globals = true; + VariableList *frame_vars = frame->GetVariableList(get_file_globals); + if (frame_vars) + frame_vars->AppendVariablesIfUnique(variable_list); + } + ConstString const_name(name); + VariableSP variable_sp(variable_list.FindVariable(const_name, value_type)); + if (variable_sp) + { + value_sp = frame->GetValueObjectForFrameVariable(variable_sp, eNoDynamicValues); + sb_value.SetSP(value_sp, use_dynamic); } } break; @@ -1075,18 +1086,44 @@ SBFrame::GetVariables (bool arguments, if (frame && target) { lldb::DynamicValueType use_dynamic = frame->CalculateTarget()->GetPreferDynamicValue(); - value_list = GetVariables (arguments, locals, statics, in_scope_only, use_dynamic); + const bool include_runtime_support_values = target ? target->GetDisplayRuntimeSupportValues() : false; + + SBVariablesOptions options; + options.SetIncludeArguments(arguments); + options.SetIncludeLocals(locals); + options.SetIncludeStatics(statics); + options.SetInScopeOnly(in_scope_only); + options.SetIncludeRuntimeSupportValues(include_runtime_support_values); + options.SetUseDynamic(use_dynamic); + + value_list = GetVariables (options); } return value_list; } -SBValueList +lldb::SBValueList SBFrame::GetVariables (bool arguments, bool locals, bool statics, bool in_scope_only, lldb::DynamicValueType use_dynamic) { + ExecutionContext exe_ctx(m_opaque_sp.get()); + Target *target = exe_ctx.GetTargetPtr(); + const bool include_runtime_support_values = target ? target->GetDisplayRuntimeSupportValues() : false; + SBVariablesOptions options; + options.SetIncludeArguments(arguments); + options.SetIncludeLocals(locals); + options.SetIncludeStatics(statics); + options.SetInScopeOnly(in_scope_only); + options.SetIncludeRuntimeSupportValues(include_runtime_support_values); + options.SetUseDynamic(use_dynamic); + return GetVariables(options); +} + +SBValueList +SBFrame::GetVariables (const lldb::SBVariablesOptions& options) +{ Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBValueList value_list; @@ -1096,10 +1133,19 @@ SBFrame::GetVariables (bool arguments, StackFrame *frame = NULL; Target *target = exe_ctx.GetTargetPtr(); + const bool statics = options.GetIncludeStatics(); + const bool arguments = options.GetIncludeArguments(); + const bool locals = options.GetIncludeLocals(); + const bool in_scope_only = options.GetInScopeOnly(); + const bool include_runtime_support_values = options.GetIncludeRuntimeSupportValues(); + const lldb::DynamicValueType use_dynamic = options.GetUseDynamic(); + if (log) - log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)", - arguments, locals, statics, in_scope_only); - + log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i runtime=%i dynamic=%i)", + arguments, locals, + statics, in_scope_only, + include_runtime_support_values, use_dynamic); + Process *process = exe_ctx.GetProcessPtr(); if (target && process) { @@ -1147,6 +1193,12 @@ SBFrame::GetVariables (bool arguments, continue; ValueObjectSP valobj_sp(frame->GetValueObjectForFrameVariable (variable_sp, eNoDynamicValues)); + + if (false == include_runtime_support_values && + valobj_sp && + true == valobj_sp->IsRuntimeSupportValue()) + continue; + SBValue value_sb; value_sb.SetSP(valobj_sp,use_dynamic); value_list.Append(value_sb); @@ -1449,6 +1501,12 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option bool SBFrame::IsInlined() { + return static_cast<const SBFrame*>(this)->IsInlined(); +} + +bool +SBFrame::IsInlined() const +{ Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); ExecutionContext exe_ctx(m_opaque_sp.get()); StackFrame *frame = NULL; @@ -1486,6 +1544,12 @@ SBFrame::IsInlined() const char * SBFrame::GetFunctionName() { + return static_cast<const SBFrame*>(this)->GetFunctionName(); +} + +const char * +SBFrame::GetFunctionName() const +{ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); const char *name = NULL; ExecutionContext exe_ctx(m_opaque_sp.get()); @@ -1538,4 +1602,3 @@ SBFrame::GetFunctionName() } return name; } - diff --git a/source/API/SBInstruction.cpp b/source/API/SBInstruction.cpp index 6158418..36be948 100644 --- a/source/API/SBInstruction.cpp +++ b/source/API/SBInstruction.cpp @@ -180,7 +180,7 @@ SBInstruction::GetDescription (lldb::SBStream &s) // didn't have a stream already created, one will get created... FormatEntity::Entry format; FormatEntity::Parse("${addr}: ", format); - m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL, &sc, NULL, &format); + m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL, &sc, NULL, &format, 0); return true; } return false; @@ -202,7 +202,7 @@ SBInstruction::Print (FILE *out) StreamFile out_stream (out, false); FormatEntity::Entry format; FormatEntity::Parse("${addr}: ", format); - m_opaque_sp->Dump (&out_stream, 0, true, false, NULL, &sc, NULL, &format); + m_opaque_sp->Dump (&out_stream, 0, true, false, NULL, &sc, NULL, &format, 0); } } diff --git a/source/API/SBInstructionList.cpp b/source/API/SBInstructionList.cpp index 812824b..34b0e05 100644 --- a/source/API/SBInstructionList.cpp +++ b/source/API/SBInstructionList.cpp @@ -120,7 +120,7 @@ SBInstructionList::GetDescription (lldb::SBStream &description) module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc); } - inst->Dump (&sref, max_opcode_byte_size, true, false, NULL, &sc, &prev_sc, &format); + inst->Dump (&sref, max_opcode_byte_size, true, false, NULL, &sc, &prev_sc, &format, 0); sref.EOL(); } return true; diff --git a/source/API/SBLanguageRuntime.cpp b/source/API/SBLanguageRuntime.cpp new file mode 100644 index 0000000..93a54cd --- /dev/null +++ b/source/API/SBLanguageRuntime.cpp @@ -0,0 +1,26 @@ +//===-- SBLanguageRuntime.cpp -----------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/API/SBLanguageRuntime.h" +#include "lldb/Target/LanguageRuntime.h" + +using namespace lldb; +using namespace lldb_private; + +lldb::LanguageType +SBLanguageRuntime::GetLanguageTypeFromString (const char *string) +{ + return LanguageRuntime::GetLanguageTypeFromString(string); +} + +const char * +SBLanguageRuntime::GetNameForLanguageType (lldb::LanguageType language) +{ + return LanguageRuntime::GetNameForLanguageType(language); +} diff --git a/source/API/SBLaunchInfo.cpp b/source/API/SBLaunchInfo.cpp index dcb0e1b..54bed87 100644 --- a/source/API/SBLaunchInfo.cpp +++ b/source/API/SBLaunchInfo.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBLaunchInfo.h" #include "lldb/API/SBFileSpec.h" @@ -36,6 +34,12 @@ SBLaunchInfo::ref () return *m_opaque_sp; } +const lldb_private::ProcessLaunchInfo & +SBLaunchInfo::ref () const +{ + return *m_opaque_sp; +} + lldb::pid_t SBLaunchInfo::GetProcessID() { @@ -169,13 +173,13 @@ SBLaunchInfo::Clear () const char * SBLaunchInfo::GetWorkingDirectory () const { - return m_opaque_sp->GetWorkingDirectory(); + return m_opaque_sp->GetWorkingDirectory().GetCString(); } void SBLaunchInfo::SetWorkingDirectory (const char *working_dir) { - m_opaque_sp->SetWorkingDirectory(working_dir); + m_opaque_sp->SetWorkingDirectory(FileSpec{working_dir, false}); } uint32_t @@ -217,6 +221,18 @@ SBLaunchInfo::SetShell (const char * path) m_opaque_sp->SetShell (FileSpec(path, false)); } +bool +SBLaunchInfo::GetShellExpandArguments () +{ + return m_opaque_sp->GetShellExpandArguments(); +} + +void +SBLaunchInfo::SetShellExpandArguments (bool expand) +{ + m_opaque_sp->SetShellExpandArguments(expand); +} + uint32_t SBLaunchInfo::GetResumeCount () { @@ -244,7 +260,7 @@ SBLaunchInfo::AddDuplicateFileAction (int fd, int dup_fd) bool SBLaunchInfo::AddOpenFileAction (int fd, const char *path, bool read, bool write) { - return m_opaque_sp->AppendOpenFileAction(fd, path, read, write); + return m_opaque_sp->AppendOpenFileAction(fd, FileSpec{path, false}, read, write); } bool diff --git a/source/API/SBListener.cpp b/source/API/SBListener.cpp index 8731873..643c82d 100644 --- a/source/API/SBListener.cpp +++ b/source/API/SBListener.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBListener.h" #include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBDebugger.h" diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp index 0d7dda1..0249a7e 100644 --- a/source/API/SBModule.cpp +++ b/source/API/SBModule.cpp @@ -20,6 +20,7 @@ #include "lldb/Core/StreamString.h" #include "lldb/Core/ValueObjectList.h" #include "lldb/Core/ValueObjectVariable.h" +#include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/Symtab.h" @@ -211,34 +212,28 @@ SBModule::GetUUIDString () const { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - static char uuid_string_buffer[80]; - const char *uuid_c_string = NULL; - std::string uuid_string; + const char *uuid_cstr = NULL; ModuleSP module_sp (GetSP ()); if (module_sp) - uuid_string = module_sp->GetUUID().GetAsString(); - - if (!uuid_string.empty()) { - strncpy (uuid_string_buffer, uuid_string.c_str(), sizeof (uuid_string_buffer)); - uuid_string_buffer[sizeof (uuid_string_buffer) - 1] = '\0'; - uuid_c_string = uuid_string_buffer; + // We are going to return a "const char *" value through the public + // API, so we need to constify it so it gets added permanently the + // string pool and then we don't need to worry about the lifetime of the + // string as it will never go away once it has been put into the ConstString + // string pool + uuid_cstr = ConstString(module_sp->GetUUID().GetAsString()).GetCString(); } - if (log) + if (uuid_cstr && uuid_cstr[0]) { - if (!uuid_string.empty()) - { - StreamString s; - module_sp->GetUUID().Dump (&s); - log->Printf ("SBModule(%p)::GetUUIDString () => %s", - static_cast<void*>(module_sp.get()), s.GetData()); - } - else - log->Printf ("SBModule(%p)::GetUUIDString () => NULL", - static_cast<void*>(module_sp.get())); + if (log) + log->Printf ("SBModule(%p)::GetUUIDString () => %s", static_cast<void*>(module_sp.get()), uuid_cstr); + return uuid_cstr; } - return uuid_c_string; + + if (log) + log->Printf ("SBModule(%p)::GetUUIDString () => NULL", static_cast<void*>(module_sp.get())); + return NULL; } @@ -690,3 +685,30 @@ SBModule::GetVersion (uint32_t *versions, uint32_t num_versions) } } +lldb::SBFileSpec +SBModule::GetSymbolFileSpec() const +{ + lldb::SBFileSpec sb_file_spec; + ModuleSP module_sp(GetSP()); + if (module_sp) + { + SymbolVendor *symbol_vendor_ptr = module_sp->GetSymbolVendor(); + if (symbol_vendor_ptr) + sb_file_spec.SetFileSpec(symbol_vendor_ptr->GetMainFileSpec()); + } + return sb_file_spec; +} + +lldb::SBAddress +SBModule::GetObjectFileHeaderAddress() const +{ + lldb::SBAddress sb_addr; + ModuleSP module_sp (GetSP ()); + if (module_sp) + { + ObjectFile *objfile_ptr = module_sp->GetObjectFile(); + if (objfile_ptr) + sb_addr.ref() = objfile_ptr->GetHeaderAddress(); + } + return sb_addr; +} diff --git a/source/API/SBPlatform.cpp b/source/API/SBPlatform.cpp index b23891d..5662f36 100644 --- a/source/API/SBPlatform.cpp +++ b/source/API/SBPlatform.cpp @@ -329,9 +329,9 @@ SBPlatform::SetWorkingDirectory(const char *path) if (platform_sp) { if (path) - platform_sp->SetWorkingDirectory(ConstString(path)); + platform_sp->SetWorkingDirectory(FileSpec{path, false}); else - platform_sp->SetWorkingDirectory(ConstString()); + platform_sp->SetWorkingDirectory(FileSpec{}); return true; } return false; @@ -378,7 +378,7 @@ SBPlatform::GetTriple() PlatformSP platform_sp(GetSP()); if (platform_sp) { - ArchSpec arch(platform_sp->GetRemoteSystemArchitecture()); + ArchSpec arch(platform_sp->GetSystemArchitecture()); if (arch.IsValid()) { // Const-ify the string so we don't need to worry about the lifetime of the string @@ -545,7 +545,7 @@ SBPlatform::Run (SBPlatformShellCommand &shell_command) shell_command.SetWorkingDirectory(working_dir); } return platform_sp->RunShellCommand(command, - working_dir, + FileSpec{working_dir, false}, &shell_command.m_opaque_ptr->m_status, &shell_command.m_opaque_ptr->m_signo, &shell_command.m_opaque_ptr->m_output, @@ -598,7 +598,7 @@ SBPlatform::MakeDirectory (const char *path, uint32_t file_permissions) PlatformSP platform_sp(GetSP()); if (platform_sp) { - sb_error.ref() = platform_sp->MakeDirectory(path, file_permissions); + sb_error.ref() = platform_sp->MakeDirectory(FileSpec{path, false}, file_permissions); } else { @@ -614,7 +614,7 @@ SBPlatform::GetFilePermissions (const char *path) if (platform_sp) { uint32_t file_permissions = 0; - platform_sp->GetFilePermissions(path, file_permissions); + platform_sp->GetFilePermissions(FileSpec{path, false}, file_permissions); return file_permissions; } return 0; @@ -628,7 +628,7 @@ SBPlatform::SetFilePermissions (const char *path, uint32_t file_permissions) PlatformSP platform_sp(GetSP()); if (platform_sp) { - sb_error.ref() = platform_sp->SetFilePermissions(path, file_permissions); + sb_error.ref() = platform_sp->SetFilePermissions(FileSpec{path, false}, file_permissions); } else { diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp index 9a0b23b..a1dbf68 100644 --- a/source/API/SBProcess.cpp +++ b/source/API/SBProcess.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBProcess.h" // C Includes @@ -169,11 +167,11 @@ SBProcess::RemoteLaunch (char const **argv, { if (stop_at_entry) launch_flags |= eLaunchFlagStopAtEntry; - ProcessLaunchInfo launch_info (stdin_path, - stdout_path, - stderr_path, - working_directory, - launch_flags); + ProcessLaunchInfo launch_info(FileSpec{stdin_path, false}, + FileSpec{stdout_path, false}, + FileSpec{stderr_path, false}, + FileSpec{working_directory, false}, + launch_flags); Module *exe_module = process_sp->GetTarget().GetExecutableModulePointer(); if (exe_module) launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true); @@ -603,6 +601,30 @@ SBProcess::GetStopID(bool include_expression_stops) return 0; } +SBEvent +SBProcess::GetStopEventForStopID(uint32_t stop_id) +{ + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + + SBEvent sb_event; + EventSP event_sp; + ProcessSP process_sp(GetSP()); + if (process_sp) + { + Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex()); + event_sp = process_sp->GetStopEventForStopID(stop_id); + sb_event.reset(event_sp); + } + + if (log) + log->Printf ("SBProcess(%p)::GetStopEventForStopID (stop_id=%" PRIu32 ") => SBEvent(%p)", + static_cast<void*>(process_sp.get()), + stop_id, + static_cast<void*>(event_sp.get())); + + return sb_event; +} + StateType SBProcess::GetState () { @@ -768,7 +790,7 @@ SBProcess::Destroy () if (process_sp) { Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex()); - sb_error.SetError(process_sp->Destroy()); + sb_error.SetError(process_sp->Destroy(false)); } else sb_error.SetErrorString ("SBProcess is invalid"); @@ -821,7 +843,7 @@ SBProcess::Kill () if (process_sp) { Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex()); - sb_error.SetError (process_sp->Destroy()); + sb_error.SetError (process_sp->Destroy(true)); } else sb_error.SetErrorString ("SBProcess is invalid"); @@ -918,9 +940,9 @@ SBProcess::GetThreadByID (tid_t tid) ProcessSP process_sp(GetSP()); if (process_sp) { - Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex()); Process::StopLocker stop_locker; const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock()); + Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex()); thread_sp = process_sp->GetThreadList().FindThreadByID (tid, can_update); sb_thread.SetThread (thread_sp); } @@ -942,9 +964,9 @@ SBProcess::GetThreadByIndexID (uint32_t index_id) ProcessSP process_sp(GetSP()); if (process_sp) { - Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex()); Process::StopLocker stop_locker; const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock()); + Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex()); thread_sp = process_sp->GetThreadList().FindThreadByIndexID (index_id, can_update); sb_thread.SetThread (thread_sp); } @@ -999,9 +1021,15 @@ SBProcess::GetProcessFromEvent (const SBEvent &event) } bool +SBProcess::GetInterruptedFromEvent (const SBEvent &event) +{ + return Process::ProcessEventData::GetInterruptedFromEvent(event.get()); +} + +bool SBProcess::EventIsProcessEvent (const SBEvent &event) { - return strcmp (event.GetBroadcasterClass(), SBProcess::GetBroadcasterClass()) == 0; + return event.GetBroadcasterClass() == SBProcess::GetBroadcasterClass(); } SBBroadcaster diff --git a/source/API/SBQueue.cpp b/source/API/SBQueue.cpp index b19ed72..be4c5fd 100644 --- a/source/API/SBQueue.cpp +++ b/source/API/SBQueue.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include <inttypes.h> #include "lldb/API/SBQueue.h" diff --git a/source/API/SBQueueItem.cpp b/source/API/SBQueueItem.cpp index 6a1aa7b..e7a199b 100644 --- a/source/API/SBQueueItem.cpp +++ b/source/API/SBQueueItem.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" #include "lldb/lldb-forward.h" #include "lldb/API/SBAddress.h" diff --git a/source/API/SBSourceManager.cpp b/source/API/SBSourceManager.cpp index 0b8cbfc..8196b91 100644 --- a/source/API/SBSourceManager.cpp +++ b/source/API/SBSourceManager.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBDebugger.h" #include "lldb/API/SBSourceManager.h" #include "lldb/API/SBTarget.h" diff --git a/source/API/SBSymbol.cpp b/source/API/SBSymbol.cpp index 12a3b31..246a455 100644 --- a/source/API/SBSymbol.cpp +++ b/source/API/SBSymbol.cpp @@ -137,10 +137,11 @@ SBSymbol::GetInstructions (SBTarget target, const char *flavor_string) } if (m_opaque_ptr->ValueIsAddress()) { - ModuleSP module_sp (m_opaque_ptr->GetAddress().GetModule()); + const Address &symbol_addr = m_opaque_ptr->GetAddressRef(); + ModuleSP module_sp = symbol_addr.GetModule(); if (module_sp) { - AddressRange symbol_range (m_opaque_ptr->GetAddress(), m_opaque_ptr->GetByteSize()); + AddressRange symbol_range (symbol_addr, m_opaque_ptr->GetByteSize()); const bool prefer_file_cache = false; sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module_sp->GetArchitecture (), NULL, @@ -172,7 +173,7 @@ SBSymbol::GetStartAddress () SBAddress addr; if (m_opaque_ptr && m_opaque_ptr->ValueIsAddress()) { - addr.SetAddress (&m_opaque_ptr->GetAddress()); + addr.SetAddress (&m_opaque_ptr->GetAddressRef()); } return addr; } @@ -186,7 +187,7 @@ SBSymbol::GetEndAddress () lldb::addr_t range_size = m_opaque_ptr->GetByteSize(); if (range_size > 0) { - addr.SetAddress (&m_opaque_ptr->GetAddress()); + addr.SetAddress (&m_opaque_ptr->GetAddressRef()); addr->Slide (m_opaque_ptr->GetByteSize()); } } diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp index b13d828..9238852 100644 --- a/source/API/SBTarget.cpp +++ b/source/API/SBTarget.cpp @@ -7,14 +7,13 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBTarget.h" #include "lldb/lldb-public.h" -#include "lldb/API/SBDebugger.h" #include "lldb/API/SBBreakpoint.h" +#include "lldb/API/SBDebugger.h" +#include "lldb/API/SBEvent.h" #include "lldb/API/SBExpressionOptions.h" #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBListener.h" @@ -47,12 +46,16 @@ #include "lldb/Host/FileSpec.h" #include "lldb/Host/Host.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/DeclVendor.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/VariableList.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/LanguageRuntime.h" +#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" - +#include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Target/TargetList.h" @@ -66,230 +69,31 @@ using namespace lldb_private; #define DEFAULT_DISASM_BYTE_SIZE 32 +namespace { -SBAttachInfo::SBAttachInfo () : - m_opaque_sp (new ProcessAttachInfo()) -{ -} - -SBAttachInfo::SBAttachInfo (lldb::pid_t pid) : - m_opaque_sp (new ProcessAttachInfo()) -{ - m_opaque_sp->SetProcessID (pid); -} - -SBAttachInfo::SBAttachInfo (const char *path, bool wait_for) : - m_opaque_sp (new ProcessAttachInfo()) -{ - if (path && path[0]) - m_opaque_sp->GetExecutableFile().SetFile(path, false); - m_opaque_sp->SetWaitForLaunch (wait_for); -} - -SBAttachInfo::SBAttachInfo (const SBAttachInfo &rhs) : - m_opaque_sp (new ProcessAttachInfo()) -{ - *m_opaque_sp = *rhs.m_opaque_sp; -} - -SBAttachInfo::~SBAttachInfo() -{ -} - -lldb_private::ProcessAttachInfo & -SBAttachInfo::ref () -{ - return *m_opaque_sp; -} - -SBAttachInfo & -SBAttachInfo::operator = (const SBAttachInfo &rhs) -{ - if (this != &rhs) - *m_opaque_sp = *rhs.m_opaque_sp; - return *this; -} - -lldb::pid_t -SBAttachInfo::GetProcessID () -{ - return m_opaque_sp->GetProcessID(); -} - -void -SBAttachInfo::SetProcessID (lldb::pid_t pid) -{ - m_opaque_sp->SetProcessID (pid); -} - - -uint32_t -SBAttachInfo::GetResumeCount () -{ - return m_opaque_sp->GetResumeCount(); -} - -void -SBAttachInfo::SetResumeCount (uint32_t c) -{ - m_opaque_sp->SetResumeCount (c); -} - -const char * -SBAttachInfo::GetProcessPluginName () -{ - return m_opaque_sp->GetProcessPluginName(); -} - -void -SBAttachInfo::SetProcessPluginName (const char *plugin_name) -{ - return m_opaque_sp->SetProcessPluginName (plugin_name); -} - -void -SBAttachInfo::SetExecutable (const char *path) -{ - if (path && path[0]) - m_opaque_sp->GetExecutableFile().SetFile(path, false); - else - m_opaque_sp->GetExecutableFile().Clear(); -} - -void -SBAttachInfo::SetExecutable (SBFileSpec exe_file) -{ - if (exe_file.IsValid()) - m_opaque_sp->GetExecutableFile() = exe_file.ref(); - else - m_opaque_sp->GetExecutableFile().Clear(); -} - -bool -SBAttachInfo::GetWaitForLaunch () -{ - return m_opaque_sp->GetWaitForLaunch(); -} - -void -SBAttachInfo::SetWaitForLaunch (bool b) -{ - m_opaque_sp->SetWaitForLaunch (b); -} - -bool -SBAttachInfo::GetIgnoreExisting () -{ - return m_opaque_sp->GetIgnoreExisting(); -} - -void -SBAttachInfo::SetIgnoreExisting (bool b) -{ - m_opaque_sp->SetIgnoreExisting (b); -} - -uint32_t -SBAttachInfo::GetUserID() -{ - return m_opaque_sp->GetUserID(); -} - -uint32_t -SBAttachInfo::GetGroupID() -{ - return m_opaque_sp->GetGroupID(); -} - -bool -SBAttachInfo::UserIDIsValid () -{ - return m_opaque_sp->UserIDIsValid(); -} - -bool -SBAttachInfo::GroupIDIsValid () -{ - return m_opaque_sp->GroupIDIsValid(); -} - -void -SBAttachInfo::SetUserID (uint32_t uid) -{ - m_opaque_sp->SetUserID (uid); -} - -void -SBAttachInfo::SetGroupID (uint32_t gid) -{ - m_opaque_sp->SetGroupID (gid); -} - -uint32_t -SBAttachInfo::GetEffectiveUserID() -{ - return m_opaque_sp->GetEffectiveUserID(); -} - -uint32_t -SBAttachInfo::GetEffectiveGroupID() -{ - return m_opaque_sp->GetEffectiveGroupID(); -} - -bool -SBAttachInfo::EffectiveUserIDIsValid () -{ - return m_opaque_sp->EffectiveUserIDIsValid(); -} - -bool -SBAttachInfo::EffectiveGroupIDIsValid () -{ - return m_opaque_sp->EffectiveGroupIDIsValid (); -} - -void -SBAttachInfo::SetEffectiveUserID (uint32_t uid) -{ - m_opaque_sp->SetEffectiveUserID(uid); -} - -void -SBAttachInfo::SetEffectiveGroupID (uint32_t gid) -{ - m_opaque_sp->SetEffectiveGroupID(gid); -} - -lldb::pid_t -SBAttachInfo::GetParentProcessID () -{ - return m_opaque_sp->GetParentProcessID(); -} - -void -SBAttachInfo::SetParentProcessID (lldb::pid_t pid) +Error +AttachToProcess (ProcessAttachInfo &attach_info, Target &target) { - m_opaque_sp->SetParentProcessID (pid); -} + Mutex::Locker api_locker (target.GetAPIMutex ()); -bool -SBAttachInfo::ParentProcessIDIsValid() -{ - return m_opaque_sp->ParentProcessIDIsValid(); -} + auto process_sp = target.GetProcessSP (); + if (process_sp) + { + const auto state = process_sp->GetState (); + if (process_sp->IsAlive () && state == eStateConnected) + { + // If we are already connected, then we have already specified the + // listener, so if a valid listener is supplied, we need to error out + // to let the client know. + if (attach_info.GetListener ()) + return Error ("process is connected and already has a listener, pass empty listener"); + } + } -SBListener -SBAttachInfo::GetListener () -{ - return SBListener(m_opaque_sp->GetListener()); + return target.Attach (attach_info, nullptr); } -void -SBAttachInfo::SetListener (SBListener &listener) -{ - m_opaque_sp->SetListener(listener.GetSP()); -} +} // namespace //---------------------------------------------------------------------- // SBTarget constructor @@ -324,6 +128,32 @@ SBTarget::~SBTarget() { } +bool +SBTarget::EventIsTargetEvent (const SBEvent &event) +{ + return Target::TargetEventData::GetEventDataFromEvent(event.get()) != NULL; +} + +SBTarget +SBTarget::GetTargetFromEvent (const SBEvent &event) +{ + return Target::TargetEventData::GetTargetFromEvent (event.get()); +} + +uint32_t +SBTarget::GetNumModulesFromEvent (const SBEvent &event) +{ + const ModuleList module_list = Target::TargetEventData::GetModuleListFromEvent (event.get()); + return module_list.GetSize(); +} + +SBModule +SBTarget::GetModuleAtIndexFromEvent (const uint32_t idx, const SBEvent &event) +{ + const ModuleList module_list = Target::TargetEventData::GetModuleListFromEvent (event.get()); + return SBModule(module_list.GetModuleAtIndex(idx)); +} + const char * SBTarget::GetBroadcasterClassName () { @@ -513,7 +343,11 @@ SBTarget::Launch if (getenv("LLDB_LAUNCH_FLAG_DISABLE_STDIO")) launch_flags |= eLaunchFlagDisableSTDIO; - ProcessLaunchInfo launch_info (stdin_path, stdout_path, stderr_path, working_directory, launch_flags); + ProcessLaunchInfo launch_info(FileSpec{stdin_path, false}, + FileSpec{stdout_path, false}, + FileSpec{stderr_path, false}, + FileSpec{working_directory, false}, + launch_flags); Module *exe_module = target_sp->GetExecutableModulePointer(); if (exe_module) @@ -613,7 +447,6 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error) Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBProcess sb_process; - ProcessSP process_sp; TargetSP target_sp(GetSP()); if (log) @@ -622,72 +455,34 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error) if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); - - StateType state = eStateInvalid; - process_sp = target_sp->GetProcessSP(); - if (process_sp) + ProcessAttachInfo &attach_info = sb_attach_info.ref(); + if (attach_info.ProcessIDIsValid() && !attach_info.UserIDIsValid()) { - state = process_sp->GetState(); - - if (process_sp->IsAlive() && state != eStateConnected) + PlatformSP platform_sp = target_sp->GetPlatform(); + // See if we can pre-verify if a process exists or not + if (platform_sp && platform_sp->IsConnected()) { - if (state == eStateAttaching) - error.SetErrorString ("process attach is in progress"); + lldb::pid_t attach_pid = attach_info.GetProcessID(); + ProcessInstanceInfo instance_info; + if (platform_sp->GetProcessInfo(attach_pid, instance_info)) + { + attach_info.SetUserID(instance_info.GetEffectiveUserID()); + } else - error.SetErrorString ("a process is already being debugged"); - if (log) - log->Printf ("SBTarget(%p)::Attach (...) => error %s", - static_cast<void*>(target_sp.get()), - error.GetCString()); - return sb_process; - } - } - - if (state != eStateConnected) - process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), NULL, NULL); - - if (process_sp) - { - ProcessAttachInfo &attach_info = sb_attach_info.ref(); - if (attach_info.ProcessIDIsValid() && !attach_info.UserIDIsValid()) - { - PlatformSP platform_sp = target_sp->GetPlatform(); - // See if we can pre-verify if a process exists or not - if (platform_sp && platform_sp->IsConnected()) { - lldb::pid_t attach_pid = attach_info.GetProcessID(); - ProcessInstanceInfo instance_info; - if (platform_sp->GetProcessInfo(attach_pid, instance_info)) + error.ref().SetErrorStringWithFormat("no process found with process ID %" PRIu64, attach_pid); + if (log) { - attach_info.SetUserID(instance_info.GetEffectiveUserID()); - } - else - { - error.ref().SetErrorStringWithFormat("no process found with process ID %" PRIu64, attach_pid); - if (log) - { - log->Printf ("SBTarget(%p)::Attach (...) => error %s", - static_cast<void*>(target_sp.get()), error.GetCString()); - } - return sb_process; + log->Printf ("SBTarget(%p)::Attach (...) => error %s", + static_cast<void*>(target_sp.get()), error.GetCString()); } + return sb_process; } } - error.SetError (process_sp->Attach (attach_info)); - if (error.Success()) - { - sb_process.SetSP (process_sp); - // If we are doing synchronous mode, then wait for the - // process to stop! - if (target_sp->GetDebugger().GetAsyncExecution () == false) - process_sp->WaitForProcessToStop (NULL); - } - } - else - { - error.SetErrorString ("unable to create lldb_private::Process"); } + error.SetError(AttachToProcess(attach_info, *target_sp)); + if (error.Success()) + sb_process.SetSP(target_sp->GetProcessSP()); } else { @@ -697,7 +492,7 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error) if (log) log->Printf ("SBTarget(%p)::Attach (...) => SBProcess(%p)", static_cast<void*>(target_sp.get()), - static_cast<void*>(process_sp.get())); + static_cast<void*>(sb_process.GetSP().get())); return sb_process; } @@ -726,87 +521,37 @@ SBTarget::AttachToProcessWithID Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBProcess sb_process; - ProcessSP process_sp; TargetSP target_sp(GetSP()); if (log) - log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%" PRId64 ", error)...", - static_cast<void*>(target_sp.get()), pid); + log->Printf ("SBTarget(%p)::%s (listener, pid=%" PRId64 ", error)...", + static_cast<void*>(target_sp.get()), + __FUNCTION__, + pid); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); - - StateType state = eStateInvalid; - process_sp = target_sp->GetProcessSP(); - if (process_sp) - { - state = process_sp->GetState(); - - if (process_sp->IsAlive() && state != eStateConnected) - { - if (state == eStateAttaching) - error.SetErrorString ("process attach is in progress"); - else - error.SetErrorString ("a process is already being debugged"); - return sb_process; - } - } - - if (state == eStateConnected) - { - // If we are already connected, then we have already specified the - // listener, so if a valid listener is supplied, we need to error out - // to let the client know. - if (listener.IsValid()) - { - error.SetErrorString ("process is connected and already has a listener, pass empty listener"); - return sb_process; - } - } - else - { - if (listener.IsValid()) - process_sp = target_sp->CreateProcess (listener.ref(), NULL, NULL); - else - process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), NULL, NULL); - } - if (process_sp) - { - sb_process.SetSP (process_sp); + ProcessAttachInfo attach_info; + attach_info.SetProcessID (pid); + if (listener.IsValid()) + attach_info.SetListener(listener.GetSP()); - ProcessAttachInfo attach_info; - attach_info.SetProcessID (pid); + ProcessInstanceInfo instance_info; + if (target_sp->GetPlatform ()->GetProcessInfo (pid, instance_info)) + attach_info.SetUserID (instance_info.GetEffectiveUserID ()); - PlatformSP platform_sp = target_sp->GetPlatform(); - ProcessInstanceInfo instance_info; - if (platform_sp->GetProcessInfo(pid, instance_info)) - { - attach_info.SetUserID(instance_info.GetEffectiveUserID()); - } - error.SetError (process_sp->Attach (attach_info)); - if (error.Success()) - { - // If we are doing synchronous mode, then wait for the - // process to stop! - if (target_sp->GetDebugger().GetAsyncExecution () == false) - process_sp->WaitForProcessToStop (NULL); - } - } - else - { - error.SetErrorString ("unable to create lldb_private::Process"); - } + error.SetError (AttachToProcess (attach_info, *target_sp)); + if (error.Success ()) + sb_process.SetSP (target_sp->GetProcessSP ()); } else - { error.SetErrorString ("SBTarget is invalid"); - } if (log) - log->Printf ("SBTarget(%p)::AttachToProcessWithID (...) => SBProcess(%p)", - static_cast<void*>(target_sp.get()), - static_cast<void*>(process_sp.get())); + log->Printf ("SBTarget(%p)::%s (...) => SBProcess(%p)", + static_cast<void*>(target_sp.get ()), + __FUNCTION__, + static_cast<void*>(sb_process.GetSP().get ())); return sb_process; } @@ -822,82 +567,35 @@ SBTarget::AttachToProcessWithName Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBProcess sb_process; - ProcessSP process_sp; TargetSP target_sp(GetSP()); if (log) - log->Printf ("SBTarget(%p)::AttachToProcessWithName (listener, name=%s, wait_for=%s, error)...", - static_cast<void*>(target_sp.get()), name, + log->Printf ("SBTarget(%p)::%s (listener, name=%s, wait_for=%s, error)...", + static_cast<void*>(target_sp.get()), + __FUNCTION__, + name, wait_for ? "true" : "false"); if (name && target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); - - StateType state = eStateInvalid; - process_sp = target_sp->GetProcessSP(); - if (process_sp) - { - state = process_sp->GetState(); - - if (process_sp->IsAlive() && state != eStateConnected) - { - if (state == eStateAttaching) - error.SetErrorString ("process attach is in progress"); - else - error.SetErrorString ("a process is already being debugged"); - return sb_process; - } - } - - if (state == eStateConnected) - { - // If we are already connected, then we have already specified the - // listener, so if a valid listener is supplied, we need to error out - // to let the client know. - if (listener.IsValid()) - { - error.SetErrorString ("process is connected and already has a listener, pass empty listener"); - return sb_process; - } - } - else - { - if (listener.IsValid()) - process_sp = target_sp->CreateProcess (listener.ref(), NULL, NULL); - else - process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), NULL, NULL); - } + ProcessAttachInfo attach_info; + attach_info.GetExecutableFile().SetFile(name, false); + attach_info.SetWaitForLaunch(wait_for); + if (listener.IsValid()) + attach_info.SetListener(listener.GetSP()); - if (process_sp) - { - sb_process.SetSP (process_sp); - ProcessAttachInfo attach_info; - attach_info.GetExecutableFile().SetFile(name, false); - attach_info.SetWaitForLaunch(wait_for); - error.SetError (process_sp->Attach (attach_info)); - if (error.Success()) - { - // If we are doing synchronous mode, then wait for the - // process to stop! - if (target_sp->GetDebugger().GetAsyncExecution () == false) - process_sp->WaitForProcessToStop (NULL); - } - } - else - { - error.SetErrorString ("unable to create lldb_private::Process"); - } + error.SetError (AttachToProcess (attach_info, *target_sp)); + if (error.Success ()) + sb_process.SetSP (target_sp->GetProcessSP ()); } else - { error.SetErrorString ("SBTarget is invalid"); - } if (log) - log->Printf ("SBTarget(%p)::AttachToPorcessWithName (...) => SBProcess(%p)", + log->Printf ("SBTarget(%p)::%s (...) => SBProcess(%p)", static_cast<void*>(target_sp.get()), - static_cast<void*>(process_sp.get())); + __FUNCTION__, + static_cast<void*>(sb_process.GetSP().get())); return sb_process; } @@ -1112,7 +810,8 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, const LazyBool skip_prologue = eLazyBoolCalculate; const bool internal = false; const bool hardware = false; - *sb_bp = target_sp->CreateBreakpoint (NULL, *sb_file_spec, line, check_inlines, skip_prologue, internal, hardware); + const LazyBool move_to_nearest_code = eLazyBoolCalculate; + *sb_bp = target_sp->CreateBreakpoint (NULL, *sb_file_spec, line, check_inlines, skip_prologue, internal, hardware, move_to_nearest_code); } if (log) @@ -1359,6 +1058,7 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex, RegularExpression regexp(source_regex); FileSpecList source_file_spec_list; const bool hardware = false; + const LazyBool move_to_nearest_code = eLazyBoolCalculate; source_file_spec_list.Append (source_file.ref()); if (module_name && module_name[0]) @@ -1366,11 +1066,11 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex, FileSpecList module_spec_list; module_spec_list.Append (FileSpec (module_name, false)); - *sb_bp = target_sp->CreateSourceRegexBreakpoint (&module_spec_list, &source_file_spec_list, regexp, false, hardware); + *sb_bp = target_sp->CreateSourceRegexBreakpoint (&module_spec_list, &source_file_spec_list, regexp, false, hardware, move_to_nearest_code); } else { - *sb_bp = target_sp->CreateSourceRegexBreakpoint (NULL, &source_file_spec_list, regexp, false, hardware); + *sb_bp = target_sp->CreateSourceRegexBreakpoint (NULL, &source_file_spec_list, regexp, false, hardware, move_to_nearest_code); } } @@ -1387,9 +1087,9 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex, } lldb::SBBreakpoint -SBTarget::BreakpointCreateBySourceRegex (const char *source_regex, - const SBFileSpecList &module_list, - const lldb::SBFileSpecList &source_file_list) +SBTarget::BreakpointCreateBySourceRegex (const char *source_regex, + const SBFileSpecList &module_list, + const lldb::SBFileSpecList &source_file_list) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); @@ -1399,8 +1099,9 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex, { Mutex::Locker api_locker (target_sp->GetAPIMutex()); const bool hardware = false; + const LazyBool move_to_nearest_code = eLazyBoolCalculate; RegularExpression regexp(source_regex); - *sb_bp = target_sp->CreateSourceRegexBreakpoint (module_list.get(), source_file_list.get(), regexp, false, hardware); + *sb_bp = target_sp->CreateSourceRegexBreakpoint (module_list.get(), source_file_list.get(), regexp, false, hardware, move_to_nearest_code); } if (log) @@ -2679,3 +2380,20 @@ SBTarget::GetStackRedZoneSize() return 0; } +lldb::SBLaunchInfo +SBTarget::GetLaunchInfo () const +{ + lldb::SBLaunchInfo launch_info(NULL); + TargetSP target_sp(GetSP()); + if (target_sp) + launch_info.ref() = m_opaque_sp->GetProcessLaunchInfo(); + return launch_info; +} + +void +SBTarget::SetLaunchInfo (const lldb::SBLaunchInfo &launch_info) +{ + TargetSP target_sp(GetSP()); + if (target_sp) + m_opaque_sp->SetProcessLaunchInfo(launch_info.ref()); +} diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp index 9fe0d02..dfc7ce9 100644 --- a/source/API/SBThread.cpp +++ b/source/API/SBThread.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBThread.h" #include "lldb/API/SBSymbolContext.h" @@ -20,13 +18,15 @@ #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" #include "lldb/Core/StructuredData.h" +#include "lldb/Core/ValueObject.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Symbol/SymbolContext.h" +#include "lldb/Symbol/CompileUnit.h" #include "lldb/Target/SystemRuntime.h" #include "lldb/Target/Thread.h" #include "lldb/Target/Process.h" #include "lldb/Target/Queue.h" -#include "lldb/Symbol/SymbolContext.h" -#include "lldb/Symbol/CompileUnit.h" +#include "lldb/Target/UnixSignals.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadPlan.h" @@ -114,13 +114,13 @@ SBThread::GetQueue () const else { if (log) - log->Printf ("SBThread(%p)::GetQueueKind() => error: process is running", + log->Printf ("SBThread(%p)::GetQueue() => error: process is running", static_cast<void*>(exe_ctx.GetThreadPtr())); } } if (log) - log->Printf ("SBThread(%p)::GetQueueKind () => SBQueue(%p)", + log->Printf ("SBThread(%p)::GetQueue () => SBQueue(%p)", static_cast<void*>(exe_ctx.GetThreadPtr()), static_cast<void*>(queue_sp.get())); return sb_queue; diff --git a/source/API/SBThreadPlan.cpp b/source/API/SBThreadPlan.cpp index 02b1a8d..2fcd721 100644 --- a/source/API/SBThreadPlan.cpp +++ b/source/API/SBThreadPlan.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBThread.h" #include "lldb/API/SBSymbolContext.h" diff --git a/source/API/SBTypeCategory.cpp b/source/API/SBTypeCategory.cpp index 66cf462..ee9553c 100644 --- a/source/API/SBTypeCategory.cpp +++ b/source/API/SBTypeCategory.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBTypeCategory.h" #include "lldb/API/SBTypeFilter.h" diff --git a/source/API/SBTypeFilter.cpp b/source/API/SBTypeFilter.cpp index 605e92d..8af3e1f 100644 --- a/source/API/SBTypeFilter.cpp +++ b/source/API/SBTypeFilter.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBTypeFilter.h" #include "lldb/API/SBStream.h" diff --git a/source/API/SBTypeFormat.cpp b/source/API/SBTypeFormat.cpp index d3ec9bc..9548fe9 100644 --- a/source/API/SBTypeFormat.cpp +++ b/source/API/SBTypeFormat.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBTypeFormat.h" #include "lldb/API/SBStream.h" diff --git a/source/API/SBTypeNameSpecifier.cpp b/source/API/SBTypeNameSpecifier.cpp index 3d03c6a..c587471 100644 --- a/source/API/SBTypeNameSpecifier.cpp +++ b/source/API/SBTypeNameSpecifier.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBTypeNameSpecifier.h" #include "lldb/API/SBStream.h" diff --git a/source/API/SBTypeSummary.cpp b/source/API/SBTypeSummary.cpp index 8a235bf..2c11454 100644 --- a/source/API/SBTypeSummary.cpp +++ b/source/API/SBTypeSummary.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBTypeSummary.h" #include "lldb/API/SBStream.h" diff --git a/source/API/SBTypeSynthetic.cpp b/source/API/SBTypeSynthetic.cpp index 681ed6c..6f9951d 100644 --- a/source/API/SBTypeSynthetic.cpp +++ b/source/API/SBTypeSynthetic.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBTypeSynthetic.h" #include "lldb/API/SBStream.h" diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp index edecb93..ef62c30 100644 --- a/source/API/SBValue.cpp +++ b/source/API/SBValue.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "lldb/API/SBValue.h" #include "lldb/API/SBDeclaration.h" @@ -63,13 +61,19 @@ public: lldb::DynamicValueType use_dynamic, bool use_synthetic, const char *name = NULL) : - m_valobj_sp(in_valobj_sp), + m_valobj_sp(), m_use_dynamic(use_dynamic), m_use_synthetic(use_synthetic), m_name (name) { - if (!m_name.IsEmpty() && m_valobj_sp) - m_valobj_sp->SetName(m_name); + if (in_valobj_sp) + { + if ( (m_valobj_sp = in_valobj_sp->GetQualifiedRepresentationIfAvailable(lldb::eNoDynamicValues, false)) ) + { + if (!m_name.IsEmpty()) + m_valobj_sp->SetName(m_name); + } + } } ValueImpl (const ValueImpl& rhs) : @@ -152,10 +156,20 @@ public: return ValueObjectSP(); } - if (value_sp->GetDynamicValue(m_use_dynamic)) - value_sp = value_sp->GetDynamicValue(m_use_dynamic); - if (value_sp->GetSyntheticValue(m_use_synthetic)) - value_sp = value_sp->GetSyntheticValue(m_use_synthetic); + if (m_use_dynamic != eNoDynamicValues) + { + ValueObjectSP dynamic_sp = value_sp->GetDynamicValue(m_use_dynamic); + if (dynamic_sp) + value_sp = dynamic_sp; + } + + if (m_use_synthetic) + { + ValueObjectSP synthetic_sp = value_sp->GetSyntheticValue(m_use_synthetic); + if (synthetic_sp) + value_sp = synthetic_sp; + } + if (!value_sp) error.SetErrorString("invalid value object"); if (!m_name.IsEmpty()) @@ -969,14 +983,7 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool child_sp = value_sp->GetChildAtIndex (idx, can_create); if (can_create_synthetic && !child_sp) { - if (value_sp->IsPointerType()) - { - child_sp = value_sp->GetSyntheticArrayMemberFromPointer(idx, can_create); - } - else if (value_sp->IsArrayType()) - { - child_sp = value_sp->GetSyntheticArrayMemberFromArray(idx, can_create); - } + child_sp = value_sp->GetSyntheticArrayMember(idx, can_create); } } @@ -1244,6 +1251,22 @@ SBValue::MightHaveChildren () return has_children; } +bool +SBValue::IsRuntimeSupportValue () +{ + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + bool is_support = false; + ValueLocker locker; + lldb::ValueObjectSP value_sp(GetSP(locker)); + if (value_sp) + is_support = value_sp->IsRuntimeSupportValue(); + + if (log) + log->Printf ("SBValue(%p)::IsRuntimeSupportValue() => %i", + static_cast<void*>(value_sp.get()), is_support); + return is_support; +} + uint32_t SBValue::GetNumChildren () { diff --git a/source/API/SBVariablesOptions.cpp b/source/API/SBVariablesOptions.cpp new file mode 100644 index 0000000..7c45356 --- /dev/null +++ b/source/API/SBVariablesOptions.cpp @@ -0,0 +1,254 @@ +//===-- SBVariablesOptions.cpp --------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +#include "lldb/API/SBVariablesOptions.h" + +using namespace lldb; +using namespace lldb_private; + +class VariablesOptionsImpl +{ +public: + VariablesOptionsImpl () : + m_include_arguments(false), + m_include_locals(false), + m_include_statics(false), + m_in_scope_only(false), + m_include_runtime_support_values(false), + m_use_dynamic(lldb::eNoDynamicValues) + {} + + VariablesOptionsImpl (const VariablesOptionsImpl&) = default; + + ~VariablesOptionsImpl () = default; + + VariablesOptionsImpl& + operator = (const VariablesOptionsImpl&) = default; + + bool + GetIncludeArguments () const + { + return m_include_arguments; + } + + void + SetIncludeArguments (bool b) + { + m_include_arguments = b; + } + + bool + GetIncludeLocals () const + { + return m_include_locals; + } + + void + SetIncludeLocals (bool b) + { + m_include_locals = b; + } + + bool + GetIncludeStatics () const + { + return m_include_statics; + } + + void + SetIncludeStatics (bool b) + { + m_include_statics = b; + } + + bool + GetInScopeOnly () const + { + return m_in_scope_only; + } + + void + SetInScopeOnly (bool b) + { + m_in_scope_only = b; + } + + bool + GetIncludeRuntimeSupportValues () const + { + return m_include_runtime_support_values; + } + + void + SetIncludeRuntimeSupportValues (bool b) + { + m_include_runtime_support_values = b; + } + + lldb::DynamicValueType + GetUseDynamic () const + { + return m_use_dynamic; + } + + void + SetUseDynamic (lldb::DynamicValueType d) + { + m_use_dynamic = d; + } + + +private: + bool m_include_arguments : 1; + bool m_include_locals : 1; + bool m_include_statics : 1; + bool m_in_scope_only : 1; + bool m_include_runtime_support_values : 1; + lldb::DynamicValueType m_use_dynamic; +}; + +SBVariablesOptions::SBVariablesOptions () : +m_opaque_ap(new VariablesOptionsImpl()) +{ +} + +SBVariablesOptions::SBVariablesOptions (const SBVariablesOptions& options) : +m_opaque_ap(new VariablesOptionsImpl(options.ref())) +{ +} + +SBVariablesOptions& +SBVariablesOptions::operator = (const SBVariablesOptions& options) +{ + m_opaque_ap.reset(new VariablesOptionsImpl(options.ref())); + return *this; +} + +SBVariablesOptions::~SBVariablesOptions () = default; + +bool +SBVariablesOptions::IsValid () const +{ + return m_opaque_ap.get() != nullptr; +} + +bool +SBVariablesOptions::GetIncludeArguments () const +{ + return m_opaque_ap->GetIncludeArguments(); +} + +void +SBVariablesOptions::SetIncludeArguments (bool arguments) +{ + m_opaque_ap->SetIncludeArguments(arguments); +} + +bool +SBVariablesOptions::GetIncludeLocals () const +{ + return m_opaque_ap->GetIncludeLocals(); +} + +void +SBVariablesOptions::SetIncludeLocals (bool locals) +{ + m_opaque_ap->SetIncludeLocals(locals); +} + +bool +SBVariablesOptions::GetIncludeStatics () const +{ + return m_opaque_ap->GetIncludeStatics(); +} + +void +SBVariablesOptions::SetIncludeStatics (bool statics) +{ + m_opaque_ap->SetIncludeStatics(statics); +} + +bool +SBVariablesOptions::GetInScopeOnly () const +{ + return m_opaque_ap->GetInScopeOnly(); +} + +void +SBVariablesOptions::SetInScopeOnly (bool in_scope_only) +{ + m_opaque_ap->SetInScopeOnly(in_scope_only); +} + +bool +SBVariablesOptions::GetIncludeRuntimeSupportValues () const +{ + return m_opaque_ap->GetIncludeRuntimeSupportValues(); +} + +void +SBVariablesOptions::SetIncludeRuntimeSupportValues (bool runtime_support_values) +{ + m_opaque_ap->SetIncludeRuntimeSupportValues(runtime_support_values); +} + +lldb::DynamicValueType +SBVariablesOptions::GetUseDynamic () const +{ + return m_opaque_ap->GetUseDynamic(); +} + +void +SBVariablesOptions::SetUseDynamic (lldb::DynamicValueType dynamic) +{ + m_opaque_ap->SetUseDynamic(dynamic); +} + +VariablesOptionsImpl * +SBVariablesOptions::operator->() +{ + return m_opaque_ap.operator->(); +} + +const VariablesOptionsImpl * +SBVariablesOptions::operator->() const +{ + return m_opaque_ap.operator->(); +} + +VariablesOptionsImpl * +SBVariablesOptions::get () +{ + return m_opaque_ap.get(); +} + +VariablesOptionsImpl & +SBVariablesOptions::ref() +{ + return *m_opaque_ap; +} + +const VariablesOptionsImpl & +SBVariablesOptions::ref() const +{ + return *m_opaque_ap; +} + +SBVariablesOptions::SBVariablesOptions (VariablesOptionsImpl *lldb_object_ptr) : +m_opaque_ap(std::move(lldb_object_ptr)) +{ +} + +void +SBVariablesOptions::SetOptions (VariablesOptionsImpl *lldb_object_ptr) +{ + m_opaque_ap.reset(std::move(lldb_object_ptr)); +} + diff --git a/source/API/SystemInitializerFull.cpp b/source/API/SystemInitializerFull.cpp new file mode 100644 index 0000000..731d38a --- /dev/null +++ b/source/API/SystemInitializerFull.cpp @@ -0,0 +1,392 @@ +//===-- SystemInitializerFull.cpp -------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/API/SystemInitializerFull.h" + +#include "lldb/Core/Debugger.h" +#include "lldb/Core/Timer.h" +#include "lldb/Host/Host.h" +#include "lldb/Initialization/SystemInitializerCommon.h" + +#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h" +#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h" +#include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h" +#include "Plugins/ABI/SysV-arm/ABISysV_arm.h" +#include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h" +#include "Plugins/ABI/SysV-i386/ABISysV_i386.h" +#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h" +#include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h" +#include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h" +#include "Plugins/ABI/SysV-mips/ABISysV_mips.h" +#include "Plugins/ABI/SysV-mips64/ABISysV_mips64.h" +#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h" +#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h" +#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h" +#include "Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h" +#include "Plugins/JITLoader/GDB/JITLoaderGDB.h" +#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h" +#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h" +#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h" +#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h" +#include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h" +#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h" +#include "Plugins/Process/elf-core/ProcessElfCore.h" +#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h" +#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h" +#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h" +#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h" +#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h" +#include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h" +#include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h" +#include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h" + +#if defined(__APPLE__) +#include "Plugins/Process/mach-core/ProcessMachCore.h" +#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h" +#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h" +#endif + +#if defined(__FreeBSD__) +#include "Plugins/Process/FreeBSD/ProcessFreeBSD.h" +#endif + +#if defined(_MSC_VER) +#include "lldb/Host/windows/windows.h" +#include "Plugins/Process/Windows/DynamicLoaderWindows.h" +#include "Plugins/Process/Windows/ProcessWindows.h" +#endif + +#if !defined(LLDB_DISABLE_PYTHON) +#include "lldb/Interpreter/ScriptInterpreterPython.h" +#endif + +#include "llvm/Support/TargetSelect.h" + +#include <string> + +using namespace lldb_private; + +#ifndef LLDB_DISABLE_PYTHON + +// Defined in the SWIG source file +extern "C" void +init_lldb(void); + +// these are the Pythonic implementations of the required callbacks +// these are scripting-language specific, which is why they belong here +// we still need to use function pointers to them instead of relying +// on linkage-time resolution because the SWIG stuff and this file +// get built at different times +extern "C" bool +LLDBSwigPythonBreakpointCallbackFunction (const char *python_function_name, + const char *session_dictionary_name, + const lldb::StackFrameSP& sb_frame, + const lldb::BreakpointLocationSP& sb_bp_loc); + +extern "C" bool +LLDBSwigPythonWatchpointCallbackFunction (const char *python_function_name, + const char *session_dictionary_name, + const lldb::StackFrameSP& sb_frame, + const lldb::WatchpointSP& sb_wp); + +extern "C" bool +LLDBSwigPythonCallTypeScript (const char *python_function_name, + void *session_dictionary, + const lldb::ValueObjectSP& valobj_sp, + void** pyfunct_wrapper, + const lldb::TypeSummaryOptionsSP& options_sp, + std::string& retval); + +extern "C" void* +LLDBSwigPythonCreateSyntheticProvider (const char *python_class_name, + const char *session_dictionary_name, + const lldb::ValueObjectSP& valobj_sp); + +extern "C" void* +LLDBSwigPythonCreateCommandObject (const char *python_class_name, + const char *session_dictionary_name, + const lldb::DebuggerSP debugger_sp); + +extern "C" void* +LLDBSwigPythonCreateScriptedThreadPlan (const char *python_class_name, + const char *session_dictionary_name, + const lldb::ThreadPlanSP& thread_plan_sp); + +extern "C" bool +LLDBSWIGPythonCallThreadPlan (void *implementor, + const char *method_name, + Event *event_sp, + bool &got_error); + +extern "C" size_t +LLDBSwigPython_CalculateNumChildren (void *implementor); + +extern "C" void * +LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx); + +extern "C" int +LLDBSwigPython_GetIndexOfChildWithName (void *implementor, const char* child_name); + +extern "C" void * +LLDBSWIGPython_CastPyObjectToSBValue (void* data); + +extern lldb::ValueObjectSP +LLDBSWIGPython_GetValueObjectSPFromSBValue (void* data); + +extern "C" bool +LLDBSwigPython_UpdateSynthProviderInstance (void* implementor); + +extern "C" bool +LLDBSwigPython_MightHaveChildrenSynthProviderInstance (void* implementor); + +extern "C" void * +LLDBSwigPython_GetValueSynthProviderInstance (void* implementor); + +extern "C" bool +LLDBSwigPythonCallCommand (const char *python_function_name, + const char *session_dictionary_name, + lldb::DebuggerSP& debugger, + const char* args, + lldb_private::CommandReturnObject &cmd_retobj, + lldb::ExecutionContextRefSP exe_ctx_ref_sp); + +extern "C" bool +LLDBSwigPythonCallCommandObject (void *implementor, + lldb::DebuggerSP& debugger, + const char* args, + lldb_private::CommandReturnObject& cmd_retobj, + lldb::ExecutionContextRefSP exe_ctx_ref_sp); + +extern "C" bool +LLDBSwigPythonCallModuleInit (const char *python_module_name, + const char *session_dictionary_name, + lldb::DebuggerSP& debugger); + +extern "C" void* +LLDBSWIGPythonCreateOSPlugin (const char *python_class_name, + const char *session_dictionary_name, + const lldb::ProcessSP& process_sp); + +extern "C" bool +LLDBSWIGPythonRunScriptKeywordProcess (const char* python_function_name, + const char* session_dictionary_name, + lldb::ProcessSP& process, + std::string& output); + +extern "C" bool +LLDBSWIGPythonRunScriptKeywordThread (const char* python_function_name, + const char* session_dictionary_name, + lldb::ThreadSP& thread, + std::string& output); + +extern "C" bool +LLDBSWIGPythonRunScriptKeywordTarget (const char* python_function_name, + const char* session_dictionary_name, + lldb::TargetSP& target, + std::string& output); + +extern "C" bool +LLDBSWIGPythonRunScriptKeywordFrame (const char* python_function_name, + const char* session_dictionary_name, + lldb::StackFrameSP& frame, + std::string& output); + +extern "C" bool +LLDBSWIGPythonRunScriptKeywordValue (const char* python_function_name, + const char* session_dictionary_name, + lldb::ValueObjectSP& value, + std::string& output); + +extern "C" void* +LLDBSWIGPython_GetDynamicSetting (void* module, + const char* setting, + const lldb::TargetSP& target_sp); + + +#endif + +SystemInitializerFull::SystemInitializerFull() +{ +} + +SystemInitializerFull::~SystemInitializerFull() +{ +} + +void +SystemInitializerFull::Initialize() +{ + InitializeSWIG(); + + SystemInitializerCommon::Initialize(); + + // Initialize LLVM and Clang + llvm::InitializeAllTargets(); + llvm::InitializeAllAsmPrinters(); + llvm::InitializeAllTargetMCs(); + llvm::InitializeAllDisassemblers(); + + ABIMacOSX_i386::Initialize(); + ABIMacOSX_arm::Initialize(); + ABIMacOSX_arm64::Initialize(); + ABISysV_arm::Initialize(); + ABISysV_arm64::Initialize(); + ABISysV_i386::Initialize(); + ABISysV_x86_64::Initialize(); + ABISysV_ppc::Initialize(); + ABISysV_ppc64::Initialize(); + ABISysV_mips::Initialize(); + ABISysV_mips64::Initialize(); + DisassemblerLLVMC::Initialize(); + + JITLoaderGDB::Initialize(); + ProcessElfCore::Initialize(); + MemoryHistoryASan::Initialize(); + AddressSanitizerRuntime::Initialize(); + + SymbolVendorELF::Initialize(); + SymbolFileDWARF::Initialize(); + SymbolFileSymtab::Initialize(); + UnwindAssemblyInstEmulation::Initialize(); + UnwindAssembly_x86::Initialize(); + EmulateInstructionARM64::Initialize(); + SymbolFileDWARFDebugMap::Initialize(); + ItaniumABILanguageRuntime::Initialize(); + AppleObjCRuntimeV2::Initialize(); + AppleObjCRuntimeV1::Initialize(); + SystemRuntimeMacOSX::Initialize(); + RenderScriptRuntime::Initialize(); + +#if defined(_MSC_VER) + DynamicLoaderWindows::Initialize(); + ProcessWindows::Initialize(); +#endif +#if defined(__FreeBSD__) + ProcessFreeBSD::Initialize(); +#endif +#if defined(__APPLE__) + SymbolVendorMacOSX::Initialize(); + ProcessKDP::Initialize(); + ProcessMachCore::Initialize(); +#endif + //---------------------------------------------------------------------- + // Platform agnostic plugins + //---------------------------------------------------------------------- + platform_gdb_server::PlatformRemoteGDBServer::Initialize(); + + process_gdb_remote::ProcessGDBRemote::Initialize(); + DynamicLoaderStatic::Initialize(); + + // Scan for any system or user LLDB plug-ins + PluginManager::Initialize(); + + // The process settings need to know about installed plug-ins, so the Settings must be initialized + // AFTER PluginManager::Initialize is called. + + Debugger::SettingsInitialize(); +} + +void SystemInitializerFull::InitializeSWIG() +{ +#if !defined(LLDB_DISABLE_PYTHON) + ScriptInterpreterPython::InitializeInterpreter( + init_lldb, + LLDBSwigPythonBreakpointCallbackFunction, + LLDBSwigPythonWatchpointCallbackFunction, + LLDBSwigPythonCallTypeScript, + LLDBSwigPythonCreateSyntheticProvider, + LLDBSwigPythonCreateCommandObject, + LLDBSwigPython_CalculateNumChildren, + LLDBSwigPython_GetChildAtIndex, + LLDBSwigPython_GetIndexOfChildWithName, + LLDBSWIGPython_CastPyObjectToSBValue, + LLDBSWIGPython_GetValueObjectSPFromSBValue, + LLDBSwigPython_UpdateSynthProviderInstance, + LLDBSwigPython_MightHaveChildrenSynthProviderInstance, + LLDBSwigPython_GetValueSynthProviderInstance, + LLDBSwigPythonCallCommand, + LLDBSwigPythonCallCommandObject, + LLDBSwigPythonCallModuleInit, + LLDBSWIGPythonCreateOSPlugin, + LLDBSWIGPythonRunScriptKeywordProcess, + LLDBSWIGPythonRunScriptKeywordThread, + LLDBSWIGPythonRunScriptKeywordTarget, + LLDBSWIGPythonRunScriptKeywordFrame, + LLDBSWIGPythonRunScriptKeywordValue, + LLDBSWIGPython_GetDynamicSetting, + LLDBSwigPythonCreateScriptedThreadPlan, + LLDBSWIGPythonCallThreadPlan); +#endif +} + +void +SystemInitializerFull::Terminate() +{ + Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__); + + Debugger::SettingsTerminate(); + + // Terminate and unload and loaded system or user LLDB plug-ins + PluginManager::Terminate(); + ABIMacOSX_i386::Terminate(); + ABIMacOSX_arm::Terminate(); + ABIMacOSX_arm64::Terminate(); + ABISysV_arm::Terminate(); + ABISysV_arm64::Terminate(); + ABISysV_i386::Terminate(); + ABISysV_x86_64::Terminate(); + ABISysV_ppc::Terminate(); + ABISysV_ppc64::Terminate(); + ABISysV_mips::Terminate(); + ABISysV_mips64::Terminate(); + DisassemblerLLVMC::Terminate(); + + JITLoaderGDB::Terminate(); + ProcessElfCore::Terminate(); + MemoryHistoryASan::Terminate(); + AddressSanitizerRuntime::Terminate(); + SymbolVendorELF::Terminate(); + SymbolFileDWARF::Terminate(); + SymbolFileSymtab::Terminate(); + UnwindAssembly_x86::Terminate(); + UnwindAssemblyInstEmulation::Terminate(); + EmulateInstructionARM64::Terminate(); + SymbolFileDWARFDebugMap::Terminate(); + ItaniumABILanguageRuntime::Terminate(); + AppleObjCRuntimeV2::Terminate(); + AppleObjCRuntimeV1::Terminate(); + SystemRuntimeMacOSX::Terminate(); + RenderScriptRuntime::Terminate(); + +#if defined(__APPLE__) + ProcessMachCore::Terminate(); + ProcessKDP::Terminate(); + SymbolVendorMacOSX::Terminate(); +#endif +#if defined(_MSC_VER) + DynamicLoaderWindows::Terminate(); +#endif + +#if defined(__FreeBSD__) + ProcessFreeBSD::Terminate(); +#endif + Debugger::SettingsTerminate(); + + platform_gdb_server::PlatformRemoteGDBServer::Terminate(); + process_gdb_remote::ProcessGDBRemote::Terminate(); + DynamicLoaderStatic::Terminate(); + + // Now shutdown the common parts, in reverse order. + SystemInitializerCommon::Terminate(); +} + +void SystemInitializerFull::TerminateSWIG() +{ + +} |