summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/API/SBBreakpoint.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2017-09-26 19:56:36 +0000
committerLuiz Souza <luiz@netgate.com>2018-02-21 15:12:19 -0300
commit1dcd2e8d24b295bc73e513acec2ed1514bb66be4 (patch)
tree4bd13a34c251e980e1a6b13584ca1f63b0dfe670 /contrib/llvm/tools/lldb/source/API/SBBreakpoint.cpp
parentf45541ca2a56a1ba1202f94c080b04e96c1fa239 (diff)
downloadFreeBSD-src-1dcd2e8d24b295bc73e513acec2ed1514bb66be4.zip
FreeBSD-src-1dcd2e8d24b295bc73e513acec2ed1514bb66be4.tar.gz
Merge clang, llvm, lld, lldb, compiler-rt and libc++ 5.0.0 release.
MFC r309126 (by emaste): Correct lld llvm-tblgen dependency file name MFC r309169: Get rid of separate Subversion mergeinfo properties for llvm-dwarfdump and llvm-lto. The mergeinfo confuses Subversion enormously, and these directories will just use the mergeinfo for llvm itself. MFC r312765: Pull in r276136 from upstream llvm trunk (by Wei Mi): Use ValueOffsetPair to enhance value reuse during SCEV expansion. In D12090, the ExprValueMap was added to reuse existing value during SCEV expansion. However, const folding and sext/zext distribution can make the reuse still difficult. A simplified case is: suppose we know S1 expands to V1 in ExprValueMap, and S1 = S2 + C_a S3 = S2 + C_b where C_a and C_b are different SCEVConstants. Then we'd like to expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is helpful when S2 is a complex SCEV expr and S2 has no entry in ExprValueMap, which is usually caused by the fact that S3 is generated from S1 after const folding. In order to do that, we represent ExprValueMap as a mapping from SCEV to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a} into the ExprValueMap when we create SCEV for V1. When S3 is expanded, it will first expand S2 to V1 - C_a because of S2->{V1, C_a} in the map, then expand S3 to V1 - C_a + C_b. Differential Revision: https://reviews.llvm.org/D21313 This should fix assertion failures when building OpenCV >= 3.1. PR: 215649 MFC r312831: Revert r312765 for now, since it causes assertions when building lang/spidermonkey24. Reported by: antoine PR: 215649 MFC r316511 (by jhb): Add an implementation of __ffssi2() derived from __ffsdi2(). Newer versions of GCC include an __ffssi2() symbol in libgcc and the compiler can emit calls to it in generated code. This is true for at least GCC 6.2 when compiling world for mips and mips64. Reviewed by: jmallett, dim Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D10086 MFC r318601 (by adrian): [libcompiler-rt] add bswapdi2/bswapsi2 This is required for mips gcc 6.3 userland to build/run. Reviewed by: emaste, dim Approved by: emaste Differential Revision: https://reviews.freebsd.org/D10838 MFC r318884 (by emaste): lldb: map TRAP_CAP to a trace trap In the absense of a more specific handler for TRAP_CAP (generated by ENOTCAPABLE or ECAPMODE while in capability mode) treat it as a trace trap. Example usage (testing the bug in PR219173): % proccontrol -m trapcap lldb usr.bin/hexdump/obj/hexdump -- -Cv -s 1 /bin/ls ... (lldb) run Process 12980 launching Process 12980 launched: '.../usr.bin/hexdump/obj/hexdump' (x86_64) Process 12980 stopped * thread #1, stop reason = trace frame #0: 0x0000004b80c65f1a libc.so.7`__sys_lseek + 10 ... In the future we should have LLDB control the trapcap procctl itself (as it does with ASLR), as well as report a specific stop reason. This change eliminates an assertion failure from LLDB for now. MFC r319796: Remove a few unneeded files from libllvm, libclang and liblldb. MFC r319885 (by emaste): lld: ELF: Fix ICF crash on absolute symbol relocations. If two sections contained relocations to absolute symbols with the same value we would crash when trying to access their sections. Add a check that both symbols point to sections before accessing their sections, and treat absolute symbols as equal if their values are equal. Obtained from: LLD commit r292578 MFC r319918: Revert r319796 for now, it can cause undefined references when linking in some circumstances. Reported by: Shawn Webb <shawn.webb@hardenedbsd.org> MFC r319957 (by emaste): lld: Add armelf emulation mode Obtained from: LLD r305375 MFC r321369: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 5.0.0 (trunk r308421). Upstream has branched for the 5.0.0 release, which should be in about a month. Please report bugs and regressions, so we can get them into the release. Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11 support to build; see UPDATING for more information. MFC r321420: Add a few more object files to liblldb, which should solve errors when linking the lldb executable in some cases. In particular, when the -ffunction-sections -fdata-sections options are turned off, or ineffective. Reported by: Shawn Webb, Mark Millard MFC r321433: Cleanup stale Options.inc files from the previous libllvm build for clang 4.0.0. Otherwise, these can get included before the two newly generated ones (which are different) for clang 5.0.0. Reported by: Mark Millard MFC r321439 (by bdrewery): Move llvm Options.inc hack from r321433 for NO_CLEAN to lib/clang/libllvm. The files are only ever generated to .OBJDIR, not to WORLDTMP (as a sysroot) and are only ever included from a compilation. So using a beforebuild target here removes the file before the compilation tries to include it. MFC r321664: Pull in r308891 from upstream llvm trunk (by Benjamin Kramer): [CodeGenPrepare] Cut off FindAllMemoryUses if there are too many uses. This avoids excessive compile time. The case I'm looking at is Function.cpp from an old version of LLVM that still had the giant memcmp string matcher in it. Before r308322 this compiled in about 2 minutes, after it, clang takes infinite* time to compile it. With this patch we're at 5 min, which is still bad but this is a pathological case. The cut off at 20 uses was chosen by looking at other cut-offs in LLVM for user scanning. It's probably too high, but does the job and is very unlikely to regress anything. Fixes PR33900. * I'm impatient and aborted after 15 minutes, on the bug report it was killed after 2h. Pull in r308986 from upstream llvm trunk (by Simon Pilgrim): [X86][CGP] Reduce memcmp() expansion to 2 load pairs (PR33914) D35067/rL308322 attempted to support up to 4 load pairs for memcmp inlining which resulted in regressions for some optimized libc memcmp implementations (PR33914). Until we can match these more optimal cases, this patch reduces the memcmp expansion to a maximum of 2 load pairs (which matches what we do for -Os). This patch should be considered for the 5.0.0 release branch as well Differential Revision: https://reviews.llvm.org/D35830 These fix a hang (or extremely long compile time) when building older LLVM ports. Reported by: antoine PR: 219139 MFC r321719: Pull in r309503 from upstream clang trunk (by Richard Smith): PR33902: Invalidate line number cache when adding more text to existing buffer. This led to crashes as the line number cache would report a bogus line number for a line of code, and we'd try to find a nonexistent column within the line when printing diagnostics. This fixes an assertion when building the graphics/champlain port. Reported by: antoine, kwm PR: 219139 MFC r321723: Upgrade our copies of clang, llvm, lld and lldb to r309439 from the upstream release_50 branch. This is just after upstream's 5.0.0-rc1. MFC r322320: Upgrade our copies of clang, llvm and libc++ to r310316 from the upstream release_50 branch. MFC r322326 (by emaste): lldb: Make i386-*-freebsd expression work on JIT path * Enable i386 ABI creation for freebsd * Added an extra argument in ABISysV_i386::PrepareTrivialCall for mmap syscall * Unlike linux, the last argument of mmap is actually 64-bit(off_t). This requires us to push an additional word for the higher order bits. * Prior to this change, ktrace dump will show mmap failures due to invalid argument coming from the 6th mmap argument. Submitted by: Karnajit Wangkhem Differential Revision: https://reviews.llvm.org/D34776 MFC r322360 (by emaste): lldb: Report inferior signals as signals, not exceptions, on FreeBSD This is the FreeBSD equivalent of LLVM r238549. This serves 2 purposes: * LLDB should handle inferior process signals SIGSEGV/SIGILL/SIGBUS/ SIGFPE the way it is suppose to be handled. Prior to this fix these signals will neither create a coredump, nor exit from the debugger or work for signal handling scenario. * eInvalidCrashReason need not report "unknown crash reason" if we have a valid si_signo llvm.org/pr23699 Patch by Karnajit Wangkhem Differential Revision: https://reviews.llvm.org/D35223 Submitted by: Karnajit Wangkhem Obtained from: LLVM r310591 MFC r322474 (by emaste): lld: Add `-z muldefs` option. Obtained from: LLVM r310757 MFC r322740: Upgrade our copies of clang, llvm, lld and libc++ to r311219 from the upstream release_50 branch. MFC r322855: Upgrade our copies of clang, llvm, lldb and compiler-rt to r311606 from the upstream release_50 branch. As of this version, lib/msun's trig test should also work correctly again (see bug 220989 for more information). PR: 220989 MFC r323112: Upgrade our copies of clang, llvm, lldb and compiler-rt to r312293 from the upstream release_50 branch. This corresponds to 5.0.0 rc4. As of this version, the cad/stepcode port should now compile in a more reasonable time on i386 (see bug 221836 for more information). PR: 221836 MFC r323245: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 5.0.0 release (upstream r312559). Release notes for llvm, clang and lld will be available here soon: <http://releases.llvm.org/5.0.0/docs/ReleaseNotes.html> <http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html> <http://releases.llvm.org/5.0.0/tools/lld/docs/ReleaseNotes.html> Relnotes: yes (cherry picked from commit 12cd91cf4c6b96a24427c0de5374916f2808d263)
Diffstat (limited to 'contrib/llvm/tools/lldb/source/API/SBBreakpoint.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/API/SBBreakpoint.cpp456
1 files changed, 208 insertions, 248 deletions
diff --git a/contrib/llvm/tools/lldb/source/API/SBBreakpoint.cpp b/contrib/llvm/tools/lldb/source/API/SBBreakpoint.cpp
index 0eab2c2..bf96032 100644
--- a/contrib/llvm/tools/lldb/source/API/SBBreakpoint.cpp
+++ b/contrib/llvm/tools/lldb/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();
- Error error =
- m_opaque_sp->GetTarget()
+ bkpt_sp->GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = bkpt_sp->GetOptions();
+ Status error =
+ 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());
- 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);
+ bkpt_sp->GetTarget().GetAPIMutex());
+ Status error; // Think I'm just going to swallow the error here, it's
+ // probably more annoying to have to provide it.
+ 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() {
OpenPOWER on IntegriCloud