summaryrefslogtreecommitdiff
path: root/source/API
diff options
context:
space:
mode:
Diffstat (limited to 'source/API')
-rw-r--r--source/API/CMakeLists.txt2
-rw-r--r--source/API/Makefile18
-rw-r--r--source/API/SBAddress.cpp3
-rw-r--r--source/API/SBBlock.cpp8
-rw-r--r--source/API/SBBreakpoint.cpp66
-rw-r--r--source/API/SBBreakpointLocation.cpp42
-rw-r--r--source/API/SBBroadcaster.cpp6
-rw-r--r--source/API/SBCommandInterpreter.cpp10
-rw-r--r--source/API/SBCommandReturnObject.cpp18
-rw-r--r--source/API/SBDebugger.cpp18
-rw-r--r--source/API/SBExpressionOptions.cpp24
-rw-r--r--source/API/SBFileSpec.cpp6
-rw-r--r--source/API/SBFrame.cpp230
-rw-r--r--source/API/SBFunction.cpp4
-rw-r--r--source/API/SBHostOS.cpp16
-rw-r--r--source/API/SBInstruction.cpp180
-rw-r--r--source/API/SBInstructionList.cpp2
-rw-r--r--source/API/SBListener.cpp129
-rw-r--r--source/API/SBMemoryRegionInfo.cpp126
-rw-r--r--source/API/SBMemoryRegionInfoList.cpp162
-rw-r--r--source/API/SBModule.cpp3
-rw-r--r--source/API/SBProcess.cpp155
-rw-r--r--source/API/SBStringList.cpp10
-rw-r--r--source/API/SBSymbol.cpp5
-rw-r--r--source/API/SBTarget.cpp226
-rw-r--r--source/API/SBThread.cpp227
-rw-r--r--source/API/SBValue.cpp47
-rw-r--r--source/API/SBWatchpoint.cpp22
-rw-r--r--source/API/SystemInitializerFull.cpp96
-rw-r--r--source/API/liblldb.exports1
30 files changed, 1321 insertions, 541 deletions
diff --git a/source/API/CMakeLists.txt b/source/API/CMakeLists.txt
index 06a26e17c9298..2ed42cac062e2 100644
--- a/source/API/CMakeLists.txt
+++ b/source/API/CMakeLists.txt
@@ -35,6 +35,8 @@ add_lldb_library(liblldb SHARED
SBLaunchInfo.cpp
SBLineEntry.cpp
SBListener.cpp
+ SBMemoryRegionInfo.cpp
+ SBMemoryRegionInfoList.cpp
SBModule.cpp
SBModuleSpec.cpp
SBPlatform.cpp
diff --git a/source/API/Makefile b/source/API/Makefile
deleted file mode 100644
index e35b2c37735e5..0000000000000
--- a/source/API/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-##===- source/API/Makefile ---------------------------------*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LLDB_LEVEL := ../..
-LIBRARYNAME := lldbAPI
-BUILD_ARCHIVE = 1
-
-include $(LLDB_LEVEL)/Makefile
-
-ifeq ($(HOST_OS),MingW)
-CXXFLAGS += -DEXPORT_LIBLLDB
-endif
diff --git a/source/API/SBAddress.cpp b/source/API/SBAddress.cpp
index f95fcb8b39854..470ea5659f289 100644
--- a/source/API/SBAddress.cpp
+++ b/source/API/SBAddress.cpp
@@ -15,7 +15,6 @@
#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"
@@ -125,7 +124,7 @@ SBAddress::GetLoadAddress (const SBTarget &target) const
{
if (m_opaque_ap->IsValid())
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
addr = m_opaque_ap->GetLoadAddress (target_sp.get());
}
}
diff --git a/source/API/SBBlock.cpp b/source/API/SBBlock.cpp
index fdbbbc0452793..03ee7343c9f5d 100644
--- a/source/API/SBBlock.cpp
+++ b/source/API/SBBlock.cpp
@@ -131,7 +131,11 @@ SBBlock::AppendVariables (bool can_create, bool get_parent_variables, lldb_priva
if (IsValid())
{
bool show_inline = true;
- m_opaque_ptr->AppendVariables (can_create, get_parent_variables, show_inline, var_list);
+ m_opaque_ptr->AppendVariables (can_create,
+ get_parent_variables,
+ show_inline,
+ [](Variable*) { return true; },
+ var_list);
}
}
@@ -290,6 +294,7 @@ SBBlock::GetVariables (lldb::SBFrame& frame,
{
case eValueTypeVariableGlobal:
case eValueTypeVariableStatic:
+ case eValueTypeVariableThreadLocal:
add_variable = statics;
break;
@@ -352,6 +357,7 @@ SBBlock::GetVariables (lldb::SBTarget& target,
{
case eValueTypeVariableGlobal:
case eValueTypeVariableStatic:
+ case eValueTypeVariableThreadLocal:
add_variable = statics;
break;
diff --git a/source/API/SBBreakpoint.cpp b/source/API/SBBreakpoint.cpp
index 1f58ddb7152a4..ec3a3de4a7886 100644
--- a/source/API/SBBreakpoint.cpp
+++ b/source/API/SBBreakpoint.cpp
@@ -149,7 +149,7 @@ SBBreakpoint::ClearAllBreakpointSites ()
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->ClearAllBreakpointSites ();
}
}
@@ -163,7 +163,7 @@ SBBreakpoint::FindLocationByAddress (addr_t vm_addr)
{
if (vm_addr != LLDB_INVALID_ADDRESS)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
Address address;
Target &target = m_opaque_sp->GetTarget();
if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address))
@@ -183,7 +183,7 @@ SBBreakpoint::FindLocationIDByAddress (addr_t vm_addr)
if (m_opaque_sp && vm_addr != LLDB_INVALID_ADDRESS)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
Address address;
Target &target = m_opaque_sp->GetTarget();
if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address))
@@ -203,7 +203,7 @@ SBBreakpoint::FindLocationByID (break_id_t bp_loc_id)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
sb_bp_location.SetLocation (m_opaque_sp->FindLocationByID (bp_loc_id));
}
@@ -217,7 +217,7 @@ SBBreakpoint::GetLocationAtIndex (uint32_t index)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
sb_bp_location.SetLocation (m_opaque_sp->GetLocationAtIndex (index));
}
@@ -235,7 +235,7 @@ SBBreakpoint::SetEnabled (bool enable)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetEnabled (enable);
}
}
@@ -245,7 +245,7 @@ SBBreakpoint::IsEnabled ()
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->IsEnabled();
}
else
@@ -263,7 +263,7 @@ SBBreakpoint::SetOneShot (bool one_shot)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetOneShot (one_shot);
}
}
@@ -273,7 +273,7 @@ SBBreakpoint::IsOneShot () const
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->IsOneShot();
}
else
@@ -285,7 +285,7 @@ SBBreakpoint::IsInternal ()
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->IsInternal();
}
else
@@ -303,7 +303,7 @@ SBBreakpoint::SetIgnoreCount (uint32_t count)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetIgnoreCount (count);
}
}
@@ -313,7 +313,7 @@ SBBreakpoint::SetCondition (const char *condition)
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetCondition (condition);
}
}
@@ -323,7 +323,7 @@ SBBreakpoint::GetCondition ()
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->GetConditionText ();
}
return nullptr;
@@ -335,7 +335,7 @@ SBBreakpoint::GetHitCount () const
uint32_t count = 0;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
count = m_opaque_sp->GetHitCount();
}
@@ -353,7 +353,7 @@ SBBreakpoint::GetIgnoreCount () const
uint32_t count = 0;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
count = m_opaque_sp->GetIgnoreCount();
}
@@ -370,7 +370,7 @@ SBBreakpoint::SetThreadID (tid_t tid)
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetThreadID (tid);
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -385,7 +385,7 @@ SBBreakpoint::GetThreadID ()
tid_t tid = LLDB_INVALID_THREAD_ID;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
tid = m_opaque_sp->GetThreadID();
}
@@ -405,7 +405,7 @@ SBBreakpoint::SetThreadIndex (uint32_t index)
static_cast<void*>(m_opaque_sp.get()), index);
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->GetOptions()->GetThreadSpec()->SetIndex (index);
}
}
@@ -416,7 +416,7 @@ SBBreakpoint::GetThreadIndex() const
uint32_t thread_idx = UINT32_MAX;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpecNoCreate();
if (thread_spec != nullptr)
thread_idx = thread_spec->GetIndex();
@@ -439,7 +439,7 @@ SBBreakpoint::SetThreadName (const char *thread_name)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->GetOptions()->GetThreadSpec()->SetName (thread_name);
}
}
@@ -450,7 +450,7 @@ SBBreakpoint::GetThreadName () const
const char *name = nullptr;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpecNoCreate();
if (thread_spec != nullptr)
name = thread_spec->GetName();
@@ -472,7 +472,7 @@ SBBreakpoint::SetQueueName (const char *queue_name)
static_cast<void*>(m_opaque_sp.get()), queue_name);
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->GetOptions()->GetThreadSpec()->SetQueueName (queue_name);
}
}
@@ -483,7 +483,7 @@ SBBreakpoint::GetQueueName () const
const char *name = nullptr;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpecNoCreate();
if (thread_spec)
name = thread_spec->GetQueueName();
@@ -502,7 +502,7 @@ SBBreakpoint::GetNumResolvedLocations() const
size_t num_resolved = 0;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
num_resolved = m_opaque_sp->GetNumResolvedLocations();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -519,7 +519,7 @@ SBBreakpoint::GetNumLocations() const
size_t num_locs = 0;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
num_locs = m_opaque_sp->GetNumLocations();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -535,7 +535,7 @@ SBBreakpoint::GetDescription (SBStream &s)
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
s.Printf("SBBreakpoint: id = %i, ", m_opaque_sp->GetID());
m_opaque_sp->GetResolverDescription (s.get());
m_opaque_sp->GetFilterDescription (s.get());
@@ -598,7 +598,7 @@ SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton));
m_opaque_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false);
}
@@ -616,7 +616,7 @@ SBBreakpoint::SetScriptCallbackFunction (const char *callback_function_name)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
BreakpointOptions *bp_options = m_opaque_sp->GetOptions();
m_opaque_sp->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallbackFunction (bp_options,
callback_function_name);
@@ -635,7 +635,7 @@ SBBreakpoint::SetScriptCallbackBody (const char *callback_body_text)
SBError sb_error;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
BreakpointOptions *bp_options = m_opaque_sp->GetOptions();
Error error = m_opaque_sp->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
callback_body_text);
@@ -659,7 +659,7 @@ SBBreakpoint::AddName (const char *new_name)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
Error error; // Think I'm just going to swallow the error here, it's probably more annoying to have to provide it.
return m_opaque_sp->AddName(new_name, error);
}
@@ -679,7 +679,7 @@ SBBreakpoint::RemoveName (const char *name_to_remove)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->RemoveName(name_to_remove);
}
}
@@ -696,7 +696,7 @@ SBBreakpoint::MatchesName (const char *name)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->MatchesName(name);
}
@@ -714,7 +714,7 @@ SBBreakpoint::GetNames (SBStringList &names)
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
std::vector<std::string> names_vec;
m_opaque_sp->GetNames(names_vec);
for (std::string name : names_vec)
diff --git a/source/API/SBBreakpointLocation.cpp b/source/API/SBBreakpointLocation.cpp
index 4390e9ad737a4..631a32bc9ddaf 100644
--- a/source/API/SBBreakpointLocation.cpp
+++ b/source/API/SBBreakpointLocation.cpp
@@ -92,7 +92,7 @@ SBBreakpointLocation::GetLoadAddress ()
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
ret_addr = m_opaque_sp->GetLoadAddress();
}
@@ -104,7 +104,7 @@ SBBreakpointLocation::SetEnabled (bool enabled)
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetEnabled (enabled);
}
}
@@ -114,7 +114,7 @@ SBBreakpointLocation::IsEnabled ()
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->IsEnabled();
}
else
@@ -126,7 +126,7 @@ SBBreakpointLocation::GetIgnoreCount ()
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->GetIgnoreCount();
}
else
@@ -138,7 +138,7 @@ SBBreakpointLocation::SetIgnoreCount (uint32_t n)
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetIgnoreCount (n);
}
}
@@ -148,7 +148,7 @@ SBBreakpointLocation::SetCondition (const char *condition)
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetCondition (condition);
}
}
@@ -158,7 +158,7 @@ SBBreakpointLocation::GetCondition ()
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->GetConditionText ();
}
return NULL;
@@ -176,7 +176,7 @@ SBBreakpointLocation::SetScriptCallbackFunction (const char *callback_function_n
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
m_opaque_sp->GetBreakpoint().GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallbackFunction (bp_options,
callback_function_name);
@@ -195,7 +195,7 @@ SBBreakpointLocation::SetScriptCallbackBody (const char *callback_body_text)
SBError sb_error;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
Error error = m_opaque_sp->GetBreakpoint().GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
callback_body_text);
@@ -212,7 +212,7 @@ SBBreakpointLocation::SetThreadID (tid_t thread_id)
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetThreadID (thread_id);
}
}
@@ -223,7 +223,7 @@ SBBreakpointLocation::GetThreadID ()
tid_t tid = LLDB_INVALID_THREAD_ID;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->GetThreadID();
}
return tid;
@@ -234,7 +234,7 @@ SBBreakpointLocation::SetThreadIndex (uint32_t index)
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetThreadIndex (index);
}
}
@@ -245,7 +245,7 @@ SBBreakpointLocation::GetThreadIndex() const
uint32_t thread_idx = UINT32_MAX;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->GetThreadIndex();
}
return thread_idx;
@@ -257,7 +257,7 @@ SBBreakpointLocation::SetThreadName (const char *thread_name)
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetThreadName (thread_name);
}
}
@@ -267,7 +267,7 @@ SBBreakpointLocation::GetThreadName () const
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->GetThreadName();
}
return NULL;
@@ -278,7 +278,7 @@ SBBreakpointLocation::SetQueueName (const char *queue_name)
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->SetQueueName (queue_name);
}
}
@@ -288,7 +288,7 @@ SBBreakpointLocation::GetQueueName () const
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->GetQueueName ();
}
return NULL;
@@ -299,7 +299,7 @@ SBBreakpointLocation::IsResolved ()
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->IsResolved();
}
return false;
@@ -319,7 +319,7 @@ SBBreakpointLocation::GetDescription (SBStream &description, DescriptionLevel le
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
m_opaque_sp->GetDescription (&strm, level);
strm.EOL();
}
@@ -334,7 +334,7 @@ SBBreakpointLocation::GetID ()
{
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
return m_opaque_sp->GetID ();
}
else
@@ -352,7 +352,7 @@ SBBreakpointLocation::GetBreakpoint ()
SBBreakpoint sb_bp;
if (m_opaque_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
*sb_bp = m_opaque_sp->GetBreakpoint ().shared_from_this();
}
diff --git a/source/API/SBBroadcaster.cpp b/source/API/SBBroadcaster.cpp
index 73eac5183f8a1..4b751adc295f5 100644
--- a/source/API/SBBroadcaster.cpp
+++ b/source/API/SBBroadcaster.cpp
@@ -117,14 +117,14 @@ SBBroadcaster::AddInitialEventsToListener (const SBListener &listener, uint32_t
static_cast<void*>(m_opaque_ptr),
static_cast<void*>(listener.get()), requested_events);
if (m_opaque_ptr)
- m_opaque_ptr->AddInitialEventsToListener (listener.get(), requested_events);
+ m_opaque_ptr->AddInitialEventsToListener (listener.m_opaque_sp, requested_events);
}
uint32_t
SBBroadcaster::AddListener (const SBListener &listener, uint32_t event_mask)
{
if (m_opaque_ptr)
- return m_opaque_ptr->AddListener (listener.get(), event_mask);
+ return m_opaque_ptr->AddListener (listener.m_opaque_sp, event_mask);
return 0;
}
@@ -148,7 +148,7 @@ bool
SBBroadcaster::RemoveListener (const SBListener &listener, uint32_t event_mask)
{
if (m_opaque_ptr)
- return m_opaque_ptr->RemoveListener (listener.get(), event_mask);
+ return m_opaque_ptr->RemoveListener (listener.m_opaque_sp, event_mask);
return false;
}
diff --git a/source/API/SBCommandInterpreter.cpp b/source/API/SBCommandInterpreter.cpp
index 21f431dac6a32..dfa1709a34916 100644
--- a/source/API/SBCommandInterpreter.cpp
+++ b/source/API/SBCommandInterpreter.cpp
@@ -398,7 +398,7 @@ SBCommandInterpreter::GetProcess ()
TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
if (target_sp)
{
- Mutex::Locker api_locker(target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
process_sp = target_sp->GetProcessSP();
sb_process.SetSP(process_sp);
}
@@ -483,9 +483,9 @@ SBCommandInterpreter::SourceInitFileInHomeDirectory (SBCommandReturnObject &resu
if (IsValid())
{
TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
- Mutex::Locker api_locker;
+ std::unique_lock<std::recursive_mutex> lock;
if (target_sp)
- api_locker.Lock(target_sp->GetAPIMutex());
+ lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
m_opaque_ptr->SourceInitFile (false, result.ref());
}
else
@@ -508,9 +508,9 @@ SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnOb
if (IsValid())
{
TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
- Mutex::Locker api_locker;
+ std::unique_lock<std::recursive_mutex> lock;
if (target_sp)
- api_locker.Lock(target_sp->GetAPIMutex());
+ lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
m_opaque_ptr->SourceInitFile (true, result.ref());
}
else
diff --git a/source/API/SBCommandReturnObject.cpp b/source/API/SBCommandReturnObject.cpp
index a2ed4d6e8c26d..a7bc31da8a891 100644
--- a/source/API/SBCommandReturnObject.cpp
+++ b/source/API/SBCommandReturnObject.cpp
@@ -258,15 +258,27 @@ SBCommandReturnObject::GetDescription (SBStream &description)
void
SBCommandReturnObject::SetImmediateOutputFile(FILE *fh)
{
- if (m_opaque_ap)
- m_opaque_ap->SetImmediateOutputFile(fh);
+ SetImmediateOutputFile(fh, false);
}
void
SBCommandReturnObject::SetImmediateErrorFile(FILE *fh)
{
+ SetImmediateErrorFile(fh, false);
+}
+
+void
+SBCommandReturnObject::SetImmediateOutputFile(FILE *fh, bool transfer_ownership)
+{
+ if (m_opaque_ap)
+ m_opaque_ap->SetImmediateOutputFile(fh, transfer_ownership);
+}
+
+void
+SBCommandReturnObject::SetImmediateErrorFile(FILE *fh, bool transfer_ownership)
+{
if (m_opaque_ap)
- m_opaque_ap->SetImmediateErrorFile(fh);
+ m_opaque_ap->SetImmediateErrorFile(fh, transfer_ownership);
}
void
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 1645294b5a3fa..3493ad507a718 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -191,8 +191,8 @@ SBDebugger::Create(bool source_init_files, lldb::LogOutputCallback callback, voi
// uses global collections and having two threads parsing the .lldbinit files can cause
// mayhem. So to get around this for now we need to use a mutex to prevent bad things
// from happening.
- static Mutex g_mutex(Mutex::eMutexTypeRecursive);
- Mutex::Locker locker(g_mutex);
+ static std::recursive_mutex g_mutex;
+ std::lock_guard<std::recursive_mutex> guard(g_mutex);
debugger.reset(Debugger::CreateInstance(callback, baton));
@@ -411,9 +411,9 @@ SBDebugger::HandleCommand (const char *command)
if (m_opaque_sp)
{
TargetSP target_sp (m_opaque_sp->GetSelectedTarget());
- Mutex::Locker api_locker;
+ std::unique_lock<std::recursive_mutex> lock;
if (target_sp)
- api_locker.Lock(target_sp->GetAPIMutex());
+ lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
SBCommandInterpreter sb_interpreter(GetCommandInterpreter ());
SBCommandReturnObject result;
@@ -432,8 +432,8 @@ SBDebugger::HandleCommand (const char *command)
if (process_sp)
{
EventSP event_sp;
- Listener &lldb_listener = m_opaque_sp->GetListener();
- while (lldb_listener.GetNextEventForBroadcaster (process_sp.get(), event_sp))
+ ListenerSP lldb_listener_sp = m_opaque_sp->GetListener();
+ while (lldb_listener_sp->GetNextEventForBroadcaster (process_sp.get(), event_sp))
{
SBEvent event(event_sp);
HandleProcessEvent (process, event, GetOutputFileHandle(), GetErrorFileHandle());
@@ -450,7 +450,7 @@ SBDebugger::GetListener ()
SBListener sb_listener;
if (m_opaque_sp)
- sb_listener.reset(&m_opaque_sp->GetListener(), false);
+ sb_listener.reset(m_opaque_sp->GetListener());
if (log)
log->Printf ("SBDebugger(%p)::GetListener () => SBListener(%p)",
@@ -474,8 +474,8 @@ SBDebugger::HandleProcessEvent (const SBProcess &process, const SBEvent &event,
char stdio_buffer[1024];
size_t len;
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
-
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
+
if (event_type & (Process::eBroadcastBitSTDOUT | Process::eBroadcastBitStateChanged))
{
// Drain stdout when we stop just in case we have any bytes
diff --git a/source/API/SBExpressionOptions.cpp b/source/API/SBExpressionOptions.cpp
index 43b7d03064f5e..328a96ef6b531 100644
--- a/source/API/SBExpressionOptions.cpp
+++ b/source/API/SBExpressionOptions.cpp
@@ -197,6 +197,30 @@ SBExpressionOptions::SetPrefix (const char *prefix)
return m_opaque_ap->SetPrefix(prefix);
}
+bool
+SBExpressionOptions::GetAutoApplyFixIts ()
+{
+ return m_opaque_ap->GetAutoApplyFixIts ();
+}
+
+void
+SBExpressionOptions::SetAutoApplyFixIts (bool b)
+{
+ return m_opaque_ap->SetAutoApplyFixIts (b);
+}
+
+bool
+SBExpressionOptions::GetTopLevel ()
+{
+ return m_opaque_ap->GetExecutionPolicy() == eExecutionPolicyTopLevel;
+}
+
+void
+SBExpressionOptions::SetTopLevel (bool b)
+{
+ m_opaque_ap->SetExecutionPolicy(b ? eExecutionPolicyTopLevel : m_opaque_ap->default_execution_policy);
+}
+
EvaluateExpressionOptions *
SBExpressionOptions::get() const
{
diff --git a/source/API/SBFileSpec.cpp b/source/API/SBFileSpec.cpp
index dd7435de1b5bd..23bc5bc8eb65e 100644
--- a/source/API/SBFileSpec.cpp
+++ b/source/API/SBFileSpec.cpp
@@ -211,3 +211,9 @@ SBFileSpec::GetDescription (SBStream &description) const
strm.PutCString (path);
return true;
}
+
+void
+SBFileSpec::AppendPathComponent (const char *fn)
+{
+ m_opaque_ap->AppendPathComponent (fn);
+}
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index 02a215beb07d6..38bbfb8675ff0 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -10,6 +10,7 @@
// C Includes
// C++ Includes
#include <algorithm>
+#include <set>
#include <string>
// Other libraries and framework includes
@@ -104,7 +105,20 @@ SBFrame::SetFrameSP (const StackFrameSP &lldb_object_sp)
bool
SBFrame::IsValid() const
{
- return GetFrameSP().get() != nullptr;
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
+ Target *target = exe_ctx.GetTargetPtr();
+ Process *process = exe_ctx.GetProcessPtr();
+ if (target && process)
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&process->GetRunLock()))
+ return GetFrameSP().get() != nullptr;
+ }
+
+ // Without a target & process we can't have a valid stack frame.
+ return false;
}
SBSymbolContext
@@ -112,8 +126,8 @@ SBFrame::GetSymbolContext (uint32_t resolve_scope) const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBSymbolContext sb_sym_ctx;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -155,8 +169,8 @@ SBFrame::GetModule () const
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBModule sb_module;
ModuleSP module_sp;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -198,8 +212,8 @@ SBFrame::GetCompileUnit () const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBCompileUnit sb_comp_unit;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -239,8 +253,8 @@ SBFrame::GetFunction () const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBFunction sb_function;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -280,8 +294,8 @@ SBFrame::GetSymbol () const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBSymbol sb_symbol;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -320,8 +334,8 @@ SBFrame::GetBlock () const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBlock sb_block;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -360,8 +374,8 @@ SBBlock
SBFrame::GetFrameBlock () const
{
SBBlock sb_block;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -401,8 +415,8 @@ SBFrame::GetLineEntry () const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBLineEntry sb_line_entry;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -441,7 +455,9 @@ SBFrame::GetFrameID () const
{
uint32_t frame_idx = UINT32_MAX;
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
StackFrame *frame = exe_ctx.GetFramePtr();
if (frame)
frame_idx = frame->GetFrameIndex ();
@@ -456,7 +472,9 @@ SBFrame::GetFrameID () const
lldb::addr_t
SBFrame::GetCFA () const
{
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
StackFrame *frame = exe_ctx.GetFramePtr();
if (frame)
return frame->GetStackID().GetCallFrameAddress();
@@ -468,8 +486,8 @@ SBFrame::GetPC () const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
addr_t addr = LLDB_INVALID_ADDRESS;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -509,8 +527,8 @@ SBFrame::SetPC (addr_t new_pc)
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool ret_val = false;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -550,8 +568,8 @@ SBFrame::GetSP () const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
addr_t addr = LLDB_INVALID_ADDRESS;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -590,8 +608,8 @@ SBFrame::GetFP () const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
addr_t addr = LLDB_INVALID_ADDRESS;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -630,8 +648,8 @@ SBFrame::GetPCAddress () const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBAddress sb_addr;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
@@ -675,7 +693,9 @@ lldb::SBValue
SBFrame::GetValueForVariablePath (const char *var_path)
{
SBValue sb_value;
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
StackFrame *frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
if (frame && target)
@@ -690,7 +710,6 @@ lldb::SBValue
SBFrame::GetValueForVariablePath (const char *var_path, DynamicValueType use_dynamic)
{
SBValue sb_value;
- Mutex::Locker api_locker;
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (var_path == nullptr || var_path[0] == '\0')
{
@@ -698,8 +717,9 @@ SBFrame::GetValueForVariablePath (const char *var_path, DynamicValueType use_dyn
log->Printf ("SBFrame::GetValueForVariablePath called with empty variable path.");
return sb_value;
}
-
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -740,7 +760,9 @@ SBValue
SBFrame::FindVariable (const char *name)
{
SBValue value;
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
StackFrame *frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
if (frame && target)
@@ -766,8 +788,8 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
}
ValueObjectSP value_sp;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -789,9 +811,10 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
const bool get_parent_variables = true;
const bool stop_if_block_is_inlined_function = true;
- if (sc.block->AppendVariables (can_create,
+ if (sc.block->AppendVariables (can_create,
get_parent_variables,
stop_if_block_is_inlined_function,
+ [frame](Variable* v) { return v->IsInScope(frame); },
&variable_list))
{
var_sp = variable_list.FindVariable (ConstString(name));
@@ -829,7 +852,9 @@ SBValue
SBFrame::FindValue (const char *name, ValueType value_type)
{
SBValue value;
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
StackFrame *frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
if (frame && target)
@@ -854,8 +879,8 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
}
ValueObjectSP value_sp;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -876,32 +901,31 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
case eValueTypeVariableStatic: // static variable
case eValueTypeVariableArgument: // function argument variables
case eValueTypeVariableLocal: // function local variables
+ case eValueTypeVariableThreadLocal: // thread local variables
+ {
+ 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,
+ [frame](Variable *v) { return v->IsInScope(frame); }, &variable_list);
+ if (value_type == eValueTypeVariableGlobal)
{
- 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 (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);
- }
+ 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;
@@ -1011,7 +1035,9 @@ SBFrame::GetThread () const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
ThreadSP thread_sp (exe_ctx.GetThreadSP());
SBThread sb_thread (thread_sp);
@@ -1032,8 +1058,8 @@ SBFrame::Disassemble () const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *disassembly = nullptr;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -1075,7 +1101,9 @@ SBFrame::GetVariables (bool arguments,
bool in_scope_only)
{
SBValueList value_list;
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
StackFrame *frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
if (frame && target)
@@ -1103,7 +1131,9 @@ SBFrame::GetVariables (bool arguments,
bool in_scope_only,
lldb::DynamicValueType use_dynamic)
{
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
Target *target = exe_ctx.GetTargetPtr();
const bool include_runtime_support_values = target ? target->GetDisplayRuntimeSupportValues() : false;
SBVariablesOptions options;
@@ -1122,8 +1152,8 @@ SBFrame::GetVariables (const lldb::SBVariablesOptions& options)
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBValueList value_list;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -1140,7 +1170,8 @@ SBFrame::GetVariables (const lldb::SBVariablesOptions& options)
arguments, locals,
statics, in_scope_only,
include_runtime_support_values, use_dynamic);
-
+
+ std::set<VariableSP> variable_set;
Process *process = exe_ctx.GetProcessPtr();
if (target && process)
{
@@ -1168,6 +1199,7 @@ SBFrame::GetVariables (const lldb::SBVariablesOptions& options)
{
case eValueTypeVariableGlobal:
case eValueTypeVariableStatic:
+ case eValueTypeVariableThreadLocal:
add_variable = statics;
break;
@@ -1184,6 +1216,12 @@ SBFrame::GetVariables (const lldb::SBVariablesOptions& options)
}
if (add_variable)
{
+ // Only add variables once so we don't end up with duplicates
+ if (variable_set.find(variable_sp) == variable_set.end())
+ variable_set.insert(variable_sp);
+ else
+ continue;
+
if (in_scope_only && !variable_sp->IsInScope(frame))
continue;
@@ -1230,8 +1268,8 @@ SBFrame::GetRegisters ()
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBValueList value_list;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -1282,8 +1320,8 @@ SBFrame::FindRegister (const char *name)
SBValue result;
ValueObjectSP value_sp;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
@@ -1341,8 +1379,8 @@ SBFrame::GetDescription (SBStream &description)
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Stream &strm = description.ref();
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrame *frame;
Target *target = exe_ctx.GetTargetPtr();
@@ -1380,7 +1418,9 @@ SBValue
SBFrame::EvaluateExpression (const char *expr)
{
SBValue result;
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
StackFrame *frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
if (frame && target)
@@ -1389,6 +1429,7 @@ SBFrame::EvaluateExpression (const char *expr)
lldb::DynamicValueType fetch_dynamic_value = frame->CalculateTarget()->GetPreferDynamicValue();
options.SetFetchDynamicValue (fetch_dynamic_value);
options.SetUnwindOnError (true);
+ options.SetIgnoreBreakpoints (true);
if (target->GetLanguage() != eLanguageTypeUnknown)
options.SetLanguage(target->GetLanguage());
else
@@ -1404,7 +1445,10 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
SBExpressionOptions options;
options.SetFetchDynamicValue (fetch_dynamic_value);
options.SetUnwindOnError (true);
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ options.SetIgnoreBreakpoints (true);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
StackFrame *frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
if (target && target->GetLanguage() != eLanguageTypeUnknown)
@@ -1418,9 +1462,12 @@ SBValue
SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dynamic_value, bool unwind_on_error)
{
SBExpressionOptions options;
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
options.SetFetchDynamicValue (fetch_dynamic_value);
options.SetUnwindOnError (unwind_on_error);
+ options.SetIgnoreBreakpoints (true);
StackFrame *frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
if (target && target->GetLanguage() != eLanguageTypeUnknown)
@@ -1435,7 +1482,9 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+#ifndef LLDB_DISABLE_PYTHON
Log *expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+#endif
ExpressionResults exe_results = eExpressionSetupError;
SBValue expr_result;
@@ -1449,8 +1498,8 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option
ValueObjectSP expr_value_sp;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (log)
log->Printf ("SBFrame()::EvaluateExpression (expr=\"%s\")...", expr);
@@ -1521,7 +1570,9 @@ bool
SBFrame::IsInlined() const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
Process *process = exe_ctx.GetProcessPtr();
@@ -1565,7 +1616,9 @@ SBFrame::GetFunctionName() const
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *name = nullptr;
- ExecutionContext exe_ctx(m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
Process *process = exe_ctx.GetProcessPtr();
@@ -1621,7 +1674,10 @@ SBFrame::GetDisplayFunctionName()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *name = nullptr;
- ExecutionContext exe_ctx(m_opaque_sp.get());
+
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
Process *process = exe_ctx.GetProcessPtr();
diff --git a/source/API/SBFunction.cpp b/source/API/SBFunction.cpp
index 2d03d53fd9f7e..b5983d763be11 100644
--- a/source/API/SBFunction.cpp
+++ b/source/API/SBFunction.cpp
@@ -156,12 +156,12 @@ SBFunction::GetInstructions (SBTarget target, const char *flavor)
SBInstructionList sb_instructions;
if (m_opaque_ptr)
{
- Mutex::Locker api_locker;
ExecutionContext exe_ctx;
TargetSP target_sp (target.GetSP());
+ std::unique_lock<std::recursive_mutex> lock;
if (target_sp)
{
- api_locker.Lock (target_sp->GetAPIMutex());
+ lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
target_sp->CalculateExecutionContext (exe_ctx);
exe_ctx.SetProcessSP(target_sp->GetProcessSP());
}
diff --git a/source/API/SBHostOS.cpp b/source/API/SBHostOS.cpp
index 008ca4d9672ee..6c172997bdc81 100644
--- a/source/API/SBHostOS.cpp
+++ b/source/API/SBHostOS.cpp
@@ -17,6 +17,9 @@
#include "lldb/Host/HostThread.h"
#include "lldb/Host/ThreadLauncher.h"
+#include "llvm/Support/Path.h"
+#include "llvm/ADT/SmallString.h"
+
using namespace lldb;
using namespace lldb_private;
@@ -53,6 +56,19 @@ SBHostOS::GetLLDBPath (lldb::PathType path_type)
return sb_fspec;
}
+SBFileSpec
+SBHostOS::GetUserHomeDirectory ()
+{
+ SBFileSpec sb_fspec;
+
+ llvm::SmallString<64> home_dir_path;
+ llvm::sys::path::home_directory (home_dir_path);
+ FileSpec homedir (home_dir_path.c_str(), true);
+
+ sb_fspec.SetFileSpec (homedir);
+ return sb_fspec;
+}
+
lldb::thread_t
SBHostOS::ThreadCreate
(
diff --git a/source/API/SBInstruction.cpp b/source/API/SBInstruction.cpp
index a17f3f8dbd5df..ccf561edb90f6 100644
--- a/source/API/SBInstruction.cpp
+++ b/source/API/SBInstruction.cpp
@@ -26,15 +26,63 @@
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
+//----------------------------------------------------------------------
+// We recently fixed a leak in one of the Instruction subclasses where
+// the instruction will only hold a weak reference to the disassembler
+// to avoid a cycle that was keeping both objects alive (leak) and we
+// need the InstructionImpl class to make sure our public API behaves
+// as users would expect. Calls in our public API allow clients to do
+// things like:
+//
+// 1 lldb::SBInstruction inst;
+// 2 inst = target.ReadInstructions(pc, 1).GetInstructionAtIndex(0)
+// 3 if (inst.DoesBranch())
+// 4 ...
+//
+// There was a temporary lldb::DisassemblerSP object created in the
+// SBInstructionList that was returned by lldb.target.ReadInstructions()
+// that will go away after line 2 but the "inst" object should be able
+// to still answer questions about itself. So we make sure that any
+// SBInstruction objects that are given out have a strong reference to
+// the disassembler and the instruction so that the object can live and
+// successfully respond to all queries.
+//----------------------------------------------------------------------
+class InstructionImpl
+{
+public:
+ InstructionImpl (const lldb::DisassemblerSP &disasm_sp, const lldb::InstructionSP& inst_sp) :
+ m_disasm_sp(disasm_sp),
+ m_inst_sp(inst_sp)
+ {
+ }
+
+ lldb::InstructionSP
+ GetSP() const
+ {
+ return m_inst_sp;
+ }
+
+ bool
+ IsValid() const
+ {
+ return (bool)m_inst_sp;
+ }
+
+protected:
+ lldb::DisassemblerSP m_disasm_sp; // Can be empty/invalid
+ lldb::InstructionSP m_inst_sp;
+};
+
using namespace lldb;
using namespace lldb_private;
-SBInstruction::SBInstruction ()
+SBInstruction::SBInstruction() :
+ m_opaque_sp()
{
}
-SBInstruction::SBInstruction (const lldb::InstructionSP& inst_sp) :
- m_opaque_sp (inst_sp)
+SBInstruction::SBInstruction(const lldb::DisassemblerSP &disasm_sp, const lldb::InstructionSP& inst_sp) :
+ m_opaque_sp(new InstructionImpl(disasm_sp, inst_sp))
{
}
@@ -58,33 +106,36 @@ SBInstruction::~SBInstruction ()
bool
SBInstruction::IsValid()
{
- return (m_opaque_sp.get() != NULL);
+ return m_opaque_sp && m_opaque_sp->IsValid();
}
SBAddress
SBInstruction::GetAddress()
{
SBAddress sb_addr;
- if (m_opaque_sp && m_opaque_sp->GetAddress().IsValid())
- sb_addr.SetAddress(&m_opaque_sp->GetAddress());
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp && inst_sp->GetAddress().IsValid())
+ sb_addr.SetAddress(&inst_sp->GetAddress());
return sb_addr;
}
const char *
SBInstruction::GetMnemonic(SBTarget target)
{
- if (m_opaque_sp)
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
{
- Mutex::Locker api_locker;
ExecutionContext exe_ctx;
TargetSP target_sp (target.GetSP());
+ std::unique_lock<std::recursive_mutex> lock;
if (target_sp)
{
- api_locker.Lock (target_sp->GetAPIMutex());
+ lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
+
target_sp->CalculateExecutionContext (exe_ctx);
exe_ctx.SetProcessSP(target_sp->GetProcessSP());
}
- return m_opaque_sp->GetMnemonic(&exe_ctx);
+ return inst_sp->GetMnemonic(&exe_ctx);
}
return NULL;
}
@@ -92,18 +143,20 @@ SBInstruction::GetMnemonic(SBTarget target)
const char *
SBInstruction::GetOperands(SBTarget target)
{
- if (m_opaque_sp)
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
{
- Mutex::Locker api_locker;
ExecutionContext exe_ctx;
TargetSP target_sp (target.GetSP());
+ std::unique_lock<std::recursive_mutex> lock;
if (target_sp)
{
- api_locker.Lock (target_sp->GetAPIMutex());
+ lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
+
target_sp->CalculateExecutionContext (exe_ctx);
exe_ctx.SetProcessSP(target_sp->GetProcessSP());
}
- return m_opaque_sp->GetOperands(&exe_ctx);
+ return inst_sp->GetOperands(&exe_ctx);
}
return NULL;
}
@@ -111,18 +164,20 @@ SBInstruction::GetOperands(SBTarget target)
const char *
SBInstruction::GetComment(SBTarget target)
{
- if (m_opaque_sp)
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
{
- Mutex::Locker api_locker;
ExecutionContext exe_ctx;
TargetSP target_sp (target.GetSP());
+ std::unique_lock<std::recursive_mutex> lock;
if (target_sp)
{
- api_locker.Lock (target_sp->GetAPIMutex());
+ lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
+
target_sp->CalculateExecutionContext (exe_ctx);
exe_ctx.SetProcessSP(target_sp->GetProcessSP());
}
- return m_opaque_sp->GetComment(&exe_ctx);
+ return inst_sp->GetComment(&exe_ctx);
}
return NULL;
}
@@ -130,8 +185,9 @@ SBInstruction::GetComment(SBTarget target)
size_t
SBInstruction::GetByteSize ()
{
- if (m_opaque_sp)
- return m_opaque_sp->GetOpcode().GetByteSize();
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
+ return inst_sp->GetOpcode().GetByteSize();
return 0;
}
@@ -139,10 +195,11 @@ SBData
SBInstruction::GetData (SBTarget target)
{
lldb::SBData sb_data;
- if (m_opaque_sp)
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
{
DataExtractorSP data_extractor_sp (new DataExtractor());
- if (m_opaque_sp->GetData (*data_extractor_sp))
+ if (inst_sp->GetData (*data_extractor_sp))
{
sb_data.SetOpaque (data_extractor_sp);
}
@@ -155,32 +212,44 @@ SBInstruction::GetData (SBTarget target)
bool
SBInstruction::DoesBranch ()
{
- if (m_opaque_sp)
- return m_opaque_sp->DoesBranch ();
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
+ return inst_sp->DoesBranch ();
return false;
}
bool
SBInstruction::HasDelaySlot ()
{
- if (m_opaque_sp)
- return m_opaque_sp->HasDelaySlot ();
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
+ return inst_sp->HasDelaySlot ();
return false;
}
+lldb::InstructionSP
+SBInstruction::GetOpaque ()
+{
+ if (m_opaque_sp)
+ return m_opaque_sp->GetSP();
+ else
+ return lldb::InstructionSP();
+}
+
void
-SBInstruction::SetOpaque (const lldb::InstructionSP &inst_sp)
+SBInstruction::SetOpaque (const lldb::DisassemblerSP &disasm_sp, const lldb::InstructionSP& inst_sp)
{
- m_opaque_sp = inst_sp;
+ m_opaque_sp.reset(new InstructionImpl(disasm_sp, inst_sp));
}
bool
SBInstruction::GetDescription (lldb::SBStream &s)
{
- if (m_opaque_sp)
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
{
SymbolContext sc;
- const Address &addr = m_opaque_sp->GetAddress();
+ const Address &addr = inst_sp->GetAddress();
ModuleSP module_sp (addr.GetModule());
if (module_sp)
module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
@@ -188,7 +257,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, 0);
+ inst_sp->Dump (&s.ref(), 0, true, false, NULL, &sc, NULL, &format, 0);
return true;
}
return false;
@@ -200,24 +269,26 @@ SBInstruction::Print (FILE *out)
if (out == NULL)
return;
- if (m_opaque_sp)
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
{
SymbolContext sc;
- const Address &addr = m_opaque_sp->GetAddress();
+ const Address &addr = inst_sp->GetAddress();
ModuleSP module_sp (addr.GetModule());
if (module_sp)
module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
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, 0);
+ inst_sp->Dump (&out_stream, 0, true, false, NULL, &sc, NULL, &format, 0);
}
}
bool
SBInstruction::EmulateWithFrame (lldb::SBFrame &frame, uint32_t evaluate_options)
{
- if (m_opaque_sp)
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
{
lldb::StackFrameSP frame_sp (frame.GetFrameSP());
@@ -228,13 +299,13 @@ SBInstruction::EmulateWithFrame (lldb::SBFrame &frame, uint32_t evaluate_options
lldb_private::Target *target = exe_ctx.GetTargetPtr();
lldb_private::ArchSpec arch = target->GetArchitecture();
- return m_opaque_sp->Emulate (arch,
- evaluate_options,
- (void *) frame_sp.get(),
- &lldb_private::EmulateInstruction::ReadMemoryFrame,
- &lldb_private::EmulateInstruction::WriteMemoryFrame,
- &lldb_private::EmulateInstruction::ReadRegisterFrame,
- &lldb_private::EmulateInstruction::WriteRegisterFrame);
+ return inst_sp->Emulate(arch,
+ evaluate_options,
+ (void *) frame_sp.get(),
+ &lldb_private::EmulateInstruction::ReadMemoryFrame,
+ &lldb_private::EmulateInstruction::WriteMemoryFrame,
+ &lldb_private::EmulateInstruction::ReadRegisterFrame,
+ &lldb_private::EmulateInstruction::WriteRegisterFrame);
}
}
return false;
@@ -243,29 +314,32 @@ SBInstruction::EmulateWithFrame (lldb::SBFrame &frame, uint32_t evaluate_options
bool
SBInstruction::DumpEmulation (const char *triple)
{
- if (m_opaque_sp && triple)
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp && triple)
{
lldb_private::ArchSpec arch (triple, NULL);
-
- return m_opaque_sp->DumpEmulation (arch);
-
+ return inst_sp->DumpEmulation (arch);
}
return false;
}
bool
-SBInstruction::TestEmulation (lldb::SBStream &output_stream, const char *test_file)
+SBInstruction::TestEmulation (lldb::SBStream &output_stream, const char *test_file)
{
- if (!m_opaque_sp.get())
- m_opaque_sp.reset (new PseudoInstruction());
-
- return m_opaque_sp->TestEmulation (output_stream.get(), test_file);
+ if (!m_opaque_sp)
+ SetOpaque(lldb::DisassemblerSP(), lldb::InstructionSP(new PseudoInstruction()));
+
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
+ return inst_sp->TestEmulation (output_stream.get(), test_file);
+ return false;
}
lldb::AddressClass
SBInstruction::GetAddressClass ()
{
- if (m_opaque_sp.get())
- return m_opaque_sp->GetAddressClass();
+ lldb::InstructionSP inst_sp(GetOpaque());
+ if (inst_sp)
+ return inst_sp->GetAddressClass();
return eAddressClassInvalid;
}
diff --git a/source/API/SBInstructionList.cpp b/source/API/SBInstructionList.cpp
index 34b0e05079f80..9be38b483ebb7 100644
--- a/source/API/SBInstructionList.cpp
+++ b/source/API/SBInstructionList.cpp
@@ -61,7 +61,7 @@ SBInstructionList::GetInstructionAtIndex (uint32_t idx)
{
SBInstruction inst;
if (m_opaque_sp && idx < m_opaque_sp->GetInstructionList().GetSize())
- inst.SetOpaque (m_opaque_sp->GetInstructionList().GetInstructionAtIndex (idx));
+ inst.SetOpaque (m_opaque_sp, m_opaque_sp->GetInstructionList().GetInstructionAtIndex (idx));
return inst;
}
diff --git a/source/API/SBListener.cpp b/source/API/SBListener.cpp
index 643c82d70f78e..8e63de0b7698c 100644
--- a/source/API/SBListener.cpp
+++ b/source/API/SBListener.cpp
@@ -26,27 +26,25 @@ using namespace lldb_private;
SBListener::SBListener () :
m_opaque_sp (),
- m_opaque_ptr (NULL)
+ m_unused_ptr (NULL)
{
}
SBListener::SBListener (const char *name) :
- m_opaque_sp (new Listener (name)),
- m_opaque_ptr (NULL)
+ m_opaque_sp (Listener::MakeListener(name)),
+ m_unused_ptr (nullptr)
{
- m_opaque_ptr = m_opaque_sp.get();
-
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBListener::SBListener (name=\"%s\") => SBListener(%p)",
- name, static_cast<void*>(m_opaque_ptr));
+ name, static_cast<void*>(m_opaque_sp.get()));
}
SBListener::SBListener (const SBListener &rhs) :
m_opaque_sp (rhs.m_opaque_sp),
- m_opaque_ptr (rhs.m_opaque_ptr)
+ m_unused_ptr (nullptr)
{
}
@@ -56,20 +54,14 @@ SBListener::operator = (const lldb::SBListener &rhs)
if (this != &rhs)
{
m_opaque_sp = rhs.m_opaque_sp;
- m_opaque_ptr = rhs.m_opaque_ptr;
+ m_unused_ptr = nullptr;
}
return *this;
}
-SBListener::SBListener (Listener &listener) :
- m_opaque_sp (),
- m_opaque_ptr (&listener)
-{
-}
-
SBListener::SBListener (const lldb::ListenerSP &listener_sp) :
m_opaque_sp (listener_sp),
- m_opaque_ptr (listener_sp.get())
+ m_unused_ptr (nullptr)
{
}
@@ -80,7 +72,7 @@ SBListener::~SBListener ()
bool
SBListener::IsValid() const
{
- return m_opaque_ptr != NULL;
+ return m_opaque_sp != nullptr;
}
void
@@ -88,14 +80,14 @@ SBListener::AddEvent (const SBEvent &event)
{
EventSP &event_sp = event.GetSP ();
if (event_sp)
- m_opaque_ptr->AddEvent (event_sp);
+ m_opaque_sp->AddEvent (event_sp);
}
void
SBListener::Clear ()
{
- if (m_opaque_ptr)
- m_opaque_ptr->Clear ();
+ if (m_opaque_sp)
+ m_opaque_sp->Clear ();
}
uint32_t
@@ -103,13 +95,13 @@ SBListener::StartListeningForEventClass (SBDebugger &debugger,
const char *broadcaster_class,
uint32_t event_mask)
{
- if (m_opaque_ptr)
+ if (m_opaque_sp)
{
Debugger *lldb_debugger = debugger.get();
if (!lldb_debugger)
return 0;
BroadcastEventSpec event_spec (ConstString (broadcaster_class), event_mask);
- return m_opaque_ptr->StartListeningForEventSpec (*lldb_debugger, event_spec);
+ return m_opaque_sp->StartListeningForEventSpec (lldb_debugger->GetBroadcasterManager(), event_spec);
}
else
return 0;
@@ -120,13 +112,13 @@ SBListener::StopListeningForEventClass (SBDebugger &debugger,
const char *broadcaster_class,
uint32_t event_mask)
{
- if (m_opaque_ptr)
+ if (m_opaque_sp)
{
Debugger *lldb_debugger = debugger.get();
if (!lldb_debugger)
return false;
BroadcastEventSpec event_spec (ConstString (broadcaster_class), event_mask);
- return m_opaque_ptr->StopListeningForEventSpec (*lldb_debugger, event_spec);
+ return m_opaque_sp->StopListeningForEventSpec (lldb_debugger->GetBroadcasterManager(), event_spec);
}
else
return false;
@@ -136,9 +128,9 @@ uint32_t
SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask)
{
uint32_t acquired_event_mask = 0;
- if (m_opaque_ptr && broadcaster.IsValid())
+ if (m_opaque_sp && broadcaster.IsValid())
{
- acquired_event_mask = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask);
+ acquired_event_mask = m_opaque_sp->StartListeningForEvents (broadcaster.get(), event_mask);
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
@@ -153,7 +145,7 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t
const bool got_requested_names = lldb_broadcaster->GetEventNames (sstr_requested, event_mask, false);
const bool got_acquired_names = lldb_broadcaster->GetEventNames (sstr_acquired, acquired_event_mask, false);
log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p): %s, event_mask=0x%8.8x%s%s%s) => 0x%8.8x%s%s%s",
- static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(m_opaque_sp.get()),
static_cast<void*>(lldb_broadcaster),
lldb_broadcaster->GetBroadcasterName().GetCString(),
event_mask,
@@ -168,7 +160,7 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t
else
{
log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => 0x%8.8x",
- static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(m_opaque_sp.get()),
static_cast<void*>(lldb_broadcaster), event_mask,
acquired_event_mask);
}
@@ -180,9 +172,9 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t
bool
SBListener::StopListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask)
{
- if (m_opaque_ptr && broadcaster.IsValid())
+ if (m_opaque_sp && broadcaster.IsValid())
{
- return m_opaque_ptr->StopListeningForEvents (broadcaster.get(), event_mask);
+ return m_opaque_sp->StopListeningForEvents (broadcaster.get(), event_mask);
}
return false;
}
@@ -196,19 +188,19 @@ SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event)
if (timeout_secs == UINT32_MAX)
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=INFINITE, SBEvent(%p))...",
- static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(m_opaque_sp.get()),
static_cast<void*>(event.get()));
}
else
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=%d, SBEvent(%p))...",
- static_cast<void*>(m_opaque_ptr), timeout_secs,
+ static_cast<void*>(m_opaque_sp.get()), timeout_secs,
static_cast<void*>(event.get()));
}
}
bool success = false;
- if (m_opaque_ptr)
+ if (m_opaque_sp)
{
TimeValue time_value;
if (timeout_secs != UINT32_MAX)
@@ -218,7 +210,7 @@ SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event)
time_value.OffsetWithSeconds (timeout_secs);
}
EventSP event_sp;
- if (m_opaque_ptr->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp))
+ if (m_opaque_sp->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp))
{
event.reset (event_sp);
success = true;
@@ -230,13 +222,13 @@ SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event)
if (timeout_secs == UINT32_MAX)
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=INFINITE, SBEvent(%p)) => %i",
- static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(m_opaque_sp.get()),
static_cast<void*>(event.get()), success);
}
else
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=%d, SBEvent(%p)) => %i",
- static_cast<void*>(m_opaque_ptr), timeout_secs,
+ static_cast<void*>(m_opaque_sp.get()), timeout_secs,
static_cast<void*>(event.get()), success);
}
}
@@ -253,7 +245,7 @@ SBListener::WaitForEventForBroadcaster
SBEvent &event
)
{
- if (m_opaque_ptr && broadcaster.IsValid())
+ if (m_opaque_sp && broadcaster.IsValid())
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
@@ -262,7 +254,7 @@ SBListener::WaitForEventForBroadcaster
time_value.OffsetWithSeconds (num_seconds);
}
EventSP event_sp;
- if (m_opaque_ptr->WaitForEventForBroadcaster (time_value.IsValid() ? &time_value : NULL,
+ if (m_opaque_sp->WaitForEventForBroadcaster (time_value.IsValid() ? &time_value : NULL,
broadcaster.get(),
event_sp))
{
@@ -284,7 +276,7 @@ SBListener::WaitForEventForBroadcasterWithType
SBEvent &event
)
{
- if (m_opaque_ptr && broadcaster.IsValid())
+ if (m_opaque_sp && broadcaster.IsValid())
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
@@ -293,7 +285,7 @@ SBListener::WaitForEventForBroadcasterWithType
time_value.OffsetWithSeconds (num_seconds);
}
EventSP event_sp;
- if (m_opaque_ptr->WaitForEventForBroadcasterWithType (time_value.IsValid() ? &time_value : NULL,
+ if (m_opaque_sp->WaitForEventForBroadcasterWithType (time_value.IsValid() ? &time_value : NULL,
broadcaster.get(),
event_type_mask,
event_sp))
@@ -309,9 +301,9 @@ SBListener::WaitForEventForBroadcasterWithType
bool
SBListener::PeekAtNextEvent (SBEvent &event)
{
- if (m_opaque_ptr)
+ if (m_opaque_sp)
{
- event.reset (m_opaque_ptr->PeekAtNextEvent ());
+ event.reset (m_opaque_sp->PeekAtNextEvent ());
return event.IsValid();
}
event.reset (NULL);
@@ -321,9 +313,9 @@ SBListener::PeekAtNextEvent (SBEvent &event)
bool
SBListener::PeekAtNextEventForBroadcaster (const SBBroadcaster &broadcaster, SBEvent &event)
{
- if (m_opaque_ptr && broadcaster.IsValid())
+ if (m_opaque_sp && broadcaster.IsValid())
{
- event.reset (m_opaque_ptr->PeekAtNextEventForBroadcaster (broadcaster.get()));
+ event.reset (m_opaque_sp->PeekAtNextEventForBroadcaster (broadcaster.get()));
return event.IsValid();
}
event.reset (NULL);
@@ -334,9 +326,9 @@ bool
SBListener::PeekAtNextEventForBroadcasterWithType (const SBBroadcaster &broadcaster, uint32_t event_type_mask,
SBEvent &event)
{
- if (m_opaque_ptr && broadcaster.IsValid())
+ if (m_opaque_sp && broadcaster.IsValid())
{
- event.reset(m_opaque_ptr->PeekAtNextEventForBroadcasterWithType (broadcaster.get(), event_type_mask));
+ event.reset(m_opaque_sp->PeekAtNextEventForBroadcasterWithType (broadcaster.get(), event_type_mask));
return event.IsValid();
}
event.reset (NULL);
@@ -346,10 +338,10 @@ SBListener::PeekAtNextEventForBroadcasterWithType (const SBBroadcaster &broadcas
bool
SBListener::GetNextEvent (SBEvent &event)
{
- if (m_opaque_ptr)
+ if (m_opaque_sp)
{
EventSP event_sp;
- if (m_opaque_ptr->GetNextEvent (event_sp))
+ if (m_opaque_sp->GetNextEvent (event_sp))
{
event.reset (event_sp);
return true;
@@ -362,10 +354,10 @@ SBListener::GetNextEvent (SBEvent &event)
bool
SBListener::GetNextEventForBroadcaster (const SBBroadcaster &broadcaster, SBEvent &event)
{
- if (m_opaque_ptr && broadcaster.IsValid())
+ if (m_opaque_sp && broadcaster.IsValid())
{
EventSP event_sp;
- if (m_opaque_ptr->GetNextEventForBroadcaster (broadcaster.get(), event_sp))
+ if (m_opaque_sp->GetNextEventForBroadcaster (broadcaster.get(), event_sp))
{
event.reset (event_sp);
return true;
@@ -383,10 +375,10 @@ SBListener::GetNextEventForBroadcasterWithType
SBEvent &event
)
{
- if (m_opaque_ptr && broadcaster.IsValid())
+ if (m_opaque_sp && broadcaster.IsValid())
{
EventSP event_sp;
- if (m_opaque_ptr->GetNextEventForBroadcasterWithType (broadcaster.get(),
+ if (m_opaque_sp->GetNextEventForBroadcasterWithType (broadcaster.get(),
event_type_mask,
event_sp))
{
@@ -401,49 +393,28 @@ SBListener::GetNextEventForBroadcasterWithType
bool
SBListener::HandleBroadcastEvent (const SBEvent &event)
{
- if (m_opaque_ptr)
- return m_opaque_ptr->HandleBroadcastEvent (event.GetSP());
+ if (m_opaque_sp)
+ return m_opaque_sp->HandleBroadcastEvent (event.GetSP());
return false;
}
Listener *
SBListener::operator->() const
{
- return m_opaque_ptr;
+ return m_opaque_sp.get();
}
Listener *
SBListener::get() const
{
- return m_opaque_ptr;
+ return m_opaque_sp.get();
}
void
-SBListener::reset(Listener *listener, bool owns)
-{
- if (owns)
- m_opaque_sp.reset (listener);
- else
- m_opaque_sp.reset ();
- m_opaque_ptr = listener;
-}
-
-Listener &
-SBListener::ref() const
-{
- return *m_opaque_ptr;
-}
-
-Listener &
-SBListener::operator *()
-{
- return *m_opaque_ptr;
-}
-
-const Listener &
-SBListener::operator *() const
+SBListener::reset(ListenerSP listener_sp)
{
- return *m_opaque_ptr;
+ m_opaque_sp = listener_sp;
+ m_unused_ptr = nullptr;
}
diff --git a/source/API/SBMemoryRegionInfo.cpp b/source/API/SBMemoryRegionInfo.cpp
new file mode 100644
index 0000000000000..53b180787af94
--- /dev/null
+++ b/source/API/SBMemoryRegionInfo.cpp
@@ -0,0 +1,126 @@
+//===-- SBMemoryRegionInfo.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/SBDefines.h"
+#include "lldb/API/SBError.h"
+#include "lldb/API/SBMemoryRegionInfo.h"
+#include "lldb/API/SBStream.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Target/MemoryRegionInfo.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+
+SBMemoryRegionInfo::SBMemoryRegionInfo () :
+ m_opaque_ap (new MemoryRegionInfo())
+{
+}
+
+SBMemoryRegionInfo::SBMemoryRegionInfo (const MemoryRegionInfo *lldb_object_ptr) :
+ m_opaque_ap (new MemoryRegionInfo())
+{
+ if (lldb_object_ptr)
+ ref() = *lldb_object_ptr;
+}
+
+SBMemoryRegionInfo::SBMemoryRegionInfo(const SBMemoryRegionInfo &rhs) :
+ m_opaque_ap (new MemoryRegionInfo())
+{
+ ref() = rhs.ref();
+}
+
+const SBMemoryRegionInfo &
+SBMemoryRegionInfo::operator = (const SBMemoryRegionInfo &rhs)
+{
+ if (this != &rhs)
+ {
+ ref() = rhs.ref();
+ }
+ return *this;
+}
+
+SBMemoryRegionInfo::~SBMemoryRegionInfo ()
+{
+}
+
+void
+SBMemoryRegionInfo::Clear()
+{
+ m_opaque_ap->Clear();
+}
+
+bool
+SBMemoryRegionInfo::operator == (const SBMemoryRegionInfo &rhs) const
+{
+ return ref() == rhs.ref();
+}
+
+bool
+SBMemoryRegionInfo::operator != (const SBMemoryRegionInfo &rhs) const
+{
+ return ref() != rhs.ref();
+}
+
+MemoryRegionInfo &
+SBMemoryRegionInfo::ref()
+{
+ return *m_opaque_ap;
+}
+
+const MemoryRegionInfo &
+SBMemoryRegionInfo::ref() const
+{
+ return *m_opaque_ap;
+}
+
+lldb::addr_t
+SBMemoryRegionInfo::GetRegionBase () {
+ return m_opaque_ap->GetRange().GetRangeBase();
+}
+
+lldb::addr_t
+SBMemoryRegionInfo::GetRegionEnd () {
+ return m_opaque_ap->GetRange().GetRangeEnd();
+}
+
+bool
+SBMemoryRegionInfo::IsReadable () {
+ return m_opaque_ap->GetReadable() == MemoryRegionInfo::eYes;
+}
+
+bool
+SBMemoryRegionInfo::IsWritable () {
+ return m_opaque_ap->GetWritable() == MemoryRegionInfo::eYes;
+}
+
+bool
+SBMemoryRegionInfo::IsExecutable () {
+ return m_opaque_ap->GetExecutable() == MemoryRegionInfo::eYes;
+}
+
+bool
+SBMemoryRegionInfo::IsMapped () {
+ return m_opaque_ap->GetMapped() == MemoryRegionInfo::eYes;
+}
+
+bool
+SBMemoryRegionInfo::GetDescription (SBStream &description)
+{
+ Stream &strm = description.ref();
+ const addr_t load_addr = m_opaque_ap->GetRange().base;
+
+ strm.Printf ("[0x%16.16" PRIx64 "-0x%16.16" PRIx64 " ", load_addr, load_addr + m_opaque_ap->GetRange().size);
+ strm.Printf (m_opaque_ap->GetReadable() ? "R" : "-");
+ strm.Printf (m_opaque_ap->GetWritable() ? "W" : "-");
+ strm.Printf (m_opaque_ap->GetExecutable() ? "X" : "-");
+ strm.Printf ("]");
+
+ return true;
+}
diff --git a/source/API/SBMemoryRegionInfoList.cpp b/source/API/SBMemoryRegionInfoList.cpp
new file mode 100644
index 0000000000000..b2e974785a5c8
--- /dev/null
+++ b/source/API/SBMemoryRegionInfoList.cpp
@@ -0,0 +1,162 @@
+//===-- SBMemoryRegionInfoList.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/SBMemoryRegionInfo.h"
+#include "lldb/API/SBMemoryRegionInfoList.h"
+#include "lldb/API/SBStream.h"
+#include "lldb/Core/Log.h"
+#include "lldb/Target/MemoryRegionInfo.h"
+
+#include <vector>
+
+using namespace lldb;
+using namespace lldb_private;
+
+class MemoryRegionInfoListImpl
+{
+public:
+ MemoryRegionInfoListImpl () :
+ m_regions()
+ {
+ }
+
+ MemoryRegionInfoListImpl (const MemoryRegionInfoListImpl& rhs) :
+ m_regions(rhs.m_regions)
+ {
+ }
+
+ MemoryRegionInfoListImpl&
+ operator = (const MemoryRegionInfoListImpl& rhs)
+ {
+ if (this == &rhs)
+ return *this;
+ m_regions = rhs.m_regions;
+ return *this;
+ }
+
+ uint32_t
+ GetSize ()
+ {
+ return m_regions.size();
+ }
+
+ void
+ Append (const lldb::SBMemoryRegionInfo& sb_region)
+ {
+ m_regions.push_back(sb_region);
+ }
+
+ void
+ Append (const MemoryRegionInfoListImpl& list)
+ {
+ for (auto val : list.m_regions)
+ Append (val);
+ }
+
+ void
+ Clear ()
+ {
+ m_regions.clear();
+ }
+
+ bool
+ GetMemoryRegionInfoAtIndex (uint32_t index, SBMemoryRegionInfo &region_info)
+ {
+ if (index >= GetSize())
+ return false;
+ region_info = m_regions[index];
+ return true;
+ }
+
+private:
+ std::vector<lldb::SBMemoryRegionInfo> m_regions;
+};
+
+SBMemoryRegionInfoList::SBMemoryRegionInfoList () :
+ m_opaque_ap (new MemoryRegionInfoListImpl())
+{
+}
+
+SBMemoryRegionInfoList::SBMemoryRegionInfoList (const SBMemoryRegionInfoList& rhs) :
+ m_opaque_ap (new MemoryRegionInfoListImpl(*rhs.m_opaque_ap))
+{
+}
+
+SBMemoryRegionInfoList::~SBMemoryRegionInfoList ()
+{
+}
+
+const SBMemoryRegionInfoList &
+SBMemoryRegionInfoList::operator = (const SBMemoryRegionInfoList &rhs)
+{
+ if (this != &rhs)
+ {
+ *m_opaque_ap = *rhs.m_opaque_ap;
+ }
+ return *this;
+}
+
+uint32_t
+SBMemoryRegionInfoList::GetSize() const
+{
+ return m_opaque_ap->GetSize();
+}
+
+
+bool
+SBMemoryRegionInfoList::GetMemoryRegionAtIndex (uint32_t idx, SBMemoryRegionInfo &region_info)
+{
+ Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ bool result = m_opaque_ap->GetMemoryRegionInfoAtIndex(idx, region_info);
+
+ if (log)
+ {
+ SBStream sstr;
+ region_info.GetDescription (sstr);
+ log->Printf ("SBMemoryRegionInfoList::GetMemoryRegionAtIndex (this.ap=%p, idx=%d) => SBMemoryRegionInfo (this.ap=%p, '%s')",
+ static_cast<void*>(m_opaque_ap.get()), idx,
+ static_cast<void*>(region_info.m_opaque_ap.get()), sstr.GetData());
+ }
+
+ return result;
+}
+
+void
+SBMemoryRegionInfoList::Clear()
+{
+
+ m_opaque_ap->Clear();
+}
+
+void
+SBMemoryRegionInfoList::Append(SBMemoryRegionInfo &sb_region)
+{
+ m_opaque_ap->Append(sb_region);
+}
+
+void
+SBMemoryRegionInfoList::Append(SBMemoryRegionInfoList &sb_region_list)
+{
+ m_opaque_ap->Append(*sb_region_list);
+}
+
+const MemoryRegionInfoListImpl *
+SBMemoryRegionInfoList::operator->() const
+{
+ return m_opaque_ap.get();
+}
+
+const MemoryRegionInfoListImpl&
+SBMemoryRegionInfoList::operator*() const
+{
+ assert (m_opaque_ap.get());
+ return *m_opaque_ap.get();
+}
+
diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp
index a810940f301f2..bf015f7f2e58f 100644
--- a/source/API/SBModule.cpp
+++ b/source/API/SBModule.cpp
@@ -21,6 +21,7 @@
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/Symtab.h"
#include "lldb/Symbol/TypeSystem.h"
@@ -555,10 +556,12 @@ SBModule::FindTypes (const char *type)
TypeList type_list;
const bool exact_match = false;
ConstString name(type);
+ llvm::DenseSet<SymbolFile *> searched_symbol_files;
const uint32_t num_matches = module_sp->FindTypes (sc,
name,
exact_match,
UINT32_MAX,
+ searched_symbol_files,
type_list);
if (num_matches > 0)
diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp
index eea5fdca2b38b..50211bfde3292 100644
--- a/source/API/SBProcess.cpp
+++ b/source/API/SBProcess.cpp
@@ -23,6 +23,7 @@
#include "lldb/Core/State.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/SystemRuntime.h"
@@ -36,6 +37,8 @@
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBMemoryRegionInfo.h"
+#include "lldb/API/SBMemoryRegionInfoList.h"
#include "lldb/API/SBThread.h"
#include "lldb/API/SBThreadCollection.h"
#include "lldb/API/SBStream.h"
@@ -163,7 +166,7 @@ SBProcess::RemoteLaunch (char const **argv,
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
if (process_sp->GetState() == eStateConnected)
{
if (stop_at_entry)
@@ -209,7 +212,7 @@ SBProcess::RemoteAttachToProcessWithID (lldb::pid_t pid, lldb::SBError& error)
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
if (process_sp->GetState() == eStateConnected)
{
ProcessAttachInfo attach_info;
@@ -251,7 +254,7 @@ SBProcess::GetNumThreads ()
Process::StopLocker stop_locker;
const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock());
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
num_threads = process_sp->GetThreadList().GetSize(can_update);
}
@@ -272,7 +275,7 @@ SBProcess::GetSelectedThread () const
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
thread_sp = process_sp->GetThreadList().GetSelectedThread();
sb_thread.SetThread (thread_sp);
}
@@ -295,7 +298,7 @@ SBProcess::CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context)
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
thread_sp = process_sp->CreateOSPluginThread(tid, context);
sb_thread.SetThread (thread_sp);
}
@@ -465,7 +468,7 @@ SBProcess::SetSelectedThread (const SBThread &thread)
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
return process_sp->GetThreadList().SetSelectedThreadByID (thread.GetThreadID());
}
return false;
@@ -480,7 +483,7 @@ SBProcess::SetSelectedThreadByID (lldb::tid_t tid)
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
ret_val = process_sp->GetThreadList().SetSelectedThreadByID (tid);
}
@@ -501,7 +504,7 @@ SBProcess::SetSelectedThreadByIndexID (uint32_t index_id)
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
ret_val = process_sp->GetThreadList().SetSelectedThreadByIndexID (index_id);
}
@@ -525,7 +528,7 @@ SBProcess::GetThreadAtIndex (size_t index)
{
Process::StopLocker stop_locker;
const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock());
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
thread_sp = process_sp->GetThreadList().GetThreadAtIndex(index, can_update);
sb_thread.SetThread (thread_sp);
}
@@ -549,9 +552,11 @@ SBProcess::GetNumQueues ()
if (process_sp)
{
Process::StopLocker stop_locker;
-
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
- num_queues = process_sp->GetQueueList().GetSize();
+ if (stop_locker.TryLock(&process_sp->GetRunLock()))
+ {
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
+ num_queues = process_sp->GetQueueList().GetSize();
+ }
}
if (log)
@@ -572,9 +577,12 @@ SBProcess::GetQueueAtIndex (size_t index)
if (process_sp)
{
Process::StopLocker stop_locker;
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
- queue_sp = process_sp->GetQueueList().GetQueueAtIndex(index);
- sb_queue.SetQueue (queue_sp);
+ if (stop_locker.TryLock(&process_sp->GetRunLock()))
+ {
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
+ queue_sp = process_sp->GetQueueList().GetQueueAtIndex(index);
+ sb_queue.SetQueue (queue_sp);
+ }
}
if (log)
@@ -593,7 +601,7 @@ SBProcess::GetStopID(bool include_expression_stops)
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
if (include_expression_stops)
return process_sp->GetStopID();
else
@@ -612,7 +620,7 @@ SBProcess::GetStopEventForStopID(uint32_t stop_id)
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
event_sp = process_sp->GetStopEventForStopID(stop_id);
sb_event.reset(event_sp);
}
@@ -634,7 +642,7 @@ SBProcess::GetState ()
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
ret_val = process_sp->GetState();
}
@@ -655,7 +663,7 @@ SBProcess::GetExitStatus ()
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
exit_status = process_sp->GetExitStatus ();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -674,7 +682,7 @@ SBProcess::GetExitDescription ()
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
exit_desc = process_sp->GetExitDescription ();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -760,7 +768,7 @@ SBProcess::Continue ()
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
if (process_sp->GetTarget().GetDebugger().GetAsyncExecution ())
sb_error.ref() = process_sp->Resume ();
@@ -790,7 +798,7 @@ SBProcess::Destroy ()
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
sb_error.SetError(process_sp->Destroy(false));
}
else
@@ -817,7 +825,7 @@ SBProcess::Stop ()
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
sb_error.SetError (process_sp->Halt());
}
else
@@ -843,7 +851,7 @@ SBProcess::Kill ()
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
sb_error.SetError (process_sp->Destroy(true));
}
else
@@ -877,7 +885,7 @@ SBProcess::Detach (bool keep_stopped)
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
sb_error.SetError (process_sp->Detach(keep_stopped));
}
else
@@ -893,7 +901,7 @@ SBProcess::Signal (int signo)
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
sb_error.SetError (process_sp->Signal (signo));
}
else
@@ -939,7 +947,7 @@ SBProcess::GetThreadByID (tid_t tid)
{
Process::StopLocker stop_locker;
const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock());
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
thread_sp = process_sp->GetThreadList().FindThreadByID (tid, can_update);
sb_thread.SetThread (thread_sp);
}
@@ -963,7 +971,7 @@ SBProcess::GetThreadByIndexID (uint32_t index_id)
{
Process::StopLocker stop_locker;
const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock());
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
thread_sp = process_sp->GetThreadList().FindThreadByIndexID (index_id, can_update);
sb_thread.SetThread (thread_sp);
}
@@ -1080,7 +1088,7 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock()))
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
bytes_read = process_sp->ReadMemory (addr, dst, dst_len, sb_error.ref());
}
else
@@ -1120,7 +1128,7 @@ SBProcess::ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBE
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock()))
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
bytes_read = process_sp->ReadCStringFromMemory (addr, (char *)buf, size, sb_error.ref());
}
else
@@ -1149,7 +1157,7 @@ SBProcess::ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBErro
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock()))
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
value = process_sp->ReadUnsignedIntegerFromMemory (addr, byte_size, 0, sb_error.ref());
}
else
@@ -1178,7 +1186,7 @@ SBProcess::ReadPointerFromMemory (addr_t addr, lldb::SBError &sb_error)
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock()))
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
ptr = process_sp->ReadPointerFromMemory (addr, sb_error.ref());
}
else
@@ -1218,7 +1226,7 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock()))
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
bytes_written = process_sp->WriteMemory (addr, src, src_len, sb_error.ref());
}
else
@@ -1282,7 +1290,7 @@ SBProcess::GetNumSupportedHardwareWatchpoints (lldb::SBError &sb_error) const
ProcessSP process_sp(GetSP());
if (process_sp)
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
sb_error.SetError(process_sp->GetWatchpointSupportInfo (num));
if (log)
log->Printf ("SBProcess(%p)::GetNumSupportedHardwareWatchpoints () => %u",
@@ -1312,7 +1320,7 @@ SBProcess::LoadImage (const lldb::SBFileSpec &sb_local_image_spec,
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock()))
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
PlatformSP platform_sp = process_sp->GetTarget().GetPlatform();
return platform_sp->LoadImage (process_sp.get(),
*sb_local_image_spec,
@@ -1341,7 +1349,7 @@ SBProcess::UnloadImage (uint32_t image_token)
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock()))
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
PlatformSP platform_sp = process_sp->GetTarget().GetPlatform();
sb_error.SetError (platform_sp->UnloadImage (process_sp.get(), image_token));
}
@@ -1369,7 +1377,7 @@ SBProcess::SendEventData (const char *event_data)
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process_sp->GetRunLock()))
{
- Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
sb_error.SetError (process_sp->SendEventData (event_data));
}
else
@@ -1459,7 +1467,7 @@ SBProcess::SaveCore(const char *file_name)
return error;
}
- Mutex::Locker api_locker(process_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
if (process_sp->GetState() != eStateStopped)
{
@@ -1471,3 +1479,74 @@ SBProcess::SaveCore(const char *file_name)
error.ref() = PluginManager::SaveCore(process_sp, core_file);
return error;
}
+
+lldb::SBError
+SBProcess::GetMemoryRegionInfo (lldb::addr_t load_addr, SBMemoryRegionInfo &sb_region_info)
+{
+ lldb::SBError sb_error;
+ ProcessSP process_sp(GetSP());
+ MemoryRegionInfoSP region_info_sp = std::make_shared<lldb_private::MemoryRegionInfo>();
+ if (process_sp)
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&process_sp->GetRunLock()))
+ {
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
+ sb_error.ref() = process_sp->GetMemoryRegionInfo(load_addr, *region_info_sp);
+ if( sb_error.Success() ) {
+ sb_region_info.ref() = *region_info_sp;
+ }
+ }
+ else
+ {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf ("SBProcess(%p)::GetMemoryRegionInfo() => error: process is running",
+ static_cast<void*>(process_sp.get()));
+ sb_error.SetErrorString("process is running");
+ }
+ }
+ else
+ {
+ sb_error.SetErrorString ("SBProcess is invalid");
+ }
+ return sb_error;
+}
+
+lldb::SBMemoryRegionInfoList
+SBProcess::GetMemoryRegions()
+{
+ lldb::SBError sb_error;
+ lldb::SBMemoryRegionInfoList sb_region_list;
+ ProcessSP process_sp(GetSP());
+ if (process_sp)
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&process_sp->GetRunLock()))
+ {
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
+ std::vector<MemoryRegionInfoSP> region_list;
+ sb_error.ref() = process_sp->GetMemoryRegions(region_list);
+ if( sb_error.Success() ) {
+ std::vector<MemoryRegionInfoSP>::iterator end = region_list.end();
+ for( std::vector<MemoryRegionInfoSP>::iterator it = region_list.begin(); it != end; it++ ) {
+ SBMemoryRegionInfo sb_region_info(it->get());
+ sb_region_list.Append(sb_region_info);
+ }
+ }
+ }
+ else
+ {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf ("SBProcess(%p)::GetMemoryRegionInfo() => error: process is running",
+ static_cast<void*>(process_sp.get()));
+ sb_error.SetErrorString("process is running");
+ }
+ }
+ else
+ {
+ sb_error.SetErrorString ("SBProcess is invalid");
+ }
+ return sb_region_list;
+}
diff --git a/source/API/SBStringList.cpp b/source/API/SBStringList.cpp
index 129d2f4c11f00..f469bc4336fcf 100644
--- a/source/API/SBStringList.cpp
+++ b/source/API/SBStringList.cpp
@@ -126,6 +126,16 @@ SBStringList::GetStringAtIndex (size_t idx)
return NULL;
}
+const char *
+SBStringList::GetStringAtIndex (size_t idx) const
+{
+ if (IsValid())
+ {
+ return m_opaque_ap->GetStringAtIndex (idx);
+ }
+ return NULL;
+}
+
void
SBStringList::Clear ()
{
diff --git a/source/API/SBSymbol.cpp b/source/API/SBSymbol.cpp
index 22d1e546b5ee3..0dbed1238b8c5 100644
--- a/source/API/SBSymbol.cpp
+++ b/source/API/SBSymbol.cpp
@@ -141,12 +141,13 @@ SBSymbol::GetInstructions (SBTarget target, const char *flavor_string)
SBInstructionList sb_instructions;
if (m_opaque_ptr)
{
- Mutex::Locker api_locker;
ExecutionContext exe_ctx;
TargetSP target_sp (target.GetSP());
+ std::unique_lock<std::recursive_mutex> lock;
if (target_sp)
{
- api_locker.Lock (target_sp->GetAPIMutex());
+ lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
+
target_sp->CalculateExecutionContext (exe_ctx);
}
if (m_opaque_ptr->ValueIsAddress())
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index c7595c3c39fba..6a5301b060535 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -22,6 +22,7 @@
#include "lldb/API/SBSourceManager.h"
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBStream.h"
+#include "lldb/API/SBStringList.h"
#include "lldb/API/SBSymbolContextList.h"
#include "lldb/Breakpoint/BreakpointID.h"
#include "lldb/Breakpoint/BreakpointIDList.h"
@@ -49,6 +50,7 @@
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/DeclVendor.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ABI.h"
@@ -75,7 +77,7 @@ namespace {
Error
AttachToProcess (ProcessAttachInfo &attach_info, Target &target)
{
- Mutex::Locker api_locker (target.GetAPIMutex ());
+ std::lock_guard<std::recursive_mutex> guard(target.GetAPIMutex());
auto process_sp = target.GetProcessSP ();
if (process_sp)
@@ -265,7 +267,7 @@ SBTarget::Install()
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
sb_error.ref() = target_sp->Install(NULL);
}
return sb_error;
@@ -305,7 +307,7 @@ SBTarget::Launch
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
if (stop_at_entry)
launch_flags |= eLaunchFlagStopAtEntry;
@@ -372,9 +374,8 @@ SBTarget::Launch
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
- log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)",
- static_cast<void*>(target_sp.get()),
- static_cast<void*>(sb_process.GetSP().get()));
+ log->Printf("SBTarget(%p)::Launch (...) => SBProcess(%p), SBError(%s)", static_cast<void *>(target_sp.get()),
+ static_cast<void *>(sb_process.GetSP().get()), error.GetCString());
return sb_process;
}
@@ -393,7 +394,7 @@ SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error)
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
StateType state = eStateInvalid;
{
ProcessSP process_sp = target_sp->GetProcessSP();
@@ -621,9 +622,9 @@ SBTarget::ConnectRemote
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
if (listener.IsValid())
- process_sp = target_sp->CreateProcess (listener.ref(), plugin_name, NULL);
+ process_sp = target_sp->CreateProcess (listener.m_opaque_sp, plugin_name, NULL);
else
process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), plugin_name, NULL);
@@ -705,7 +706,7 @@ SBTarget::ResolveLoadAddress (lldb::addr_t vm_addr)
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
if (target_sp->ResolveLoadAddress (vm_addr, addr))
return sb_addr;
}
@@ -724,7 +725,7 @@ SBTarget::ResolveFileAddress (lldb::addr_t file_addr)
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
if (target_sp->ResolveFileAddress (file_addr, addr))
return sb_addr;
}
@@ -741,7 +742,7 @@ SBTarget::ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr)
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
if (target_sp->ResolveLoadAddress (vm_addr, addr))
return sb_addr;
}
@@ -777,7 +778,7 @@ SBTarget::ReadMemory (const SBAddress addr,
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
bytes_read = target_sp->ReadMemory(addr.ref(), false, buf, size, sb_error.ref());
}
else
@@ -799,20 +800,36 @@ SBBreakpoint
SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec,
uint32_t line)
{
+ return BreakpointCreateByLocation(sb_file_spec, line, 0);
+}
+
+SBBreakpoint
+SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec,
+ uint32_t line,
+ lldb::addr_t offset)
+{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBreakpoint sb_bp;
TargetSP target_sp(GetSP());
if (target_sp && line != 0)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
const LazyBool check_inlines = eLazyBoolCalculate;
const LazyBool skip_prologue = eLazyBoolCalculate;
const bool internal = false;
const bool hardware = false;
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);
+ *sb_bp = target_sp->CreateBreakpoint (NULL,
+ *sb_file_spec,
+ line,
+ offset,
+ check_inlines,
+ skip_prologue,
+ internal,
+ hardware,
+ move_to_nearest_code);
}
if (log)
@@ -839,20 +856,21 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,
TargetSP target_sp(GetSP());
if (target_sp.get())
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
const bool internal = false;
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
+ const lldb::addr_t offset = 0;
if (module_name && module_name[0])
{
FileSpecList module_spec_list;
module_spec_list.Append (FileSpec (module_name, false));
- *sb_bp = target_sp->CreateBreakpoint (&module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, skip_prologue, internal, hardware);
+ *sb_bp = target_sp->CreateBreakpoint (&module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, offset, skip_prologue, internal, hardware);
}
else
{
- *sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, skip_prologue, internal, hardware);
+ *sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, offset, skip_prologue, internal, hardware);
}
}
@@ -898,12 +916,13 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,
const bool internal = false;
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
*sb_bp = target_sp->CreateBreakpoint (module_list.get(),
comp_unit_list.get(),
symbol_name,
name_type_mask,
symbol_language,
+ 0,
skip_prologue,
internal,
hardware);
@@ -935,13 +954,25 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[],
const SBFileSpecList &module_list,
const SBFileSpecList &comp_unit_list)
{
+ return BreakpointCreateByNames(symbol_names, num_names, name_type_mask, eLanguageTypeUnknown, 0, module_list, comp_unit_list);
+}
+
+lldb::SBBreakpoint
+SBTarget::BreakpointCreateByNames (const char *symbol_names[],
+ uint32_t num_names,
+ uint32_t name_type_mask,
+ LanguageType symbol_language,
+ lldb::addr_t offset,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list)
+{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBreakpoint sb_bp;
TargetSP target_sp(GetSP());
if (target_sp && num_names > 0)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
const bool internal = false;
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
@@ -949,8 +980,9 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[],
comp_unit_list.get(),
symbol_names,
num_names,
- name_type_mask,
+ name_type_mask,
symbol_language,
+ offset,
skip_prologue,
internal,
hardware);
@@ -1013,7 +1045,7 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex,
TargetSP target_sp(GetSP());
if (target_sp && symbol_name_regex && symbol_name_regex[0])
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
RegularExpression regexp(symbol_name_regex);
const bool internal = false;
const bool hardware = false;
@@ -1039,7 +1071,7 @@ SBTarget::BreakpointCreateByAddress (addr_t address)
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
const bool hardware = false;
*sb_bp = target_sp->CreateBreakpoint (address, false, hardware);
}
@@ -1070,7 +1102,7 @@ SBTarget::BreakpointCreateBySBAddress (SBAddress &sb_address)
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
const bool hardware = false;
*sb_bp = target_sp->CreateBreakpoint (sb_address.ref(), false, hardware);
}
@@ -1093,42 +1125,21 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
const lldb::SBFileSpec &source_file,
const char *module_name)
{
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
- SBBreakpoint sb_bp;
- TargetSP target_sp(GetSP());
- if (target_sp && source_regex && source_regex[0])
- {
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
- 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());
+ SBFileSpecList module_spec_list;
if (module_name && module_name[0])
{
- 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, move_to_nearest_code);
}
- else
+
+ SBFileSpecList source_file_list;
+ if (source_file.IsValid())
{
- *sb_bp = target_sp->CreateSourceRegexBreakpoint (NULL, &source_file_spec_list, regexp, false, hardware, move_to_nearest_code);
+ source_file_list.Append(source_file);
}
- }
-
- if (log)
- {
- char path[PATH_MAX];
- source_file->GetPath (path, sizeof(path));
- log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\", file=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)",
- static_cast<void*>(target_sp.get()), source_regex, path,
- module_name, static_cast<void*>(sb_bp.get()));
- }
+
+ return BreakpointCreateBySourceRegex (source_regex, module_spec_list, source_file_list);
- return sb_bp;
}
lldb::SBBreakpoint
@@ -1136,17 +1147,38 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
const SBFileSpecList &module_list,
const lldb::SBFileSpecList &source_file_list)
{
+ return BreakpointCreateBySourceRegex(source_regex, module_list, source_file_list, SBStringList());
+}
+
+lldb::SBBreakpoint
+SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
+ const SBFileSpecList &module_list,
+ const lldb::SBFileSpecList &source_file_list,
+ const SBStringList &func_names)
+{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBreakpoint sb_bp;
TargetSP target_sp(GetSP());
if (target_sp && source_regex && source_regex[0])
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(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, move_to_nearest_code);
+ std::unordered_set<std::string> func_names_set;
+ for (size_t i = 0; i < func_names.GetSize(); i++)
+ {
+ func_names_set.insert(func_names.GetStringAtIndex(i));
+ }
+
+ *sb_bp = target_sp->CreateSourceRegexBreakpoint (module_list.get(),
+ source_file_list.get(),
+ func_names_set,
+ regexp,
+ false,
+ hardware,
+ move_to_nearest_code);
}
if (log)
@@ -1168,7 +1200,7 @@ SBTarget::BreakpointCreateForException (lldb::LanguageType language,
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
const bool hardware = false;
*sb_bp = target_sp->CreateExceptionBreakpoint (language, catch_bp, throw_bp, hardware);
}
@@ -1217,7 +1249,7 @@ SBTarget::BreakpointDelete (break_id_t bp_id)
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
result = target_sp->RemoveBreakpointByID (bp_id);
}
@@ -1238,7 +1270,7 @@ SBTarget::FindBreakpointByID (break_id_t bp_id)
TargetSP target_sp(GetSP());
if (target_sp && bp_id != LLDB_INVALID_BREAK_ID)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
*sb_breakpoint = target_sp->GetBreakpointByID (bp_id);
}
@@ -1257,7 +1289,7 @@ SBTarget::EnableAllBreakpoints ()
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
target_sp->EnableAllBreakpoints ();
return true;
}
@@ -1270,7 +1302,7 @@ SBTarget::DisableAllBreakpoints ()
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
target_sp->DisableAllBreakpoints ();
return true;
}
@@ -1283,7 +1315,7 @@ SBTarget::DeleteAllBreakpoints ()
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
target_sp->RemoveAllBreakpoints ();
return true;
}
@@ -1324,9 +1356,9 @@ SBTarget::DeleteWatchpoint (watch_id_t wp_id)
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
- Mutex::Locker locker;
- target_sp->GetWatchpointList().GetListMutex(locker);
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
+ std::unique_lock<std::recursive_mutex> lock;
+ target_sp->GetWatchpointList().GetListMutex(lock);
result = target_sp->RemoveWatchpointByID (wp_id);
}
@@ -1348,9 +1380,9 @@ SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id)
TargetSP target_sp(GetSP());
if (target_sp && wp_id != LLDB_INVALID_WATCH_ID)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
- Mutex::Locker locker;
- target_sp->GetWatchpointList().GetListMutex(locker);
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
+ std::unique_lock<std::recursive_mutex> lock;
+ target_sp->GetWatchpointList().GetListMutex(lock);
watchpoint_sp = target_sp->GetWatchpointList().FindByID(wp_id);
sb_watchpoint.SetSP (watchpoint_sp);
}
@@ -1374,7 +1406,7 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, S
TargetSP target_sp(GetSP());
if (target_sp && (read || write) && addr != LLDB_INVALID_ADDRESS && size > 0)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
uint32_t watch_type = 0;
if (read)
watch_type |= LLDB_WATCH_TYPE_READ;
@@ -1410,9 +1442,9 @@ SBTarget::EnableAllWatchpoints ()
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
- Mutex::Locker locker;
- target_sp->GetWatchpointList().GetListMutex(locker);
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
+ std::unique_lock<std::recursive_mutex> lock;
+ target_sp->GetWatchpointList().GetListMutex(lock);
target_sp->EnableAllWatchpoints ();
return true;
}
@@ -1425,9 +1457,9 @@ SBTarget::DisableAllWatchpoints ()
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
- Mutex::Locker locker;
- target_sp->GetWatchpointList().GetListMutex(locker);
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
+ std::unique_lock<std::recursive_mutex> lock;
+ target_sp->GetWatchpointList().GetListMutex(lock);
target_sp->DisableAllWatchpoints ();
return true;
}
@@ -1519,9 +1551,9 @@ SBTarget::DeleteAllWatchpoints ()
TargetSP target_sp(GetSP());
if (target_sp)
{
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
- Mutex::Locker locker;
- target_sp->GetWatchpointList().GetListMutex(locker);
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
+ std::unique_lock<std::recursive_mutex> lock;
+ target_sp->GetWatchpointList().GetListMutex(lock);
target_sp->RemoveAllWatchpoints ();
return true;
}
@@ -1894,11 +1926,12 @@ SBTarget::FindTypes (const char* typename_cstr)
bool exact_match = false;
SymbolContext sc;
TypeList type_list;
-
+ llvm::DenseSet<SymbolFile *> searched_symbol_files;
uint32_t num_matches = images.FindTypes (sc,
const_typename,
exact_match,
UINT32_MAX,
+ searched_symbol_files,
type_list);
if (num_matches > 0)
@@ -2171,6 +2204,13 @@ SBTarget::SetSectionLoadAddress (lldb::SBSection section,
ProcessSP process_sp (target_sp->GetProcessSP());
if (target_sp->SetSectionLoadAddress (section_sp, section_base_addr))
{
+ ModuleSP module_sp(section_sp->GetModule());
+ if (module_sp)
+ {
+ ModuleList module_list;
+ module_list.Append(module_sp);
+ target_sp->ModulesDidLoad (module_list);
+ }
// Flush info in the process (stack frames, etc)
if (process_sp)
process_sp->Flush();
@@ -2200,12 +2240,27 @@ SBTarget::ClearSectionLoadAddress (lldb::SBSection section)
}
else
{
- ProcessSP process_sp (target_sp->GetProcessSP());
- if (target_sp->SetSectionUnloaded (section.GetSP()))
+ SectionSP section_sp (section.GetSP());
+ if (section_sp)
+ {
+ ProcessSP process_sp (target_sp->GetProcessSP());
+ if (target_sp->SetSectionUnloaded(section_sp))
+ {
+ ModuleSP module_sp(section_sp->GetModule());
+ if (module_sp)
+ {
+ ModuleList module_list;
+ module_list.Append(module_sp);
+ target_sp->ModulesDidUnload(module_list, false);
+ }
+ // Flush info in the process (stack frames, etc)
+ if (process_sp)
+ process_sp->Flush();
+ }
+ }
+ else
{
- // Flush info in the process (stack frames, etc)
- if (process_sp)
- process_sp->Flush();
+ sb_error.SetErrorStringWithFormat ("invalid section");
}
}
}
@@ -2287,6 +2342,9 @@ SBTarget::ClearModuleLoadAddress (lldb::SBModule module)
}
if (changed)
{
+ ModuleList module_list;
+ module_list.Append(module_sp);
+ target_sp->ModulesDidUnload(module_list, false);
// Flush info in the process (stack frames, etc)
ProcessSP process_sp (target_sp->GetProcessSP());
if (process_sp)
@@ -2356,7 +2414,9 @@ lldb::SBValue
SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &options)
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+#if !defined(LLDB_DISABLE_PYTHON)
Log * expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+#endif
SBValue expr_result;
ExpressionResults exe_results = eExpressionSetupError;
ValueObjectSP expr_value_sp;
@@ -2371,7 +2431,7 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio
return expr_result;
}
- Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
ExecutionContext exe_ctx (m_opaque_sp.get());
if (log)
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index 2f3887ebce3ac..47cf80ef29ce7 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -35,12 +35,12 @@
#include "lldb/Target/ThreadPlanStepRange.h"
#include "lldb/Target/ThreadPlanStepInRange.h"
-
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBFrame.h"
#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBThreadCollection.h"
#include "lldb/API/SBThreadPlan.h"
#include "lldb/API/SBValue.h"
@@ -96,8 +96,8 @@ SBThread::GetQueue () const
{
SBQueue sb_queue;
QueueSP queue_sp;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (exe_ctx.HasThreadScope())
@@ -130,7 +130,19 @@ SBThread::GetQueue () const
bool
SBThread::IsValid() const
{
- return m_opaque_sp->GetThreadSP().get() != NULL;
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
+ Target *target = exe_ctx.GetTargetPtr();
+ Process *process = exe_ctx.GetProcessPtr();
+ if (target && process)
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&process->GetRunLock()))
+ return m_opaque_sp->GetThreadSP().get() != NULL;
+ }
+ // Without a valid target & process, this thread can't be valid.
+ return false;
}
void
@@ -146,8 +158,8 @@ SBThread::GetStopReason()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
StopReason reason = eStopReasonInvalid;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope())
{
@@ -175,8 +187,8 @@ SBThread::GetStopReason()
size_t
SBThread::GetStopReasonDataCount ()
{
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope())
{
@@ -235,8 +247,8 @@ SBThread::GetStopReasonDataCount ()
uint64_t
SBThread::GetStopReasonDataAtIndex (uint32_t idx)
{
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope())
{
@@ -313,7 +325,9 @@ SBThread::GetStopReasonExtendedInfoAsJSON (lldb::SBStream &stream)
{
Stream &strm = stream.ref();
- ExecutionContext exe_ctx (m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
if (! exe_ctx.HasThreadScope())
return false;
@@ -328,13 +342,39 @@ SBThread::GetStopReasonExtendedInfoAsJSON (lldb::SBStream &stream)
return true;
}
+SBThreadCollection
+SBThread::GetStopReasonExtendedBacktraces (InstrumentationRuntimeType type)
+{
+ ThreadCollectionSP threads;
+ threads.reset(new ThreadCollection());
+
+ // We currently only support ThreadSanitizer.
+ if (type != eInstrumentationRuntimeTypeThreadSanitizer)
+ return threads;
+
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
+ if (! exe_ctx.HasThreadScope())
+ return threads;
+
+ ProcessSP process_sp = exe_ctx.GetProcessSP();
+
+ StopInfoSP stop_info = exe_ctx.GetThreadPtr()->GetStopInfo();
+ StructuredData::ObjectSP info = stop_info->GetExtendedInfo();
+ if (! info)
+ return threads;
+
+ return process_sp->GetInstrumentationRuntime(type)->GetBacktracesFromExtendedStopInfo(info);
+}
+
size_t
SBThread::GetStopDescription (char *dst, size_t dst_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope())
{
@@ -465,8 +505,8 @@ SBThread::GetStopReturnValue ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ValueObjectSP return_valobj_sp;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope())
{
@@ -526,8 +566,8 @@ SBThread::GetName () const
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *name = NULL;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope())
{
@@ -556,8 +596,8 @@ const char *
SBThread::GetQueueName () const
{
const char *name = NULL;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (exe_ctx.HasThreadScope())
@@ -587,8 +627,8 @@ lldb::queue_id_t
SBThread::GetQueueID () const
{
queue_id_t id = LLDB_INVALID_QUEUE_ID;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (exe_ctx.HasThreadScope())
@@ -618,8 +658,8 @@ SBThread::GetInfoItemByPathAsString (const char *path, SBStream &strm)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool success = false;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope())
{
@@ -724,9 +764,8 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
-
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (log)
log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')",
@@ -774,10 +813,17 @@ SBThread::StepInto (lldb::RunMode stop_other_threads)
void
SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads)
{
+ SBError error;
+ StepInto(target_name, LLDB_INVALID_LINE_NUMBER, error, stop_other_threads);
+}
+
+void
+SBThread::StepInto (const char *target_name, uint32_t end_line, SBError &error, lldb::RunMode stop_other_threads)
+{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (log)
log->Printf ("SBThread(%p)::StepInto (target_name='%s', stop_other_threads='%s')",
@@ -795,11 +841,20 @@ SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads)
if (frame_sp && frame_sp->HasDebugInformation ())
{
+ SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
+ AddressRange range;
+ if (end_line == LLDB_INVALID_LINE_NUMBER)
+ range = sc.line_entry.range;
+ else
+ {
+ if (!sc.GetAddressRangeFromHereToEndLine(end_line, range, error.ref()))
+ return;
+ }
+
const LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate;
const LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate;
- SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
new_plan_sp = thread->QueueThreadPlanForStepInRange (abort_other_plans,
- sc.line_entry,
+ range,
sc,
target_name,
stop_other_threads,
@@ -813,8 +868,7 @@ SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads)
stop_other_threads);
}
- // This returns an error, we should use it!
- ResumeNewPlan (exe_ctx, new_plan_sp.get());
+ error = ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
}
@@ -823,8 +877,8 @@ SBThread::StepOut ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (log)
log->Printf ("SBThread(%p)::StepOut ()",
@@ -857,8 +911,8 @@ SBThread::StepOutOfFrame (lldb::SBFrame &sb_frame)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (!sb_frame.IsValid())
{
@@ -910,10 +964,8 @@ SBThread::StepInstruction (bool step_over)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
-
-
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (log)
log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)",
@@ -934,9 +986,8 @@ SBThread::RunToAddress (lldb::addr_t addr)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
-
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (log)
log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")",
@@ -969,8 +1020,8 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
char path[PATH_MAX];
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
StackFrameSP frame_sp (sb_frame.GetFrameSP());
@@ -1113,8 +1164,8 @@ SBThread::StepUsingScriptedThreadPlan (const char *script_class_name)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBError sb_error;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (log)
{
@@ -1153,8 +1204,8 @@ SBThread::JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBError sb_error;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (log)
log->Printf ("SBThread(%p)::JumpToLine (file+line = %s:%u)",
@@ -1181,9 +1232,8 @@ SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
-
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (log)
log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)",
@@ -1199,12 +1249,39 @@ SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value)
return sb_error;
}
+SBError
+SBThread::UnwindInnermostExpression()
+{
+ SBError sb_error;
+
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
+ if (log)
+ log->Printf ("SBThread(%p)::UnwindExpressionEvaluation",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
+
+ if (exe_ctx.HasThreadScope())
+ {
+ Thread *thread = exe_ctx.GetThreadPtr();
+ sb_error.SetError (thread->UnwindInnermostExpression());
+ if (sb_error.Success())
+ thread->SetSelectedFrameByIndex(0, false);
+ }
+
+ return sb_error;
+
+}
bool
SBThread::Suspend()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- ExecutionContext exe_ctx (m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
bool result = false;
if (exe_ctx.HasThreadScope())
{
@@ -1231,7 +1308,9 @@ bool
SBThread::Resume ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- ExecutionContext exe_ctx (m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
bool result = false;
if (exe_ctx.HasThreadScope())
{
@@ -1258,7 +1337,9 @@ SBThread::Resume ()
bool
SBThread::IsSuspended()
{
- ExecutionContext exe_ctx (m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
if (exe_ctx.HasThreadScope())
return exe_ctx.GetThreadPtr()->GetResumeState () == eStateSuspended;
return false;
@@ -1267,7 +1348,9 @@ SBThread::IsSuspended()
bool
SBThread::IsStopped()
{
- ExecutionContext exe_ctx (m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
if (exe_ctx.HasThreadScope())
return StateIsStoppedState(exe_ctx.GetThreadPtr()->GetState(), true);
return false;
@@ -1277,7 +1360,9 @@ SBProcess
SBThread::GetProcess ()
{
SBProcess sb_process;
- ExecutionContext exe_ctx (m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
if (exe_ctx.HasThreadScope())
{
// Have to go up to the target so we can get a shared pointer to our process...
@@ -1304,8 +1389,8 @@ SBThread::GetNumFrames ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
uint32_t num_frames = 0;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope())
{
@@ -1336,8 +1421,8 @@ SBThread::GetFrameAtIndex (uint32_t idx)
SBFrame sb_frame;
StackFrameSP frame_sp;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope())
{
@@ -1375,8 +1460,8 @@ SBThread::GetSelectedFrame ()
SBFrame sb_frame;
StackFrameSP frame_sp;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope())
{
@@ -1414,8 +1499,8 @@ SBThread::SetSelectedFrame (uint32_t idx)
SBFrame sb_frame;
StackFrameSP frame_sp;
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope())
{
@@ -1486,7 +1571,9 @@ SBThread::GetStatus (SBStream &status) const
{
Stream &strm = status.ref();
- ExecutionContext exe_ctx (m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
if (exe_ctx.HasThreadScope())
{
exe_ctx.GetThreadPtr()->GetStatus(strm, 0, 1, 1);
@@ -1502,7 +1589,9 @@ SBThread::GetDescription (SBStream &description) const
{
Stream &strm = description.ref();
- ExecutionContext exe_ctx (m_opaque_sp.get());
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
if (exe_ctx.HasThreadScope())
{
exe_ctx.GetThreadPtr()->DumpUsingSettingsFormat(strm, LLDB_INVALID_THREAD_ID);
@@ -1518,8 +1607,8 @@ SBThread
SBThread::GetExtendedBacktraceThread (const char *type)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- Mutex::Locker api_locker;
- ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
SBThread sb_origin_thread;
if (exe_ctx.HasThreadScope())
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index a8584c5d38c9e..4fdcb0d5ecbf8 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -127,7 +127,7 @@ public:
}
lldb::ValueObjectSP
- GetSP (Process::StopLocker &stop_locker, Mutex::Locker &api_locker, Error &error)
+ GetSP(Process::StopLocker &stop_locker, std::unique_lock<std::recursive_mutex> &lock, Error &error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (!m_valobj_sp)
@@ -139,11 +139,11 @@ public:
lldb::ValueObjectSP value_sp = m_valobj_sp;
Target *target = value_sp->GetTargetSP().get();
- if (target)
- api_locker.Lock(target->GetAPIMutex());
- else
+ if (!target)
return ValueObjectSP();
+ lock = std::unique_lock<std::recursive_mutex>(target->GetAPIMutex());
+
ProcessSP process_sp(value_sp->GetProcessSP());
if (process_sp && !stop_locker.TryLock (&process_sp->GetRunLock()))
{
@@ -255,13 +255,13 @@ public:
ValueLocker ()
{
}
-
+
ValueObjectSP
GetLockedSP(ValueImpl &in_value)
{
- return in_value.GetSP(m_stop_locker, m_api_locker, m_lock_error);
+ return in_value.GetSP(m_stop_locker, m_lock, m_lock_error);
}
-
+
Error &
GetError()
{
@@ -270,9 +270,8 @@ public:
private:
Process::StopLocker m_stop_locker;
- Mutex::Locker m_api_locker;
+ std::unique_lock<std::recursive_mutex> m_lock;
Error m_lock_error;
-
};
SBValue::SBValue () :
@@ -529,6 +528,10 @@ SBValue::GetValueType ()
log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult",
static_cast<void*>(value_sp.get()));
break;
+ case eValueTypeVariableThreadLocal:
+ log->Printf("SBValue(%p)::GetValueType () => eValueTypeVariableThreadLocal",
+ static_cast<void *>(value_sp.get()));
+ break;
}
}
return result;
@@ -923,16 +926,17 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s
}
lldb::SBValue
-SBValue::CreateValueFromData (const char* name, SBData data, SBType type)
+SBValue::CreateValueFromData (const char* name, SBData data, SBType sb_type)
{
lldb::SBValue sb_value;
lldb::ValueObjectSP new_value_sp;
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
- if (value_sp)
+ lldb::TypeImplSP type_impl_sp (sb_type.GetSP());
+ if (value_sp && type_impl_sp)
{
ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
- new_value_sp = ValueObject::CreateValueObjectFromData(name, **data, exe_ctx, type.GetSP()->GetCompilerType(true));
+ new_value_sp = ValueObject::CreateValueObjectFromData(name, **data, exe_ctx, type_impl_sp->GetCompilerType(true));
new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
}
sb_value.SetSP(new_value_sp);
@@ -1141,6 +1145,25 @@ SBValue::IsSynthetic ()
return false;
}
+bool
+SBValue::IsSyntheticChildrenGenerated ()
+{
+ ValueLocker locker;
+ lldb::ValueObjectSP value_sp(GetSP(locker));
+ if (value_sp)
+ return value_sp->IsSyntheticChildrenGenerated();
+ return false;
+}
+
+void
+SBValue::SetSyntheticChildrenGenerated (bool is)
+{
+ ValueLocker locker;
+ lldb::ValueObjectSP value_sp(GetSP(locker));
+ if (value_sp)
+ return value_sp->SetSyntheticChildrenGenerated(is);
+}
+
lldb::SBValue
SBValue::GetValueForExpressionPath(const char* expr_path)
{
diff --git a/source/API/SBWatchpoint.cpp b/source/API/SBWatchpoint.cpp
index 1a1a970aaa873..c33d5686b9c9e 100644
--- a/source/API/SBWatchpoint.cpp
+++ b/source/API/SBWatchpoint.cpp
@@ -115,7 +115,7 @@ SBWatchpoint::GetHardwareIndex ()
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp)
{
- Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
hw_index = watchpoint_sp->GetHardwareIndex();
}
@@ -130,7 +130,7 @@ SBWatchpoint::GetWatchAddress ()
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp)
{
- Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
ret_addr = watchpoint_sp->GetLoadAddress();
}
@@ -145,7 +145,7 @@ SBWatchpoint::GetWatchSize ()
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp)
{
- Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
watch_size = watchpoint_sp->GetByteSize();
}
@@ -158,7 +158,7 @@ SBWatchpoint::SetEnabled (bool enabled)
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp)
{
- Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
watchpoint_sp->GetTarget().DisableWatchpointByID(watchpoint_sp->GetID());
}
}
@@ -169,7 +169,7 @@ SBWatchpoint::IsEnabled ()
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp)
{
- Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
return watchpoint_sp->IsEnabled();
}
else
@@ -183,7 +183,7 @@ SBWatchpoint::GetHitCount ()
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp)
{
- Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
count = watchpoint_sp->GetHitCount();
}
@@ -201,7 +201,7 @@ SBWatchpoint::GetIgnoreCount ()
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp)
{
- Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
return watchpoint_sp->GetIgnoreCount();
}
else
@@ -214,7 +214,7 @@ SBWatchpoint::SetIgnoreCount (uint32_t n)
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp)
{
- Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
watchpoint_sp->SetIgnoreCount (n);
}
}
@@ -225,7 +225,7 @@ SBWatchpoint::GetCondition ()
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp)
{
- Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
return watchpoint_sp->GetConditionText ();
}
return NULL;
@@ -237,7 +237,7 @@ SBWatchpoint::SetCondition (const char *condition)
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp)
{
- Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
watchpoint_sp->SetCondition (condition);
}
}
@@ -250,7 +250,7 @@ SBWatchpoint::GetDescription (SBStream &description, DescriptionLevel level)
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp)
{
- Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
watchpoint_sp->GetDescription (&strm, level);
strm.EOL();
}
diff --git a/source/API/SystemInitializerFull.cpp b/source/API/SystemInitializerFull.cpp
index cbc01a6cff9ac..038f96cafba02 100644
--- a/source/API/SystemInitializerFull.cpp
+++ b/source/API/SystemInitializerFull.cpp
@@ -26,54 +26,76 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/GoASTContext.h"
+#include "lldb/Symbol/JavaASTContext.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/MacOSX-i386/ABIMacOSX_i386.h"
#include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
#include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
#include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.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/ABI/SysV-ppc/ABISysV_ppc.h"
+#include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
+#include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
+#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
+#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
+#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
+#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
#include "Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h"
+#include "Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h"
#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "Plugins/Language/Go/GoLanguage.h"
+#include "Plugins/Language/Java/JavaLanguage.h"
#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h"
#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
+#include "Plugins/LanguageRuntime/Go/GoLanguageRuntime.h"
+#include "Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
-#include "Plugins/LanguageRuntime/Go/GoLanguageRuntime.h"
#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h"
#include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h"
+#include "Plugins/OperatingSystem/Go/OperatingSystemGo.h"
+#include "Plugins/OperatingSystem/Python/OperatingSystemPython.h"
+#include "Plugins/Platform/Android/PlatformAndroid.h"
+#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
+#include "Plugins/Platform/Kalimba/PlatformKalimba.h"
+#include "Plugins/Platform/Linux/PlatformLinux.h"
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
+#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
+#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
+#include "Plugins/Platform/Windows/PlatformWindows.h"
#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
#include "Plugins/Process/elf-core/ProcessElfCore.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
#include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
+#include "Plugins/SymbolFile/PDB/SymbolFilePDB.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"
+#include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
#if defined(__APPLE__)
-#include "Plugins/Process/mach-core/ProcessMachCore.h"
-#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
-#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
+#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
#include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h"
#include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h"
+#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
#include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h"
#include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h"
+#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
+#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
+#include "Plugins/Process/mach-core/ProcessMachCore.h"
+#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
#endif
#if defined(__FreeBSD__)
@@ -255,6 +277,11 @@ SystemInitializerFull::Initialize()
SystemInitializerCommon::Initialize();
ScriptInterpreterNone::Initialize();
+#ifndef LLDB_DISABLE_PYTHON
+ OperatingSystemPython::Initialize();
+#endif
+ OperatingSystemGo::Initialize();
+
#if !defined(LLDB_DISABLE_PYTHON)
InitializeSWIG();
@@ -264,6 +291,19 @@ SystemInitializerFull::Initialize()
ScriptInterpreterPython::Initialize();
#endif
+ platform_freebsd::PlatformFreeBSD::Initialize();
+ platform_linux::PlatformLinux::Initialize();
+ platform_netbsd::PlatformNetBSD::Initialize();
+ PlatformWindows::Initialize();
+ PlatformKalimba::Initialize();
+ platform_android::PlatformAndroid::Initialize();
+ PlatformRemoteiOS::Initialize();
+ PlatformMacOSX::Initialize();
+#if defined(__APPLE__)
+ PlatformiOSSimulator::Initialize();
+ PlatformDarwinKernel::Initialize();
+#endif
+
// Initialize LLVM and Clang
llvm::InitializeAllTargets();
llvm::InitializeAllAsmPrinters();
@@ -272,6 +312,7 @@ SystemInitializerFull::Initialize()
ClangASTContext::Initialize();
GoASTContext::Initialize();
+ JavaASTContext::Initialize();
ABIMacOSX_i386::Initialize();
ABIMacOSX_arm::Initialize();
@@ -285,6 +326,7 @@ SystemInitializerFull::Initialize()
ABISysV_ppc64::Initialize();
ABISysV_mips::Initialize();
ABISysV_mips64::Initialize();
+ ABISysV_s390x::Initialize();
DisassemblerLLVMC::Initialize();
JITLoaderGDB::Initialize();
@@ -294,9 +336,11 @@ SystemInitializerFull::Initialize()
#endif
MemoryHistoryASan::Initialize();
AddressSanitizerRuntime::Initialize();
+ ThreadSanitizerRuntime::Initialize();
SymbolVendorELF::Initialize();
SymbolFileDWARF::Initialize();
+ SymbolFilePDB::Initialize();
SymbolFileSymtab::Initialize();
UnwindAssemblyInstEmulation::Initialize();
UnwindAssembly_x86::Initialize();
@@ -308,9 +352,11 @@ SystemInitializerFull::Initialize()
SystemRuntimeMacOSX::Initialize();
RenderScriptRuntime::Initialize();
GoLanguageRuntime::Initialize();
+ JavaLanguageRuntime::Initialize();
CPlusPlusLanguage::Initialize();
GoLanguage::Initialize();
+ JavaLanguage::Initialize();
ObjCLanguage::Initialize();
ObjCPlusPlusLanguage::Initialize();
@@ -328,6 +374,7 @@ SystemInitializerFull::Initialize()
PlatformAppleWatchSimulator::Initialize();
PlatformRemoteAppleTV::Initialize();
PlatformRemoteAppleWatch::Initialize();
+ DynamicLoaderDarwinKernel::Initialize();
#endif
//----------------------------------------------------------------------
// Platform agnostic plugins
@@ -335,7 +382,10 @@ SystemInitializerFull::Initialize()
platform_gdb_server::PlatformRemoteGDBServer::Initialize();
process_gdb_remote::ProcessGDBRemote::Initialize();
+ DynamicLoaderMacOSXDYLD::Initialize();
+ DynamicLoaderPOSIXDYLD::Initialize();
DynamicLoaderStatic::Initialize();
+ DynamicLoaderWindowsDYLD::Initialize();
// Scan for any system or user LLDB plug-ins
PluginManager::Initialize();
@@ -391,6 +441,7 @@ SystemInitializerFull::Terminate()
ClangASTContext::Terminate();
GoASTContext::Terminate();
+ JavaASTContext::Terminate();
ABIMacOSX_i386::Terminate();
ABIMacOSX_arm::Terminate();
@@ -404,6 +455,7 @@ SystemInitializerFull::Terminate()
ABISysV_ppc64::Terminate();
ABISysV_mips::Terminate();
ABISysV_mips64::Terminate();
+ ABISysV_s390x::Terminate();
DisassemblerLLVMC::Terminate();
JITLoaderGDB::Terminate();
@@ -413,8 +465,10 @@ SystemInitializerFull::Terminate()
#endif
MemoryHistoryASan::Terminate();
AddressSanitizerRuntime::Terminate();
+ ThreadSanitizerRuntime::Terminate();
SymbolVendorELF::Terminate();
SymbolFileDWARF::Terminate();
+ SymbolFilePDB::Terminate();
SymbolFileSymtab::Terminate();
UnwindAssembly_x86::Terminate();
UnwindAssemblyInstEmulation::Terminate();
@@ -425,13 +479,16 @@ SystemInitializerFull::Terminate()
AppleObjCRuntimeV1::Terminate();
SystemRuntimeMacOSX::Terminate();
RenderScriptRuntime::Terminate();
+ JavaLanguageRuntime::Terminate();
CPlusPlusLanguage::Terminate();
GoLanguage::Terminate();
+ JavaLanguage::Terminate();
ObjCLanguage::Terminate();
ObjCPlusPlusLanguage::Terminate();
#if defined(__APPLE__)
+ DynamicLoaderDarwinKernel::Terminate();
ProcessMachCore::Terminate();
ProcessKDP::Terminate();
SymbolVendorMacOSX::Terminate();
@@ -448,7 +505,28 @@ SystemInitializerFull::Terminate()
platform_gdb_server::PlatformRemoteGDBServer::Terminate();
process_gdb_remote::ProcessGDBRemote::Terminate();
+ DynamicLoaderMacOSXDYLD::Terminate();
+ DynamicLoaderPOSIXDYLD::Terminate();
DynamicLoaderStatic::Terminate();
+ DynamicLoaderWindowsDYLD::Terminate();
+
+#ifndef LLDB_DISABLE_PYTHON
+ OperatingSystemPython::Terminate();
+#endif
+ OperatingSystemGo::Terminate();
+
+ platform_freebsd::PlatformFreeBSD::Terminate();
+ platform_linux::PlatformLinux::Terminate();
+ platform_netbsd::PlatformNetBSD::Terminate();
+ PlatformWindows::Terminate();
+ PlatformKalimba::Terminate();
+ platform_android::PlatformAndroid::Terminate();
+ PlatformMacOSX::Terminate();
+ PlatformRemoteiOS::Terminate();
+#if defined(__APPLE__)
+ PlatformiOSSimulator::Terminate();
+ PlatformDarwinKernel::Terminate();
+#endif
// Now shutdown the common parts, in reverse order.
SystemInitializerCommon::Terminate();
diff --git a/source/API/liblldb.exports b/source/API/liblldb.exports
index fd234d11c40ce..3ceb562c7ed14 100644
--- a/source/API/liblldb.exports
+++ b/source/API/liblldb.exports
@@ -1,3 +1,4 @@
_ZN4lldb*
_ZNK4lldb*
init_lld*
+PyInit__lldb*