summaryrefslogtreecommitdiff
path: root/source/API
diff options
context:
space:
mode:
Diffstat (limited to 'source/API')
-rw-r--r--source/API/CMakeLists.txt18
-rw-r--r--source/API/SBAddress.cpp4
-rw-r--r--source/API/SBBlock.cpp2
-rw-r--r--source/API/SBBreakpoint.cpp450
-rw-r--r--source/API/SBBreakpointLocation.cpp206
-rw-r--r--source/API/SBBroadcaster.cpp22
-rw-r--r--source/API/SBCommandReturnObject.cpp5
-rw-r--r--source/API/SBCommunication.cpp2
-rw-r--r--source/API/SBCompileUnit.cpp2
-rw-r--r--source/API/SBData.cpp15
-rw-r--r--source/API/SBDebugger.cpp16
-rw-r--r--source/API/SBDeclaration.cpp8
-rw-r--r--source/API/SBError.cpp4
-rw-r--r--source/API/SBEvent.cpp14
-rw-r--r--source/API/SBFileSpec.cpp7
-rw-r--r--source/API/SBFileSpecList.cpp7
-rw-r--r--source/API/SBFrame.cpp25
-rw-r--r--source/API/SBFunction.cpp2
-rw-r--r--source/API/SBHostOS.cpp4
-rw-r--r--source/API/SBInstruction.cpp4
-rw-r--r--source/API/SBInstructionList.cpp2
-rw-r--r--source/API/SBLineEntry.cpp5
-rw-r--r--source/API/SBListener.cpp6
-rw-r--r--source/API/SBMemoryRegionInfo.cpp2
-rw-r--r--source/API/SBMemoryRegionInfoList.cpp4
-rw-r--r--source/API/SBModule.cpp4
-rw-r--r--source/API/SBModuleSpec.cpp2
-rw-r--r--source/API/SBPlatform.cpp6
-rw-r--r--source/API/SBProcess.cpp4
-rw-r--r--source/API/SBQueue.cpp2
-rw-r--r--source/API/SBQueueItem.cpp2
-rw-r--r--source/API/SBSection.cpp13
-rw-r--r--source/API/SBSourceManager.cpp2
-rw-r--r--source/API/SBStream.cpp6
-rw-r--r--source/API/SBStringList.cpp2
-rw-r--r--source/API/SBStructuredData.cpp4
-rw-r--r--source/API/SBSymbol.cpp2
-rw-r--r--source/API/SBSymbolContext.cpp2
-rw-r--r--source/API/SBTarget.cpp50
-rw-r--r--source/API/SBThread.cpp6
-rw-r--r--source/API/SBThreadPlan.cpp3
-rw-r--r--source/API/SBType.cpp6
-rw-r--r--source/API/SBTypeEnumMember.cpp6
-rw-r--r--source/API/SBUnixSignals.cpp2
-rw-r--r--source/API/SBValue.cpp6
-rw-r--r--source/API/SBValueList.cpp2
-rw-r--r--source/API/SBWatchpoint.cpp28
-rw-r--r--source/API/SystemInitializerFull.cpp3
48 files changed, 507 insertions, 492 deletions
diff --git a/source/API/CMakeLists.txt b/source/API/CMakeLists.txt
index 7e1e66bee3b20..3b852a3d7402a 100644
--- a/source/API/CMakeLists.txt
+++ b/source/API/CMakeLists.txt
@@ -16,6 +16,8 @@ if (LLDB_BUILD_FRAMEWORK AND NOT APPLE)
message(FATAL_ERROR "LLDB.framework cannot be generated unless targeting Apple platforms.")
endif()
+get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
+
add_lldb_library(liblldb SHARED
SBAddress.cpp
SBAttachInfo.cpp
@@ -80,6 +82,22 @@ add_lldb_library(liblldb SHARED
SBUnixSignals.cpp
SystemInitializerFull.cpp
${LLDB_WRAP_PYTHON}
+
+ LINK_LIBS
+ lldbBase
+ lldbBreakpoint
+ lldbCore
+ lldbDataFormatters
+ lldbExpression
+ lldbHost
+ lldbInitialization
+ lldbInterpreter
+ lldbSymbol
+ lldbTarget
+ lldbUtility
+ ${LLDB_ALL_PLUGINS}
+ LINK_COMPONENTS
+ Support
)
if (LLVM_ENABLE_WERROR)
diff --git a/source/API/SBAddress.cpp b/source/API/SBAddress.cpp
index 0ef374f47a925..b452ce327ab79 100644
--- a/source/API/SBAddress.cpp
+++ b/source/API/SBAddress.cpp
@@ -12,11 +12,11 @@
#include "lldb/API/SBSection.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/StreamString.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBBlock.cpp b/source/API/SBBlock.cpp
index 471b7fbebb234..cd453872201ad 100644
--- a/source/API/SBBlock.cpp
+++ b/source/API/SBBlock.cpp
@@ -14,7 +14,6 @@
#include "lldb/API/SBStream.h"
#include "lldb/API/SBValue.h"
#include "lldb/Core/AddressRange.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/Function.h"
@@ -22,6 +21,7 @@
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBBreakpoint.cpp b/source/API/SBBreakpoint.cpp
index 0eab2c2a363fa..0b661a646f312 100644
--- a/source/API/SBBreakpoint.cpp
+++ b/source/API/SBBreakpoint.cpp
@@ -26,8 +26,6 @@
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
@@ -36,6 +34,8 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
#include "lldb/lldb-enumerations.h"
@@ -59,83 +59,74 @@ public:
}
};
-SBBreakpoint::SBBreakpoint() : m_opaque_sp() {}
+SBBreakpoint::SBBreakpoint() {}
SBBreakpoint::SBBreakpoint(const SBBreakpoint &rhs)
- : m_opaque_sp(rhs.m_opaque_sp) {}
+ : m_opaque_wp(rhs.m_opaque_wp) {}
SBBreakpoint::SBBreakpoint(const lldb::BreakpointSP &bp_sp)
- : m_opaque_sp(bp_sp) {}
+ : m_opaque_wp(bp_sp) {}
SBBreakpoint::~SBBreakpoint() = default;
const SBBreakpoint &SBBreakpoint::operator=(const SBBreakpoint &rhs) {
- if (this != &rhs)
- m_opaque_sp = rhs.m_opaque_sp;
+ m_opaque_wp = rhs.m_opaque_wp;
return *this;
}
bool SBBreakpoint::operator==(const lldb::SBBreakpoint &rhs) {
- if (m_opaque_sp && rhs.m_opaque_sp)
- return m_opaque_sp.get() == rhs.m_opaque_sp.get();
- return false;
+ return m_opaque_wp.lock() == rhs.m_opaque_wp.lock();
}
bool SBBreakpoint::operator!=(const lldb::SBBreakpoint &rhs) {
- if (m_opaque_sp && rhs.m_opaque_sp)
- return m_opaque_sp.get() != rhs.m_opaque_sp.get();
- return (m_opaque_sp && !rhs.m_opaque_sp) || (rhs.m_opaque_sp && !m_opaque_sp);
+ return m_opaque_wp.lock() != rhs.m_opaque_wp.lock();
}
break_id_t SBBreakpoint::GetID() const {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
break_id_t break_id = LLDB_INVALID_BREAK_ID;
- if (m_opaque_sp)
- break_id = m_opaque_sp->GetID();
-
- if (log) {
- if (break_id == LLDB_INVALID_BREAK_ID)
- log->Printf("SBBreakpoint(%p)::GetID () => LLDB_INVALID_BREAK_ID",
- static_cast<void *>(m_opaque_sp.get()));
- else
- log->Printf("SBBreakpoint(%p)::GetID () => %u",
- static_cast<void *>(m_opaque_sp.get()), break_id);
- }
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp)
+ break_id = bkpt_sp->GetID();
+ LLDB_LOG(log, "breakpoint = {0}, id = {1}", bkpt_sp.get(), break_id);
return break_id;
}
bool SBBreakpoint::IsValid() const {
- if (!m_opaque_sp)
+ BreakpointSP bkpt_sp = GetSP();
+ if (!bkpt_sp)
return false;
- else if (m_opaque_sp->GetTarget().GetBreakpointByID(m_opaque_sp->GetID()))
+ else if (bkpt_sp->GetTarget().GetBreakpointByID(bkpt_sp->GetID()))
return true;
else
return false;
}
void SBBreakpoint::ClearAllBreakpointSites() {
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->ClearAllBreakpointSites();
+ bkpt_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->ClearAllBreakpointSites();
}
}
SBBreakpointLocation SBBreakpoint::FindLocationByAddress(addr_t vm_addr) {
SBBreakpointLocation sb_bp_location;
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
if (vm_addr != LLDB_INVALID_ADDRESS) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->GetTarget().GetAPIMutex());
Address address;
- Target &target = m_opaque_sp->GetTarget();
+ Target &target = bkpt_sp->GetTarget();
if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) {
address.SetRawAddress(vm_addr);
}
- sb_bp_location.SetLocation(m_opaque_sp->FindLocationByAddress(address));
+ sb_bp_location.SetLocation(bkpt_sp->FindLocationByAddress(address));
}
}
return sb_bp_location;
@@ -143,16 +134,17 @@ SBBreakpointLocation SBBreakpoint::FindLocationByAddress(addr_t vm_addr) {
break_id_t SBBreakpoint::FindLocationIDByAddress(addr_t vm_addr) {
break_id_t break_id = LLDB_INVALID_BREAK_ID;
+ BreakpointSP bkpt_sp = GetSP();
- if (m_opaque_sp && vm_addr != LLDB_INVALID_ADDRESS) {
+ if (bkpt_sp && vm_addr != LLDB_INVALID_ADDRESS) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->GetTarget().GetAPIMutex());
Address address;
- Target &target = m_opaque_sp->GetTarget();
+ Target &target = bkpt_sp->GetTarget();
if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address)) {
address.SetRawAddress(vm_addr);
}
- break_id = m_opaque_sp->FindLocationIDByAddress(address);
+ break_id = bkpt_sp->FindLocationIDByAddress(address);
}
return break_id;
@@ -160,11 +152,12 @@ break_id_t SBBreakpoint::FindLocationIDByAddress(addr_t vm_addr) {
SBBreakpointLocation SBBreakpoint::FindLocationByID(break_id_t bp_loc_id) {
SBBreakpointLocation sb_bp_location;
+ BreakpointSP bkpt_sp = GetSP();
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- sb_bp_location.SetLocation(m_opaque_sp->FindLocationByID(bp_loc_id));
+ bkpt_sp->GetTarget().GetAPIMutex());
+ sb_bp_location.SetLocation(bkpt_sp->FindLocationByID(bp_loc_id));
}
return sb_bp_location;
@@ -172,11 +165,12 @@ SBBreakpointLocation SBBreakpoint::FindLocationByID(break_id_t bp_loc_id) {
SBBreakpointLocation SBBreakpoint::GetLocationAtIndex(uint32_t index) {
SBBreakpointLocation sb_bp_location;
+ BreakpointSP bkpt_sp = GetSP();
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- sb_bp_location.SetLocation(m_opaque_sp->GetLocationAtIndex(index));
+ bkpt_sp->GetTarget().GetAPIMutex());
+ sb_bp_location.SetLocation(bkpt_sp->GetLocationAtIndex(index));
}
return sb_bp_location;
@@ -184,290 +178,282 @@ SBBreakpointLocation SBBreakpoint::GetLocationAtIndex(uint32_t index) {
void SBBreakpoint::SetEnabled(bool enable) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointSP bkpt_sp = GetSP();
- if (log)
- log->Printf("SBBreakpoint(%p)::SetEnabled (enabled=%i)",
- static_cast<void *>(m_opaque_sp.get()), enable);
+ LLDB_LOG(log, "breakpoint = {0}, enable = {1}", bkpt_sp.get(), enable);
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetEnabled(enable);
+ bkpt_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->SetEnabled(enable);
}
}
bool SBBreakpoint::IsEnabled() {
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->IsEnabled();
+ bkpt_sp->GetTarget().GetAPIMutex());
+ return bkpt_sp->IsEnabled();
} else
return false;
}
void SBBreakpoint::SetOneShot(bool one_shot) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointSP bkpt_sp = GetSP();
- if (log)
- log->Printf("SBBreakpoint(%p)::SetOneShot (one_shot=%i)",
- static_cast<void *>(m_opaque_sp.get()), one_shot);
+ LLDB_LOG(log, "breakpoint = {0}, one_shot = {1}", bkpt_sp.get(), one_shot);
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetOneShot(one_shot);
+ bkpt_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->SetOneShot(one_shot);
}
}
bool SBBreakpoint::IsOneShot() const {
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->IsOneShot();
+ bkpt_sp->GetTarget().GetAPIMutex());
+ return bkpt_sp->IsOneShot();
} else
return false;
}
bool SBBreakpoint::IsInternal() {
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->IsInternal();
+ bkpt_sp->GetTarget().GetAPIMutex());
+ return bkpt_sp->IsInternal();
} else
return false;
}
void SBBreakpoint::SetIgnoreCount(uint32_t count) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointSP bkpt_sp = GetSP();
- if (log)
- log->Printf("SBBreakpoint(%p)::SetIgnoreCount (count=%u)",
- static_cast<void *>(m_opaque_sp.get()), count);
+ LLDB_LOG(log, "breakpoint = {0}, count = {1}", bkpt_sp.get(), count);
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetIgnoreCount(count);
+ bkpt_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->SetIgnoreCount(count);
}
}
void SBBreakpoint::SetCondition(const char *condition) {
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetCondition(condition);
+ bkpt_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->SetCondition(condition);
}
}
const char *SBBreakpoint::GetCondition() {
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->GetConditionText();
+ bkpt_sp->GetTarget().GetAPIMutex());
+ return bkpt_sp->GetConditionText();
}
return nullptr;
}
uint32_t SBBreakpoint::GetHitCount() const {
uint32_t count = 0;
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- count = m_opaque_sp->GetHitCount();
+ bkpt_sp->GetTarget().GetAPIMutex());
+ count = bkpt_sp->GetHitCount();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::GetHitCount () => %u",
- static_cast<void *>(m_opaque_sp.get()), count);
+ LLDB_LOG(log, "breakpoint = {0}, count = {1}", bkpt_sp.get(), count);
return count;
}
uint32_t SBBreakpoint::GetIgnoreCount() const {
uint32_t count = 0;
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- count = m_opaque_sp->GetIgnoreCount();
+ bkpt_sp->GetTarget().GetAPIMutex());
+ count = bkpt_sp->GetIgnoreCount();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::GetIgnoreCount () => %u",
- static_cast<void *>(m_opaque_sp.get()), count);
+ LLDB_LOG(log, "breakpoint = {0}, count = {1}", bkpt_sp.get(), count);
return count;
}
void SBBreakpoint::SetThreadID(tid_t tid) {
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetThreadID(tid);
+ bkpt_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->SetThreadID(tid);
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4" PRIx64 ")",
- static_cast<void *>(m_opaque_sp.get()), tid);
+ LLDB_LOG(log, "breakpoint = {0}, tid = {1:x}", bkpt_sp.get(), tid);
}
tid_t SBBreakpoint::GetThreadID() {
tid_t tid = LLDB_INVALID_THREAD_ID;
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- tid = m_opaque_sp->GetThreadID();
+ bkpt_sp->GetTarget().GetAPIMutex());
+ tid = bkpt_sp->GetThreadID();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::GetThreadID () => 0x%4.4" PRIx64,
- static_cast<void *>(m_opaque_sp.get()), tid);
+ LLDB_LOG(log, "breakpoint = {0}, tid = {1:x}", bkpt_sp.get(), tid);
return tid;
}
void SBBreakpoint::SetThreadIndex(uint32_t index) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::SetThreadIndex (%u)",
- static_cast<void *>(m_opaque_sp.get()), index);
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ LLDB_LOG(log, "breakpoint = {0}, index = {1}", bkpt_sp.get(), index);
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->GetOptions()->GetThreadSpec()->SetIndex(index);
+ bkpt_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->GetOptions()->GetThreadSpec()->SetIndex(index);
}
}
uint32_t SBBreakpoint::GetThreadIndex() const {
uint32_t thread_idx = UINT32_MAX;
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->GetTarget().GetAPIMutex());
const ThreadSpec *thread_spec =
- m_opaque_sp->GetOptions()->GetThreadSpecNoCreate();
+ bkpt_sp->GetOptions()->GetThreadSpecNoCreate();
if (thread_spec != nullptr)
thread_idx = thread_spec->GetIndex();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::GetThreadIndex () => %u",
- static_cast<void *>(m_opaque_sp.get()), thread_idx);
+ LLDB_LOG(log, "breakpoint = {0}, index = {1}", bkpt_sp.get(), thread_idx);
return thread_idx;
}
void SBBreakpoint::SetThreadName(const char *thread_name) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::SetThreadName (%s)",
- static_cast<void *>(m_opaque_sp.get()), thread_name);
+ BreakpointSP bkpt_sp = GetSP();
+ LLDB_LOG(log, "breakpoint = {0}, name = {1}", bkpt_sp.get(), thread_name);
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->GetOptions()->GetThreadSpec()->SetName(thread_name);
+ bkpt_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->GetOptions()->GetThreadSpec()->SetName(thread_name);
}
}
const char *SBBreakpoint::GetThreadName() const {
const char *name = nullptr;
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->GetTarget().GetAPIMutex());
const ThreadSpec *thread_spec =
- m_opaque_sp->GetOptions()->GetThreadSpecNoCreate();
+ bkpt_sp->GetOptions()->GetThreadSpecNoCreate();
if (thread_spec != nullptr)
name = thread_spec->GetName();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::GetThreadName () => %s",
- static_cast<void *>(m_opaque_sp.get()), name);
+ LLDB_LOG(log, "breakpoint = {0}, name = {1}", bkpt_sp.get(), name);
return name;
}
void SBBreakpoint::SetQueueName(const char *queue_name) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::SetQueueName (%s)",
- static_cast<void *>(m_opaque_sp.get()), queue_name);
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ LLDB_LOG(log, "breakpoint = {0}, queue_name = {1}", bkpt_sp.get(),
+ queue_name);
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->GetOptions()->GetThreadSpec()->SetQueueName(queue_name);
+ bkpt_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->GetOptions()->GetThreadSpec()->SetQueueName(queue_name);
}
}
const char *SBBreakpoint::GetQueueName() const {
const char *name = nullptr;
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->GetTarget().GetAPIMutex());
const ThreadSpec *thread_spec =
- m_opaque_sp->GetOptions()->GetThreadSpecNoCreate();
+ bkpt_sp->GetOptions()->GetThreadSpecNoCreate();
if (thread_spec)
name = thread_spec->GetQueueName();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::GetQueueName () => %s",
- static_cast<void *>(m_opaque_sp.get()), name);
+ LLDB_LOG(log, "breakpoint = {0}, name = {1}", bkpt_sp.get(), name);
return name;
}
size_t SBBreakpoint::GetNumResolvedLocations() const {
size_t num_resolved = 0;
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- num_resolved = m_opaque_sp->GetNumResolvedLocations();
+ bkpt_sp->GetTarget().GetAPIMutex());
+ num_resolved = bkpt_sp->GetNumResolvedLocations();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::GetNumResolvedLocations () => %" PRIu64,
- static_cast<void *>(m_opaque_sp.get()),
- static_cast<uint64_t>(num_resolved));
+ LLDB_LOG(log, "breakpoint = {0}, num_resolved = {1}", bkpt_sp.get(),
+ num_resolved);
return num_resolved;
}
size_t SBBreakpoint::GetNumLocations() const {
+ BreakpointSP bkpt_sp = GetSP();
size_t num_locs = 0;
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- num_locs = m_opaque_sp->GetNumLocations();
+ bkpt_sp->GetTarget().GetAPIMutex());
+ num_locs = bkpt_sp->GetNumLocations();
}
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (log)
- log->Printf("SBBreakpoint(%p)::GetNumLocations () => %" PRIu64,
- static_cast<void *>(m_opaque_sp.get()),
- static_cast<uint64_t>(num_locs));
+ LLDB_LOG(log, "breakpoint = {0}, num_locs = {1}", bkpt_sp.get(), num_locs);
return num_locs;
}
void SBBreakpoint::SetCommandLineCommands(SBStringList &commands) {
- if (!m_opaque_sp)
+ BreakpointSP bkpt_sp = GetSP();
+ if (!bkpt_sp)
return;
if (commands.GetSize() == 0)
return;
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->GetTarget().GetAPIMutex());
std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
new BreakpointOptions::CommandData(*commands, eScriptLanguageNone));
- m_opaque_sp->GetOptions()->SetCommandDataCallback(cmd_data_up);
+ bkpt_sp->GetOptions()->SetCommandDataCallback(cmd_data_up);
}
bool SBBreakpoint::GetCommandLineCommands(SBStringList &commands) {
- if (!m_opaque_sp)
+ BreakpointSP bkpt_sp = GetSP();
+ if (!bkpt_sp)
return false;
StringList command_list;
bool has_commands =
- m_opaque_sp->GetOptions()->GetCommandLineCallbacks(command_list);
+ bkpt_sp->GetOptions()->GetCommandLineCallbacks(command_list);
if (has_commands)
commands.AppendList(command_list);
return has_commands;
@@ -478,14 +464,15 @@ bool SBBreakpoint::GetDescription(SBStream &s) {
}
bool SBBreakpoint::GetDescription(SBStream &s, bool include_locations) {
- if (m_opaque_sp) {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp) {
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());
+ bkpt_sp->GetTarget().GetAPIMutex());
+ s.Printf("SBBreakpoint: id = %i, ", bkpt_sp->GetID());
+ bkpt_sp->GetResolverDescription(s.get());
+ bkpt_sp->GetFilterDescription(s.get());
if (include_locations) {
- const size_t num_locations = m_opaque_sp->GetNumLocations();
+ const size_t num_locations = bkpt_sp->GetNumLocations();
s.Printf(", locations = %" PRIu64, (uint64_t)num_locations);
}
return true;
@@ -526,36 +513,31 @@ bool SBBreakpoint::PrivateBreakpointHitCallback(void *baton,
void SBBreakpoint::SetCallback(BreakpointHitCallback callback, void *baton) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointSP bkpt_sp = GetSP();
+ LLDB_LOG(log, "breakpoint = {0}, callback = {1}, baton = {2}", bkpt_sp.get(),
+ callback, baton);
- if (log) {
- void *pointer = &callback;
- log->Printf("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)",
- static_cast<void *>(m_opaque_sp.get()),
- *static_cast<void **>(&pointer), static_cast<void *>(baton));
- }
-
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->GetTarget().GetAPIMutex());
BatonSP baton_sp(new SBBreakpointCallbackBaton(callback, baton));
- m_opaque_sp->SetCallback(SBBreakpoint::PrivateBreakpointHitCallback,
- baton_sp, false);
+ bkpt_sp->SetCallback(SBBreakpoint::PrivateBreakpointHitCallback, baton_sp,
+ false);
}
}
void SBBreakpoint::SetScriptCallbackFunction(
const char *callback_function_name) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointSP bkpt_sp = GetSP();
+ LLDB_LOG(log, "breakpoint = {0}, callback = {1}", bkpt_sp.get(),
+ callback_function_name);
- if (log)
- log->Printf("SBBreakpoint(%p)::SetScriptCallbackFunction (callback=%s)",
- static_cast<void *>(m_opaque_sp.get()), callback_function_name);
-
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- BreakpointOptions *bp_options = m_opaque_sp->GetOptions();
- m_opaque_sp->GetTarget()
+ bkpt_sp->GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = bkpt_sp->GetOptions();
+ bkpt_sp->GetTarget()
.GetDebugger()
.GetCommandInterpreter()
.GetScriptInterpreter()
@@ -566,18 +548,17 @@ void SBBreakpoint::SetScriptCallbackFunction(
SBError SBBreakpoint::SetScriptCallbackBody(const char *callback_body_text) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-
- if (log)
- log->Printf("SBBreakpoint(%p)::SetScriptCallbackBody: callback body:\n%s)",
- static_cast<void *>(m_opaque_sp.get()), callback_body_text);
+ BreakpointSP bkpt_sp = GetSP();
+ LLDB_LOG(log, "breakpoint = {0}, callback body:\n{1}", bkpt_sp.get(),
+ callback_body_text);
SBError sb_error;
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- BreakpointOptions *bp_options = m_opaque_sp->GetOptions();
+ bkpt_sp->GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = bkpt_sp->GetOptions();
Error error =
- m_opaque_sp->GetTarget()
+ bkpt_sp->GetTarget()
.GetDebugger()
.GetCommandInterpreter()
.GetScriptInterpreter()
@@ -591,17 +572,15 @@ SBError SBBreakpoint::SetScriptCallbackBody(const char *callback_body_text) {
bool SBBreakpoint::AddName(const char *new_name) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointSP bkpt_sp = GetSP();
+ LLDB_LOG(log, "breakpoint = {0}, name = {1}", bkpt_sp.get(), new_name);
- if (log)
- log->Printf("SBBreakpoint(%p)::AddName (name=%s)",
- static_cast<void *>(m_opaque_sp.get()), new_name);
-
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
+ bkpt_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);
+ return bkpt_sp->AddName(new_name, error);
}
return false;
@@ -609,29 +588,25 @@ bool SBBreakpoint::AddName(const char *new_name) {
void SBBreakpoint::RemoveName(const char *name_to_remove) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointSP bkpt_sp = GetSP();
+ LLDB_LOG(log, "breakpoint = {0}, name = {1}", bkpt_sp.get(), name_to_remove);
- if (log)
- log->Printf("SBBreakpoint(%p)::RemoveName (name=%s)",
- static_cast<void *>(m_opaque_sp.get()), name_to_remove);
-
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->RemoveName(name_to_remove);
+ bkpt_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->RemoveName(name_to_remove);
}
}
bool SBBreakpoint::MatchesName(const char *name) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointSP bkpt_sp = GetSP();
+ LLDB_LOG(log, "breakpoint = {0}, name = {1}", bkpt_sp.get(), name);
- if (log)
- log->Printf("SBBreakpoint(%p)::MatchesName (name=%s)",
- static_cast<void *>(m_opaque_sp.get()), name);
-
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->MatchesName(name);
+ bkpt_sp->GetTarget().GetAPIMutex());
+ return bkpt_sp->MatchesName(name);
}
return false;
@@ -639,36 +614,20 @@ bool SBBreakpoint::MatchesName(const char *name) {
void SBBreakpoint::GetNames(SBStringList &names) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointSP bkpt_sp = GetSP();
+ LLDB_LOG(log, "breakpoint = {0}", bkpt_sp.get());
- if (log)
- log->Printf("SBBreakpoint(%p)::GetNames ()",
- static_cast<void *>(m_opaque_sp.get()));
-
- if (m_opaque_sp) {
+ if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
+ bkpt_sp->GetTarget().GetAPIMutex());
std::vector<std::string> names_vec;
- m_opaque_sp->GetNames(names_vec);
+ bkpt_sp->GetNames(names_vec);
for (std::string name : names_vec) {
names.AppendString(name.c_str());
}
}
}
-lldb_private::Breakpoint *SBBreakpoint::operator->() const {
- return m_opaque_sp.get();
-}
-
-lldb_private::Breakpoint *SBBreakpoint::get() const {
- return m_opaque_sp.get();
-}
-
-lldb::BreakpointSP &SBBreakpoint::operator*() { return m_opaque_sp; }
-
-const lldb::BreakpointSP &SBBreakpoint::operator*() const {
- return m_opaque_sp;
-}
-
bool SBBreakpoint::EventIsBreakpointEvent(const lldb::SBEvent &event) {
return Breakpoint::BreakpointEventData::GetEventDataFromEvent(event.get()) !=
nullptr;
@@ -683,11 +642,10 @@ SBBreakpoint::GetBreakpointEventTypeFromEvent(const SBEvent &event) {
}
SBBreakpoint SBBreakpoint::GetBreakpointFromEvent(const lldb::SBEvent &event) {
- SBBreakpoint sb_breakpoint;
if (event.IsValid())
- sb_breakpoint.m_opaque_sp =
- Breakpoint::BreakpointEventData::GetBreakpointFromEvent(event.GetSP());
- return sb_breakpoint;
+ return SBBreakpoint(
+ Breakpoint::BreakpointEventData::GetBreakpointFromEvent(event.GetSP()));
+ return SBBreakpoint();
}
SBBreakpointLocation
@@ -711,6 +669,8 @@ SBBreakpoint::GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event) {
return num_locations;
}
+BreakpointSP SBBreakpoint::GetSP() const { return m_opaque_wp.lock(); }
+
// This is simple collection of breakpoint id's and their target.
class SBBreakpointListImpl {
public:
@@ -745,28 +705,28 @@ public:
return BreakpointSP();
}
- bool Append(Breakpoint &bkpt) {
+ bool Append(BreakpointSP bkpt) {
TargetSP target_sp = m_target_wp.lock();
- if (!target_sp)
+ if (!target_sp || !bkpt)
return false;
- if (bkpt.GetTargetSP() != target_sp)
+ if (bkpt->GetTargetSP() != target_sp)
return false;
- m_break_ids.push_back(bkpt.GetID());
+ m_break_ids.push_back(bkpt->GetID());
return true;
}
- bool AppendIfUnique(Breakpoint &bkpt) {
+ bool AppendIfUnique(BreakpointSP bkpt) {
TargetSP target_sp = m_target_wp.lock();
- if (!target_sp)
+ if (!target_sp || !bkpt)
return false;
- if (bkpt.GetTargetSP() != target_sp)
+ if (bkpt->GetTargetSP() != target_sp)
return false;
- lldb::break_id_t bp_id = bkpt.GetID();
+ lldb::break_id_t bp_id = bkpt->GetID();
if (find(m_break_ids.begin(), m_break_ids.end(), bp_id) ==
m_break_ids.end())
return false;
- m_break_ids.push_back(bkpt.GetID());
+ m_break_ids.push_back(bkpt->GetID());
return true;
}
@@ -827,7 +787,7 @@ void SBBreakpointList::Append(const SBBreakpoint &sb_bkpt) {
return;
if (!m_opaque_sp)
return;
- m_opaque_sp->Append(*sb_bkpt.get());
+ m_opaque_sp->Append(sb_bkpt.m_opaque_wp.lock());
}
void SBBreakpointList::AppendByID(lldb::break_id_t id) {
@@ -841,7 +801,7 @@ bool SBBreakpointList::AppendIfUnique(const SBBreakpoint &sb_bkpt) {
return false;
if (!m_opaque_sp)
return false;
- return m_opaque_sp->AppendIfUnique(*sb_bkpt.get());
+ return m_opaque_sp->AppendIfUnique(sb_bkpt.GetSP());
}
void SBBreakpointList::Clear() {
diff --git a/source/API/SBBreakpointLocation.cpp b/source/API/SBBreakpointLocation.cpp
index c7fac7688f830..d8779ffe2ba8a 100644
--- a/source/API/SBBreakpointLocation.cpp
+++ b/source/API/SBBreakpointLocation.cpp
@@ -16,118 +16,124 @@
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadSpec.h"
-#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-types.h"
using namespace lldb;
using namespace lldb_private;
-SBBreakpointLocation::SBBreakpointLocation() : m_opaque_sp() {}
+SBBreakpointLocation::SBBreakpointLocation() {}
SBBreakpointLocation::SBBreakpointLocation(
const lldb::BreakpointLocationSP &break_loc_sp)
- : m_opaque_sp(break_loc_sp) {
+ : m_opaque_wp(break_loc_sp) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (log) {
SBStream sstr;
GetDescription(sstr, lldb::eDescriptionLevelBrief);
- log->Printf("SBBreakpointLocation::SBBreakpointLocaiton (const "
- "lldb::BreakpointLocationsSP &break_loc_sp"
- "=%p) => this.sp = %p (%s)",
- static_cast<void *>(break_loc_sp.get()),
- static_cast<void *>(m_opaque_sp.get()), sstr.GetData());
+ LLDB_LOG(log, "location = {0} ({1})", break_loc_sp.get(), sstr.GetData());
}
}
SBBreakpointLocation::SBBreakpointLocation(const SBBreakpointLocation &rhs)
- : m_opaque_sp(rhs.m_opaque_sp) {}
+ : m_opaque_wp(rhs.m_opaque_wp) {}
const SBBreakpointLocation &SBBreakpointLocation::
operator=(const SBBreakpointLocation &rhs) {
- if (this != &rhs)
- m_opaque_sp = rhs.m_opaque_sp;
+ m_opaque_wp = rhs.m_opaque_wp;
return *this;
}
SBBreakpointLocation::~SBBreakpointLocation() {}
-bool SBBreakpointLocation::IsValid() const { return m_opaque_sp.get() != NULL; }
+BreakpointLocationSP SBBreakpointLocation::GetSP() const {
+ return m_opaque_wp.lock();
+}
+
+bool SBBreakpointLocation::IsValid() const { return bool(GetSP()); }
SBAddress SBBreakpointLocation::GetAddress() {
- if (m_opaque_sp)
- return SBAddress(&m_opaque_sp->GetAddress());
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp)
+ return SBAddress(&loc_sp->GetAddress());
else
return SBAddress();
}
addr_t SBBreakpointLocation::GetLoadAddress() {
addr_t ret_addr = LLDB_INVALID_ADDRESS;
+ BreakpointLocationSP loc_sp = GetSP();
- if (m_opaque_sp) {
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- ret_addr = m_opaque_sp->GetLoadAddress();
+ loc_sp->GetTarget().GetAPIMutex());
+ ret_addr = loc_sp->GetLoadAddress();
}
return ret_addr;
}
void SBBreakpointLocation::SetEnabled(bool enabled) {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetEnabled(enabled);
+ loc_sp->GetTarget().GetAPIMutex());
+ loc_sp->SetEnabled(enabled);
}
}
bool SBBreakpointLocation::IsEnabled() {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->IsEnabled();
+ loc_sp->GetTarget().GetAPIMutex());
+ return loc_sp->IsEnabled();
} else
return false;
}
uint32_t SBBreakpointLocation::GetIgnoreCount() {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->GetIgnoreCount();
+ loc_sp->GetTarget().GetAPIMutex());
+ return loc_sp->GetIgnoreCount();
} else
return 0;
}
void SBBreakpointLocation::SetIgnoreCount(uint32_t n) {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetIgnoreCount(n);
+ loc_sp->GetTarget().GetAPIMutex());
+ loc_sp->SetIgnoreCount(n);
}
}
void SBBreakpointLocation::SetCondition(const char *condition) {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetCondition(condition);
+ loc_sp->GetTarget().GetAPIMutex());
+ loc_sp->SetCondition(condition);
}
}
const char *SBBreakpointLocation::GetCondition() {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->GetConditionText();
+ loc_sp->GetTarget().GetAPIMutex());
+ return loc_sp->GetConditionText();
}
return NULL;
}
@@ -135,17 +141,15 @@ const char *SBBreakpointLocation::GetCondition() {
void SBBreakpointLocation::SetScriptCallbackFunction(
const char *callback_function_name) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ BreakpointLocationSP loc_sp = GetSP();
+ LLDB_LOG(log, "location = {0}, callback = {1}", loc_sp.get(),
+ callback_function_name);
- if (log)
- log->Printf(
- "SBBreakpointLocation(%p)::SetScriptCallbackFunction (callback=%s)",
- static_cast<void *>(m_opaque_sp.get()), callback_function_name);
-
- if (m_opaque_sp) {
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
- m_opaque_sp->GetBreakpoint()
+ loc_sp->GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = loc_sp->GetLocationOptions();
+ loc_sp->GetBreakpoint()
.GetTarget()
.GetDebugger()
.GetCommandInterpreter()
@@ -158,18 +162,17 @@ void SBBreakpointLocation::SetScriptCallbackFunction(
SBError
SBBreakpointLocation::SetScriptCallbackBody(const char *callback_body_text) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-
- if (log)
- log->Printf("SBBreakpoint(%p)::SetScriptCallbackBody: callback body:\n%s)",
- static_cast<void *>(m_opaque_sp.get()), callback_body_text);
+ BreakpointLocationSP loc_sp = GetSP();
+ LLDB_LOG(log, "location = {0}: callback body:\n{1}", loc_sp.get(),
+ callback_body_text);
SBError sb_error;
- if (m_opaque_sp) {
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
+ loc_sp->GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = loc_sp->GetLocationOptions();
Error error =
- m_opaque_sp->GetBreakpoint()
+ loc_sp->GetBreakpoint()
.GetTarget()
.GetDebugger()
.GetCommandInterpreter()
@@ -183,80 +186,89 @@ SBBreakpointLocation::SetScriptCallbackBody(const char *callback_body_text) {
}
void SBBreakpointLocation::SetThreadID(tid_t thread_id) {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetThreadID(thread_id);
+ loc_sp->GetTarget().GetAPIMutex());
+ loc_sp->SetThreadID(thread_id);
}
}
tid_t SBBreakpointLocation::GetThreadID() {
tid_t tid = LLDB_INVALID_THREAD_ID;
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->GetThreadID();
+ loc_sp->GetTarget().GetAPIMutex());
+ return loc_sp->GetThreadID();
}
return tid;
}
void SBBreakpointLocation::SetThreadIndex(uint32_t index) {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetThreadIndex(index);
+ loc_sp->GetTarget().GetAPIMutex());
+ loc_sp->SetThreadIndex(index);
}
}
uint32_t SBBreakpointLocation::GetThreadIndex() const {
uint32_t thread_idx = UINT32_MAX;
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->GetThreadIndex();
+ loc_sp->GetTarget().GetAPIMutex());
+ return loc_sp->GetThreadIndex();
}
return thread_idx;
}
void SBBreakpointLocation::SetThreadName(const char *thread_name) {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetThreadName(thread_name);
+ loc_sp->GetTarget().GetAPIMutex());
+ loc_sp->SetThreadName(thread_name);
}
}
const char *SBBreakpointLocation::GetThreadName() const {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->GetThreadName();
+ loc_sp->GetTarget().GetAPIMutex());
+ return loc_sp->GetThreadName();
}
return NULL;
}
void SBBreakpointLocation::SetQueueName(const char *queue_name) {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetQueueName(queue_name);
+ loc_sp->GetTarget().GetAPIMutex());
+ loc_sp->SetQueueName(queue_name);
}
}
const char *SBBreakpointLocation::GetQueueName() const {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->GetQueueName();
+ loc_sp->GetTarget().GetAPIMutex());
+ loc_sp->GetQueueName();
}
return NULL;
}
bool SBBreakpointLocation::IsResolved() {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->IsResolved();
+ loc_sp->GetTarget().GetAPIMutex());
+ return loc_sp->IsResolved();
}
return false;
}
@@ -264,17 +276,18 @@ bool SBBreakpointLocation::IsResolved() {
void SBBreakpointLocation::SetLocation(
const lldb::BreakpointLocationSP &break_loc_sp) {
// Uninstall the callbacks?
- m_opaque_sp = break_loc_sp;
+ m_opaque_wp = break_loc_sp;
}
bool SBBreakpointLocation::GetDescription(SBStream &description,
DescriptionLevel level) {
Stream &strm = description.ref();
+ BreakpointLocationSP loc_sp = GetSP();
- if (m_opaque_sp) {
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->GetDescription(&strm, level);
+ loc_sp->GetTarget().GetAPIMutex());
+ loc_sp->GetDescription(&strm, level);
strm.EOL();
} else
strm.PutCString("No value");
@@ -283,34 +296,31 @@ bool SBBreakpointLocation::GetDescription(SBStream &description,
}
break_id_t SBBreakpointLocation::GetID() {
- if (m_opaque_sp) {
+ BreakpointLocationSP loc_sp = GetSP();
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->GetID();
+ loc_sp->GetTarget().GetAPIMutex());
+ return loc_sp->GetID();
} else
return LLDB_INVALID_BREAK_ID;
}
SBBreakpoint SBBreakpointLocation::GetBreakpoint() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-
- // if (log)
- // log->Printf ("SBBreakpointLocation::GetBreakpoint ()");
+ BreakpointLocationSP loc_sp = GetSP();
SBBreakpoint sb_bp;
- if (m_opaque_sp) {
+ if (loc_sp) {
std::lock_guard<std::recursive_mutex> guard(
- m_opaque_sp->GetTarget().GetAPIMutex());
- *sb_bp = m_opaque_sp->GetBreakpoint().shared_from_this();
+ loc_sp->GetTarget().GetAPIMutex());
+ sb_bp = loc_sp->GetBreakpoint().shared_from_this();
}
if (log) {
SBStream sstr;
sb_bp.GetDescription(sstr);
- log->Printf(
- "SBBreakpointLocation(%p)::GetBreakpoint () => SBBreakpoint(%p) %s",
- static_cast<void *>(m_opaque_sp.get()),
- static_cast<void *>(sb_bp.get()), sstr.GetData());
+ LLDB_LOG(log, "location = {0}, breakpoint = {1} ({2})", loc_sp.get(),
+ sb_bp.GetSP().get(), sstr.GetData());
}
return sb_bp;
}
diff --git a/source/API/SBBroadcaster.cpp b/source/API/SBBroadcaster.cpp
index 5189dd7bb2710..278576b5ddcd5 100644
--- a/source/API/SBBroadcaster.cpp
+++ b/source/API/SBBroadcaster.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/Core/Broadcaster.h"
-#include "lldb/Core/Log.h"
+#include "lldb/Utility/Log.h"
#include "lldb/API/SBBroadcaster.h"
#include "lldb/API/SBEvent.h"
@@ -22,25 +22,15 @@ SBBroadcaster::SBBroadcaster() : m_opaque_sp(), m_opaque_ptr(NULL) {}
SBBroadcaster::SBBroadcaster(const char *name)
: m_opaque_sp(new Broadcaster(NULL, name)), m_opaque_ptr(NULL) {
m_opaque_ptr = m_opaque_sp.get();
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API |
- LIBLLDB_LOG_VERBOSE));
-
- if (log)
- log->Printf(
- "SBBroadcaster::SBBroadcaster (name=\"%s\") => SBBroadcaster(%p)", name,
- static_cast<void *>(m_opaque_ptr));
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_LOGV(log, "(name=\"{0}\") => SBBroadcaster({1})", name, m_opaque_ptr);
}
SBBroadcaster::SBBroadcaster(lldb_private::Broadcaster *broadcaster, bool owns)
: m_opaque_sp(owns ? broadcaster : NULL), m_opaque_ptr(broadcaster) {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API |
- LIBLLDB_LOG_VERBOSE));
-
- if (log)
- log->Printf("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) "
- "=> SBBroadcaster(%p)",
- static_cast<void *>(broadcaster), owns,
- static_cast<void *>(m_opaque_ptr));
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_LOGV(log, "(broadcaster={0}, owns={1}) => SBBroadcaster({2})",
+ broadcaster, owns, m_opaque_ptr);
}
SBBroadcaster::SBBroadcaster(const SBBroadcaster &rhs)
diff --git a/source/API/SBCommandReturnObject.cpp b/source/API/SBCommandReturnObject.cpp
index 41d5147af7073..7eed94e05b107 100644
--- a/source/API/SBCommandReturnObject.cpp
+++ b/source/API/SBCommandReturnObject.cpp
@@ -15,9 +15,10 @@
#include "lldb/API/SBError.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/Error.h"
-#include "lldb/Core/Log.h"
#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Error.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBCommunication.cpp b/source/API/SBCommunication.cpp
index 9519c02f7e22a..8ebc33ca26a6d 100644
--- a/source/API/SBCommunication.cpp
+++ b/source/API/SBCommunication.cpp
@@ -10,8 +10,8 @@
#include "lldb/API/SBCommunication.h"
#include "lldb/API/SBBroadcaster.h"
#include "lldb/Core/Communication.h"
-#include "lldb/Core/Log.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBCompileUnit.cpp b/source/API/SBCompileUnit.cpp
index 12aed5911de79..149d587913e9c 100644
--- a/source/API/SBCompileUnit.cpp
+++ b/source/API/SBCompileUnit.cpp
@@ -10,13 +10,13 @@
#include "lldb/API/SBCompileUnit.h"
#include "lldb/API/SBLineEntry.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBData.cpp b/source/API/SBData.cpp
index d905d3f272f36..a8ba5808d4f66 100644
--- a/source/API/SBData.cpp
+++ b/source/API/SBData.cpp
@@ -13,10 +13,11 @@
#include "lldb/API/SBError.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/DataExtractor.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/Core/DumpDataExtractor.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb;
using namespace lldb_private;
@@ -347,7 +348,7 @@ bool SBData::GetDescription(lldb::SBStream &description,
Stream &strm = description.ref();
if (m_opaque_sp) {
- m_opaque_sp->Dump(&strm, 0, lldb::eFormatBytesWithASCII, 1,
+ DumpDataExtractor(*m_opaque_sp, &strm, 0, lldb::eFormatBytesWithASCII, 1,
m_opaque_sp->GetByteSize(), 16, base_addr, 0, 0);
} else
strm.PutCString("No value");
@@ -383,7 +384,11 @@ void SBData::SetData(lldb::SBError &error, const void *buf, size_t size,
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buf, size, endian, addr_size));
else
+ {
m_opaque_sp->SetData(buf, size, endian);
+ m_opaque_sp->SetAddressByteSize(addr_size);
+ }
+
if (log)
log->Printf("SBData::SetData (error=%p,buf=%p,size=%" PRIu64
",endian=%d,addr_size=%c) => "
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 97e6f7b518a52..8d23d3eb85052 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -1120,13 +1120,23 @@ SBTypeSynthetic SBDebugger::GetSyntheticForType(SBTypeNameSpecifier type_name) {
}
#endif // LLDB_DISABLE_PYTHON
+static llvm::ArrayRef<const char *> GetCategoryArray(const char **categories) {
+ if (categories == nullptr)
+ return {};
+ size_t len = 0;
+ while (categories[len] != nullptr)
+ ++len;
+ return llvm::makeArrayRef(categories, len);
+}
+
bool SBDebugger::EnableLog(const char *channel, const char **categories) {
if (m_opaque_sp) {
uint32_t log_options =
LLDB_LOG_OPTION_PREPEND_TIMESTAMP | LLDB_LOG_OPTION_PREPEND_THREAD_NAME;
- StreamString errors;
- return m_opaque_sp->EnableLog(channel, categories, nullptr, log_options,
- errors);
+ std::string error;
+ llvm::raw_string_ostream error_stream(error);
+ return m_opaque_sp->EnableLog(channel, GetCategoryArray(categories), "",
+ log_options, error_stream);
} else
return false;
}
diff --git a/source/API/SBDeclaration.cpp b/source/API/SBDeclaration.cpp
index fc21f83f7ce9d..d6e61e32582df 100644
--- a/source/API/SBDeclaration.cpp
+++ b/source/API/SBDeclaration.cpp
@@ -1,5 +1,4 @@
-//===-- SBDeclaration.cpp -----------------------------------------*- C++
-//-*-===//
+//===-- SBDeclaration.cpp ----------------------------------------*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,9 +9,10 @@
#include "lldb/API/SBDeclaration.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/Host/PosixApi.h"
#include "lldb/Symbol/Declaration.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
#include <limits.h>
diff --git a/source/API/SBError.cpp b/source/API/SBError.cpp
index 451c0a709ec66..a692a9678cdee 100644
--- a/source/API/SBError.cpp
+++ b/source/API/SBError.cpp
@@ -9,8 +9,8 @@
#include "lldb/API/SBError.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/Error.h"
-#include "lldb/Core/Log.h"
+#include "lldb/Utility/Error.h"
+#include "lldb/Utility/Log.h"
#include <stdarg.h>
diff --git a/source/API/SBEvent.cpp b/source/API/SBEvent.cpp
index e0bb68c66c27d..17a16ffd04812 100644
--- a/source/API/SBEvent.cpp
+++ b/source/API/SBEvent.cpp
@@ -12,12 +12,12 @@
#include "lldb/API/SBStream.h"
#include "lldb/Breakpoint/Breakpoint.h"
-#include "lldb/Core/ConstString.h"
#include "lldb/Core/Event.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb;
using namespace lldb_private;
@@ -109,13 +109,9 @@ bool SBEvent::BroadcasterMatchesRef(const SBBroadcaster &broadcaster) {
// For logging, this gets a little chatty so only enable this when verbose
// logging is on
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API |
- LIBLLDB_LOG_VERBOSE));
- if (log)
- log->Printf(
- "SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i",
- static_cast<void *>(get()), static_cast<void *>(broadcaster.get()),
- broadcaster.GetName(), success);
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+ LLDB_LOGV(log, "({0}) (SBBroadcaster({1}): {2}) => {3}", get(),
+ broadcaster.get(), broadcaster.GetName(), success);
return success;
}
diff --git a/source/API/SBFileSpec.cpp b/source/API/SBFileSpec.cpp
index 88baf3b17ab13..011b88225ef9c 100644
--- a/source/API/SBFileSpec.cpp
+++ b/source/API/SBFileSpec.cpp
@@ -12,9 +12,10 @@
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Stream.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Host/PosixApi.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
#include "llvm/ADT/SmallString.h"
diff --git a/source/API/SBFileSpecList.cpp b/source/API/SBFileSpecList.cpp
index 8ed3f6f039691..67d28dcbe1117 100644
--- a/source/API/SBFileSpecList.cpp
+++ b/source/API/SBFileSpecList.cpp
@@ -13,9 +13,10 @@
#include "lldb/API/SBFileSpecList.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/FileSpecList.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Stream.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Host/PosixApi.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index 8d8cb48df3b8c..d52bbe8069f80 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -21,9 +21,6 @@
#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/ConstString.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/ValueObjectRegister.h"
#include "lldb/Core/ValueObjectVariable.h"
@@ -42,6 +39,9 @@
#include "lldb/Target/StackID.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDebugger.h"
@@ -1370,6 +1370,25 @@ const char *SBFrame::GetFunctionName() {
return static_cast<const SBFrame *>(this)->GetFunctionName();
}
+lldb::LanguageType SBFrame::GuessLanguage() const {
+ 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();
+ if (target && process) {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&process->GetRunLock())) {
+ frame = exe_ctx.GetFramePtr();
+ if (frame) {
+ return frame->GuessLanguage();
+ }
+ }
+ }
+ return eLanguageTypeUnknown;
+}
+
const char *SBFrame::GetFunctionName() const {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
const char *name = nullptr;
diff --git a/source/API/SBFunction.cpp b/source/API/SBFunction.cpp
index 9065cc383ef71..6a24f64b43e4e 100644
--- a/source/API/SBFunction.cpp
+++ b/source/API/SBFunction.cpp
@@ -11,7 +11,6 @@
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/Disassembler.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
@@ -19,6 +18,7 @@
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBHostOS.cpp b/source/API/SBHostOS.cpp
index 8df74d931ec03..c25499db89cde 100644
--- a/source/API/SBHostOS.cpp
+++ b/source/API/SBHostOS.cpp
@@ -9,13 +9,13 @@
#include "lldb/API/SBHostOS.h"
#include "lldb/API/SBError.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/HostNativeThread.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/ThreadLauncher.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Log.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Path.h"
diff --git a/source/API/SBInstruction.cpp b/source/API/SBInstruction.cpp
index 8c616da5a7f07..c47307c733a89 100644
--- a/source/API/SBInstruction.cpp
+++ b/source/API/SBInstruction.cpp
@@ -16,8 +16,6 @@
#include "lldb/API/SBTarget.h"
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/EmulateInstruction.h"
#include "lldb/Core/Module.h"
@@ -25,6 +23,8 @@
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataExtractor.h"
//----------------------------------------------------------------------
// We recently fixed a leak in one of the Instruction subclasses where
diff --git a/source/API/SBInstructionList.cpp b/source/API/SBInstructionList.cpp
index 8ab3aca21816f..04c37f50c2d72 100644
--- a/source/API/SBInstructionList.cpp
+++ b/source/API/SBInstructionList.cpp
@@ -12,8 +12,8 @@
#include "lldb/API/SBStream.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBLineEntry.cpp b/source/API/SBLineEntry.cpp
index 3469cecfb7acd..7341d3603dfe3 100644
--- a/source/API/SBLineEntry.cpp
+++ b/source/API/SBLineEntry.cpp
@@ -11,9 +11,10 @@
#include "lldb/API/SBLineEntry.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/StreamString.h"
+#include "lldb/Host/PosixApi.h"
#include "lldb/Symbol/LineEntry.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/StreamString.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBListener.cpp b/source/API/SBListener.cpp
index 501535a897b40..50fed4e1ee7bb 100644
--- a/source/API/SBListener.cpp
+++ b/source/API/SBListener.cpp
@@ -15,8 +15,8 @@
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Listener.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/StreamString.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/StreamString.h"
using namespace lldb;
using namespace lldb_private;
@@ -302,6 +302,8 @@ bool SBListener::HandleBroadcastEvent(const SBEvent &event) {
return false;
}
+lldb::ListenerSP SBListener::GetSP() { return m_opaque_sp; }
+
Listener *SBListener::operator->() const { return m_opaque_sp.get(); }
Listener *SBListener::get() const { return m_opaque_sp.get(); }
diff --git a/source/API/SBMemoryRegionInfo.cpp b/source/API/SBMemoryRegionInfo.cpp
index 3e7227650f7a2..c4dbaec707bb9 100644
--- a/source/API/SBMemoryRegionInfo.cpp
+++ b/source/API/SBMemoryRegionInfo.cpp
@@ -11,8 +11,8 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/StreamString.h"
#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Utility/StreamString.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBMemoryRegionInfoList.cpp b/source/API/SBMemoryRegionInfoList.cpp
index f7ce81af52d16..fff4044f73e0f 100644
--- a/source/API/SBMemoryRegionInfoList.cpp
+++ b/source/API/SBMemoryRegionInfoList.cpp
@@ -7,11 +7,11 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/API/SBMemoryRegionInfo.h"
#include "lldb/API/SBMemoryRegionInfoList.h"
+#include "lldb/API/SBMemoryRegionInfo.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/Log.h"
#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Utility/Log.h"
#include <vector>
diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp
index 89643033a1dd8..3865ba927977b 100644
--- a/source/API/SBModule.cpp
+++ b/source/API/SBModule.cpp
@@ -14,10 +14,8 @@
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBSymbolContextList.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/StreamString.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -27,6 +25,8 @@
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/StreamString.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBModuleSpec.cpp b/source/API/SBModuleSpec.cpp
index b82b822859b48..a1c08865c6a4f 100644
--- a/source/API/SBModuleSpec.cpp
+++ b/source/API/SBModuleSpec.cpp
@@ -11,9 +11,9 @@
#include "lldb/API/SBStream.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBPlatform.cpp b/source/API/SBPlatform.cpp
index 6085cef32064e..0f1b99236a71d 100644
--- a/source/API/SBPlatform.cpp
+++ b/source/API/SBPlatform.cpp
@@ -13,11 +13,13 @@
#include "lldb/API/SBLaunchInfo.h"
#include "lldb/API/SBUnixSignals.h"
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Core/Error.h"
#include "lldb/Host/File.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/Error.h"
+
+#include "llvm/Support/FileSystem.h"
#include <functional>
@@ -363,7 +365,7 @@ SBError SBPlatform::Put(SBFileSpec &src, SBFileSpec &dst) {
if (src.Exists()) {
uint32_t permissions = src.ref().GetPermissions();
if (permissions == 0) {
- if (src.ref().GetFileType() == FileSpec::eFileTypeDirectory)
+ if (llvm::sys::fs::is_directory(src.ref().GetPath()))
permissions = eFilePermissionsDirectoryDefault;
else
permissions = eFilePermissionsFileDefault;
diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp
index 59dd569332781..4cb367a03ad6c 100644
--- a/source/API/SBProcess.cpp
+++ b/source/API/SBProcess.cpp
@@ -16,11 +16,9 @@
#include "lldb/lldb-types.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Target/MemoryRegionInfo.h"
@@ -29,6 +27,8 @@
#include "lldb/Target/SystemRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
// Project includes
diff --git a/source/API/SBQueue.cpp b/source/API/SBQueue.cpp
index c6f53057a7af9..5f852111e0779 100644
--- a/source/API/SBQueue.cpp
+++ b/source/API/SBQueue.cpp
@@ -15,11 +15,11 @@
#include "lldb/API/SBQueueItem.h"
#include "lldb/API/SBThread.h"
-#include "lldb/Core/Log.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Queue.h"
#include "lldb/Target/QueueItem.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBQueueItem.cpp b/source/API/SBQueueItem.cpp
index 2e06bc89b3d5d..87ba73f9e6d38 100644
--- a/source/API/SBQueueItem.cpp
+++ b/source/API/SBQueueItem.cpp
@@ -13,10 +13,10 @@
#include "lldb/API/SBQueueItem.h"
#include "lldb/API/SBThread.h"
#include "lldb/Core/Address.h"
-#include "lldb/Core/Log.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/QueueItem.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBSection.cpp b/source/API/SBSection.cpp
index 8124fe94841d7..9da5d170da9e0 100644
--- a/source/API/SBSection.cpp
+++ b/source/API/SBSection.cpp
@@ -10,13 +10,14 @@
#include "lldb/API/SBSection.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBTarget.h"
-#include "lldb/Core/DataBuffer.h"
-#include "lldb/Core/DataExtractor.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/DataBuffer.h"
+#include "lldb/Utility/DataBufferLLVM.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/StreamString.h"
using namespace lldb;
using namespace lldb_private;
@@ -165,8 +166,8 @@ SBData SBSection::GetSectionData(uint64_t offset, uint64_t size) {
else
file_size = 0;
}
- DataBufferSP data_buffer_sp(
- objfile->GetFileSpec().ReadFileContents(file_offset, file_size));
+ auto data_buffer_sp = DataBufferLLVM::CreateSliceFromPath(
+ objfile->GetFileSpec().GetPath(), file_size, file_offset);
if (data_buffer_sp && data_buffer_sp->GetByteSize() > 0) {
DataExtractorSP data_extractor_sp(
new DataExtractor(data_buffer_sp, objfile->GetByteOrder(),
diff --git a/source/API/SBSourceManager.cpp b/source/API/SBSourceManager.cpp
index ecf532c311622..5804c22bacb8b 100644
--- a/source/API/SBSourceManager.cpp
+++ b/source/API/SBSourceManager.cpp
@@ -15,8 +15,8 @@
#include "lldb/API/SBFileSpec.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/SourceManager.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Utility/Stream.h"
#include "lldb/Target/Target.h"
diff --git a/source/API/SBStream.cpp b/source/API/SBStream.cpp
index 858e949206f4a..5ae5a01589ded 100644
--- a/source/API/SBStream.cpp
+++ b/source/API/SBStream.cpp
@@ -9,10 +9,10 @@
#include "lldb/API/SBStream.h"
-#include "lldb/Core/Error.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/StreamString.h"
+#include "lldb/Utility/Error.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StreamString.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBStringList.cpp b/source/API/SBStringList.cpp
index 075ee0d5bc470..9ac69b15ebb79 100644
--- a/source/API/SBStringList.cpp
+++ b/source/API/SBStringList.cpp
@@ -9,7 +9,7 @@
#include "lldb/API/SBStringList.h"
-#include "lldb/Core/StringList.h"
+#include "lldb/Utility/StringList.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBStructuredData.cpp b/source/API/SBStructuredData.cpp
index d9ea072186a9b..6d4c862306f99 100644
--- a/source/API/SBStructuredData.cpp
+++ b/source/API/SBStructuredData.cpp
@@ -10,11 +10,11 @@
#include "lldb/API/SBStructuredData.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/Error.h"
#include "lldb/Core/Event.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StructuredData.h"
#include "lldb/Target/StructuredDataPlugin.h"
+#include "lldb/Utility/Error.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBSymbol.cpp b/source/API/SBSymbol.cpp
index a4cc5252b1c51..5be20a124982b 100644
--- a/source/API/SBSymbol.cpp
+++ b/source/API/SBSymbol.cpp
@@ -10,11 +10,11 @@
#include "lldb/API/SBSymbol.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/Disassembler.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBSymbolContext.cpp b/source/API/SBSymbolContext.cpp
index 474883673310e..45dfffd916e7b 100644
--- a/source/API/SBSymbolContext.cpp
+++ b/source/API/SBSymbolContext.cpp
@@ -9,11 +9,11 @@
#include "lldb/API/SBSymbolContext.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index c000bf94c234e..4032383eb56c2 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -34,17 +34,14 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Disassembler.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/STLUtils.h"
#include "lldb/Core/SearchFilter.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Core/ValueObjectVariable.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Symbol/ClangASTContext.h"
@@ -61,6 +58,9 @@
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/TargetList.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/RegularExpression.h"
#include "../source/Commands/CommandObjectBreakpoint.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -686,7 +686,7 @@ SBTarget::BreakpointCreateByLocation(const SBFileSpec &sb_file_spec,
if (sb_module_list.GetSize() > 0) {
module_list = sb_module_list.get();
}
- *sb_bp = target_sp->CreateBreakpoint(
+ sb_bp = target_sp->CreateBreakpoint(
module_list, *sb_file_spec, line, offset, check_inlines, skip_prologue,
internal, hardware, move_to_nearest_code);
}
@@ -699,7 +699,7 @@ SBTarget::BreakpointCreateByLocation(const SBFileSpec &sb_file_spec,
log->Printf("SBTarget(%p)::BreakpointCreateByLocation ( %s:%u ) => "
"SBBreakpoint(%p): %s",
static_cast<void *>(target_sp.get()), path, line,
- static_cast<void *>(sb_bp.get()), sstr.GetData());
+ static_cast<void *>(sb_bp.GetSP().get()), sstr.GetData());
}
return sb_bp;
@@ -721,11 +721,11 @@ SBBreakpoint SBTarget::BreakpointCreateByName(const char *symbol_name,
if (module_name && module_name[0]) {
FileSpecList module_spec_list;
module_spec_list.Append(FileSpec(module_name, false));
- *sb_bp = target_sp->CreateBreakpoint(
+ sb_bp = target_sp->CreateBreakpoint(
&module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto,
eLanguageTypeUnknown, offset, skip_prologue, internal, hardware);
} else {
- *sb_bp = target_sp->CreateBreakpoint(
+ sb_bp = target_sp->CreateBreakpoint(
NULL, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown,
offset, skip_prologue, internal, hardware);
}
@@ -735,7 +735,7 @@ SBBreakpoint SBTarget::BreakpointCreateByName(const char *symbol_name,
log->Printf("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", "
"module=\"%s\") => SBBreakpoint(%p)",
static_cast<void *>(target_sp.get()), symbol_name, module_name,
- static_cast<void *>(sb_bp.get()));
+ static_cast<void *>(sb_bp.GetSP().get()));
return sb_bp;
}
@@ -771,7 +771,7 @@ lldb::SBBreakpoint SBTarget::BreakpointCreateByName(
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
- *sb_bp = target_sp->CreateBreakpoint(
+ sb_bp = target_sp->CreateBreakpoint(
module_list.get(), comp_unit_list.get(), symbol_name, name_type_mask,
symbol_language, 0, skip_prologue, internal, hardware);
}
@@ -780,7 +780,7 @@ lldb::SBBreakpoint SBTarget::BreakpointCreateByName(
log->Printf("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", "
"name_type: %d) => SBBreakpoint(%p)",
static_cast<void *>(target_sp.get()), symbol_name,
- name_type_mask, static_cast<void *>(sb_bp.get()));
+ name_type_mask, static_cast<void *>(sb_bp.GetSP().get()));
return sb_bp;
}
@@ -815,7 +815,7 @@ lldb::SBBreakpoint SBTarget::BreakpointCreateByNames(
const bool internal = false;
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
- *sb_bp = target_sp->CreateBreakpoint(
+ sb_bp = target_sp->CreateBreakpoint(
module_list.get(), comp_unit_list.get(), symbol_names, num_names,
name_type_mask, symbol_language, offset, skip_prologue, internal,
hardware);
@@ -836,7 +836,7 @@ lldb::SBBreakpoint SBTarget::BreakpointCreateByNames(
log->Printf("\"<NULL>\"%c ", sep);
}
log->Printf("name_type: %d) => SBBreakpoint(%p)", name_type_mask,
- static_cast<void *>(sb_bp.get()));
+ static_cast<void *>(sb_bp.GetSP().get()));
}
return sb_bp;
@@ -875,7 +875,7 @@ lldb::SBBreakpoint SBTarget::BreakpointCreateByRegex(
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
- *sb_bp = target_sp->CreateFuncRegexBreakpoint(
+ sb_bp = target_sp->CreateFuncRegexBreakpoint(
module_list.get(), comp_unit_list.get(), regexp, symbol_language,
skip_prologue, internal, hardware);
}
@@ -884,7 +884,7 @@ lldb::SBBreakpoint SBTarget::BreakpointCreateByRegex(
log->Printf("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\") "
"=> SBBreakpoint(%p)",
static_cast<void *>(target_sp.get()), symbol_name_regex,
- static_cast<void *>(sb_bp.get()));
+ static_cast<void *>(sb_bp.GetSP().get()));
return sb_bp;
}
@@ -897,7 +897,7 @@ SBBreakpoint SBTarget::BreakpointCreateByAddress(addr_t address) {
if (target_sp) {
std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
const bool hardware = false;
- *sb_bp = target_sp->CreateBreakpoint(address, false, hardware);
+ sb_bp = target_sp->CreateBreakpoint(address, false, hardware);
}
if (log)
@@ -905,7 +905,7 @@ SBBreakpoint SBTarget::BreakpointCreateByAddress(addr_t address) {
") => SBBreakpoint(%p)",
static_cast<void *>(target_sp.get()),
static_cast<uint64_t>(address),
- static_cast<void *>(sb_bp.get()));
+ static_cast<void *>(sb_bp.GetSP().get()));
return sb_bp;
}
@@ -926,7 +926,7 @@ SBBreakpoint SBTarget::BreakpointCreateBySBAddress(SBAddress &sb_address) {
if (target_sp) {
std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
const bool hardware = false;
- *sb_bp = target_sp->CreateBreakpoint(sb_address.ref(), false, hardware);
+ sb_bp = target_sp->CreateBreakpoint(sb_address.ref(), false, hardware);
}
if (log) {
@@ -935,7 +935,7 @@ SBBreakpoint SBTarget::BreakpointCreateBySBAddress(SBAddress &sb_address) {
log->Printf("SBTarget(%p)::BreakpointCreateBySBAddress (address=%s) => "
"SBBreakpoint(%p)",
static_cast<void *>(target_sp.get()), s.GetData(),
- static_cast<void *>(sb_bp.get()));
+ static_cast<void *>(sb_bp.GetSP().get()));
}
return sb_bp;
@@ -985,7 +985,7 @@ lldb::SBBreakpoint SBTarget::BreakpointCreateBySourceRegex(
func_names_set.insert(func_names.GetStringAtIndex(i));
}
- *sb_bp = target_sp->CreateSourceRegexBreakpoint(
+ sb_bp = target_sp->CreateSourceRegexBreakpoint(
module_list.get(), source_file_list.get(), func_names_set, regexp,
false, hardware, move_to_nearest_code);
}
@@ -994,7 +994,7 @@ lldb::SBBreakpoint SBTarget::BreakpointCreateBySourceRegex(
log->Printf("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\") "
"=> SBBreakpoint(%p)",
static_cast<void *>(target_sp.get()), source_regex,
- static_cast<void *>(sb_bp.get()));
+ static_cast<void *>(sb_bp.GetSP().get()));
return sb_bp;
}
@@ -1009,7 +1009,7 @@ SBTarget::BreakpointCreateForException(lldb::LanguageType language,
if (target_sp) {
std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
const bool hardware = false;
- *sb_bp = target_sp->CreateExceptionBreakpoint(language, catch_bp, throw_bp,
+ sb_bp = target_sp->CreateExceptionBreakpoint(language, catch_bp, throw_bp,
hardware);
}
@@ -1019,7 +1019,7 @@ SBTarget::BreakpointCreateForException(lldb::LanguageType language,
static_cast<void *>(target_sp.get()),
Language::GetNameForLanguageType(language),
catch_bp ? "on" : "off", throw_bp ? "on" : "off",
- static_cast<void *>(sb_bp.get()));
+ static_cast<void *>(sb_bp.GetSP().get()));
return sb_bp;
}
@@ -1038,7 +1038,7 @@ SBBreakpoint SBTarget::GetBreakpointAtIndex(uint32_t idx) const {
TargetSP target_sp(GetSP());
if (target_sp) {
// The breakpoint list is thread safe, no need to lock
- *sb_breakpoint = target_sp->GetBreakpointList().GetBreakpointAtIndex(idx);
+ sb_breakpoint = target_sp->GetBreakpointList().GetBreakpointAtIndex(idx);
}
return sb_breakpoint;
}
@@ -1068,14 +1068,14 @@ SBBreakpoint SBTarget::FindBreakpointByID(break_id_t bp_id) {
TargetSP target_sp(GetSP());
if (target_sp && bp_id != LLDB_INVALID_BREAK_ID) {
std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
- *sb_breakpoint = target_sp->GetBreakpointByID(bp_id);
+ sb_breakpoint = target_sp->GetBreakpointByID(bp_id);
}
if (log)
log->Printf(
"SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p)",
static_cast<void *>(target_sp.get()), static_cast<uint32_t>(bp_id),
- static_cast<void *>(sb_breakpoint.get()));
+ static_cast<void *>(sb_breakpoint.GetSP().get()));
return sb_breakpoint;
}
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index fbde6dd326863..3961a7f925a00 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -15,7 +15,6 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/State.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredData.h"
#include "lldb/Core/ValueObject.h"
@@ -34,6 +33,7 @@
#include "lldb/Target/ThreadPlanStepOut.h"
#include "lldb/Target/ThreadPlanStepRange.h"
#include "lldb/Target/UnixSignals.h"
+#include "lldb/Utility/Stream.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDebugger.h"
@@ -595,8 +595,8 @@ bool SBThread::GetInfoItemByPathAsString(const char *path, SBStream &strm) {
}
if (log)
- log->Printf("SBThread(%p)::GetInfoItemByPathAsString () => %s",
- static_cast<void *>(exe_ctx.GetThreadPtr()), strm.GetData());
+ log->Printf("SBThread(%p)::GetInfoItemByPathAsString (\"%s\") => \"%s\"",
+ static_cast<void *>(exe_ctx.GetThreadPtr()), path, strm.GetData());
return success;
}
diff --git a/source/API/SBThreadPlan.cpp b/source/API/SBThreadPlan.cpp
index 74cabf7d4b045..7537a7645390b 100644
--- a/source/API/SBThreadPlan.cpp
+++ b/source/API/SBThreadPlan.cpp
@@ -15,7 +15,6 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/State.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredData.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -28,12 +27,12 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
-#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanPython.h"
#include "lldb/Target/ThreadPlanStepInRange.h"
#include "lldb/Target/ThreadPlanStepInstruction.h"
#include "lldb/Target/ThreadPlanStepOut.h"
#include "lldb/Target/ThreadPlanStepRange.h"
+#include "lldb/Utility/Stream.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDebugger.h"
diff --git a/source/API/SBType.cpp b/source/API/SBType.cpp
index ca63a875292d7..e2ef07cf5c478 100644
--- a/source/API/SBType.cpp
+++ b/source/API/SBType.cpp
@@ -11,13 +11,13 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBTypeEnumMember.h"
-#include "lldb/Core/ConstString.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Mangled.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/TypeSystem.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
#include "llvm/ADT/APSInt.h"
diff --git a/source/API/SBTypeEnumMember.cpp b/source/API/SBTypeEnumMember.cpp
index 787a46b176068..5ca9db7ce242e 100644
--- a/source/API/SBTypeEnumMember.cpp
+++ b/source/API/SBTypeEnumMember.cpp
@@ -7,13 +7,13 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/API/SBType.h"
+#include "lldb/API/SBTypeEnumMember.h"
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBStream.h"
-#include "lldb/API/SBTypeEnumMember.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/API/SBType.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBUnixSignals.cpp b/source/API/SBUnixSignals.cpp
index bb85912c23de5..14bdd39919c3c 100644
--- a/source/API/SBUnixSignals.cpp
+++ b/source/API/SBUnixSignals.cpp
@@ -8,10 +8,10 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Core/Log.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/UnixSignals.h"
+#include "lldb/Utility/Log.h"
#include "lldb/lldb-defines.h"
#include "lldb/API/SBUnixSignals.h"
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index 0531a3fe7d7a5..ea0f9f591ab9f 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -17,12 +17,9 @@
#include "lldb/API/SBTypeSynthetic.h"
#include "lldb/Breakpoint/Watchpoint.h"
-#include "lldb/Core/DataExtractor.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Scalar.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
@@ -39,6 +36,9 @@
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBExpressionOptions.h"
diff --git a/source/API/SBValueList.cpp b/source/API/SBValueList.cpp
index 16289d9a9a964..0adf3bb914aa5 100644
--- a/source/API/SBValueList.cpp
+++ b/source/API/SBValueList.cpp
@@ -10,8 +10,8 @@
#include "lldb/API/SBValueList.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBValue.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/ValueObjectList.h"
+#include "lldb/Utility/Log.h"
#include <vector>
diff --git a/source/API/SBWatchpoint.cpp b/source/API/SBWatchpoint.cpp
index 50153c8c23463..b7755373abc94 100644
--- a/source/API/SBWatchpoint.cpp
+++ b/source/API/SBWatchpoint.cpp
@@ -16,39 +16,35 @@
#include "lldb/Breakpoint/Watchpoint.h"
#include "lldb/Breakpoint/WatchpointList.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-types.h"
using namespace lldb;
using namespace lldb_private;
-SBWatchpoint::SBWatchpoint() : m_opaque_sp() {}
+SBWatchpoint::SBWatchpoint() {}
SBWatchpoint::SBWatchpoint(const lldb::WatchpointSP &wp_sp)
- : m_opaque_sp(wp_sp) {
+ : m_opaque_wp(wp_sp) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (log) {
SBStream sstr;
GetDescription(sstr, lldb::eDescriptionLevelBrief);
- log->Printf("SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp"
- "=%p) => this.sp = %p (%s)",
- static_cast<void *>(wp_sp.get()),
- static_cast<void *>(m_opaque_sp.get()), sstr.GetData());
+ LLDB_LOG(log, "watchpoint = {0} ({1})", wp_sp.get(), sstr.GetData());
}
}
SBWatchpoint::SBWatchpoint(const SBWatchpoint &rhs)
- : m_opaque_sp(rhs.m_opaque_sp) {}
+ : m_opaque_wp(rhs.m_opaque_wp) {}
const SBWatchpoint &SBWatchpoint::operator=(const SBWatchpoint &rhs) {
- if (this != &rhs)
- m_opaque_sp = rhs.m_opaque_sp;
+ m_opaque_wp = rhs.m_opaque_wp;
return *this;
}
@@ -74,7 +70,7 @@ watch_id_t SBWatchpoint::GetID() {
return watch_id;
}
-bool SBWatchpoint::IsValid() const { return (bool)m_opaque_sp; }
+bool SBWatchpoint::IsValid() const { return bool(m_opaque_wp.lock()); }
SBError SBWatchpoint::GetError() {
SBError sb_error;
@@ -223,11 +219,11 @@ bool SBWatchpoint::GetDescription(SBStream &description,
return true;
}
-void SBWatchpoint::Clear() { m_opaque_sp.reset(); }
+void SBWatchpoint::Clear() { m_opaque_wp.reset(); }
-lldb::WatchpointSP SBWatchpoint::GetSP() const { return m_opaque_sp; }
+lldb::WatchpointSP SBWatchpoint::GetSP() const { return m_opaque_wp.lock(); }
-void SBWatchpoint::SetSP(const lldb::WatchpointSP &sp) { m_opaque_sp = sp; }
+void SBWatchpoint::SetSP(const lldb::WatchpointSP &sp) { m_opaque_wp = sp; }
bool SBWatchpoint::EventIsWatchpointEvent(const lldb::SBEvent &event) {
return Watchpoint::WatchpointEventData::GetEventDataFromEvent(event.get()) !=
@@ -245,7 +241,7 @@ SBWatchpoint::GetWatchpointEventTypeFromEvent(const SBEvent &event) {
SBWatchpoint SBWatchpoint::GetWatchpointFromEvent(const lldb::SBEvent &event) {
SBWatchpoint sb_watchpoint;
if (event.IsValid())
- sb_watchpoint.m_opaque_sp =
+ sb_watchpoint =
Watchpoint::WatchpointEventData::GetWatchpointFromEvent(event.GetSP());
return sb_watchpoint;
}
diff --git a/source/API/SystemInitializerFull.cpp b/source/API/SystemInitializerFull.cpp
index 2df056e1b979f..23aec1d6fa0a6 100644
--- a/source/API/SystemInitializerFull.cpp
+++ b/source/API/SystemInitializerFull.cpp
@@ -74,6 +74,7 @@
#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
+#include "Plugins/Platform/OpenBSD/PlatformOpenBSD.h"
#include "Plugins/Platform/Windows/PlatformWindows.h"
#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
#include "Plugins/Process/elf-core/ProcessElfCore.h"
@@ -266,6 +267,7 @@ void SystemInitializerFull::Initialize() {
platform_freebsd::PlatformFreeBSD::Initialize();
platform_linux::PlatformLinux::Initialize();
platform_netbsd::PlatformNetBSD::Initialize();
+ platform_openbsd::PlatformOpenBSD::Initialize();
PlatformWindows::Initialize();
PlatformKalimba::Initialize();
platform_android::PlatformAndroid::Initialize();
@@ -487,6 +489,7 @@ void SystemInitializerFull::Terminate() {
platform_freebsd::PlatformFreeBSD::Terminate();
platform_linux::PlatformLinux::Terminate();
platform_netbsd::PlatformNetBSD::Terminate();
+ platform_openbsd::PlatformOpenBSD::Terminate();
PlatformWindows::Terminate();
PlatformKalimba::Terminate();
platform_android::PlatformAndroid::Terminate();