[Lldb-commits] [PATCH] D89358: Add an API to get an SBBreakpoint's owning SBTarget
Jim Ingham via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 14 12:11:09 PDT 2020
jingham updated this revision to Diff 298210.
jingham added a comment.
Use lldb-instr instead of hand-generating the reproducer wrappers.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89358/new/
https://reviews.llvm.org/D89358
Files:
lldb/bindings/interface/SBBreakpoint.i
lldb/include/lldb/API/SBBreakpoint.h
lldb/source/API/SBBreakpoint.cpp
lldb/test/API/python_api/breakpoint/TestBreakpointAPI.py
Index: lldb/test/API/python_api/breakpoint/TestBreakpointAPI.py
===================================================================
--- lldb/test/API/python_api/breakpoint/TestBreakpointAPI.py
+++ lldb/test/API/python_api/breakpoint/TestBreakpointAPI.py
@@ -66,6 +66,9 @@
location = breakpoint.GetLocationAtIndex(0)
self.assertTrue(location.IsValid())
+ # Make sure the breakpoint's target is right:
+ self.assertEqual(target, breakpoint.GetTarget(), "Breakpoint reports its target correctly")
+
self.assertTrue(self.dbg.DeleteTarget(target))
self.assertFalse(breakpoint.IsValid())
self.assertFalse(location.IsValid())
Index: lldb/source/API/SBBreakpoint.cpp
===================================================================
--- lldb/source/API/SBBreakpoint.cpp
+++ lldb/source/API/SBBreakpoint.cpp
@@ -81,6 +81,16 @@
return m_opaque_wp.lock() != rhs.m_opaque_wp.lock();
}
+SBTarget SBBreakpoint::GetTarget() const {
+ LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBTarget, SBBreakpoint, GetTarget);
+
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp)
+ return LLDB_RECORD_RESULT(SBTarget(bkpt_sp->GetTargetSP()));
+
+ return LLDB_RECORD_RESULT(SBTarget());
+}
+
break_id_t SBBreakpoint::GetID() const {
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::break_id_t, SBBreakpoint, GetID);
@@ -987,6 +997,7 @@
SBBreakpoint, operator==,(const lldb::SBBreakpoint &));
LLDB_REGISTER_METHOD(bool,
SBBreakpoint, operator!=,(const lldb::SBBreakpoint &));
+ LLDB_REGISTER_METHOD_CONST(lldb::SBTarget, SBBreakpoint, GetTarget, ());
LLDB_REGISTER_METHOD_CONST(lldb::break_id_t, SBBreakpoint, GetID, ());
LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, IsValid, ());
LLDB_REGISTER_METHOD_CONST(bool, SBBreakpoint, operator bool, ());
Index: lldb/include/lldb/API/SBBreakpoint.h
===================================================================
--- lldb/include/lldb/API/SBBreakpoint.h
+++ lldb/include/lldb/API/SBBreakpoint.h
@@ -42,6 +42,8 @@
void ClearAllBreakpointSites();
+ lldb::SBTarget GetTarget() const;
+
lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr);
lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr);
Index: lldb/bindings/interface/SBBreakpoint.i
===================================================================
--- lldb/bindings/interface/SBBreakpoint.i
+++ lldb/bindings/interface/SBBreakpoint.i
@@ -100,6 +100,9 @@
void
ClearAllBreakpointSites ();
+ lldb::SBTarget
+ GetTarget() const;
+
lldb::SBBreakpointLocation
FindLocationByAddress (lldb::addr_t vm_addr);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89358.298210.patch
Type: text/x-patch
Size: 2686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201014/551a149a/attachment.bin>
More information about the lldb-commits
mailing list