summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
authorJoseph Tremoulet <jotrem@microsoft.com>2019-11-22 12:59:46 -0500
committerJoseph Tremoulet <jotrem@microsoft.com>2019-12-04 09:57:15 -0500
commit95b2e516bd3e4587953e44bf062054ff84f2b057 (patch)
tree8a6b3beccc334c879cac7cbda5fc98e2003baecf /lldb/packages/Python/lldbsuite/test
parent82f6ae5433cac1ba0d02e8df253da3d3b3ce68e1 (diff)
downloadbcm5719-llvm-95b2e516bd3e4587953e44bf062054ff84f2b057.tar.gz
bcm5719-llvm-95b2e516bd3e4587953e44bf062054ff84f2b057.zip
Change Target::FindBreakpointsByName to return Expected<vector>
Summary: Using a BreakpointList corrupts the breakpoints' IDs because BreakpointList::Add sets the ID, so use a vector instead, and update the signature to return the vector wrapped in an llvm::Expected which can propagate any error from the inner call to StringIsBreakpointName. Note that, despite the similar name, SBTarget::FindBreakpointsByName doesn't suffer the same problem, because it uses a SBBreakpointList, which is more like a BreakpointIDList than a BreakpointList under the covers. Add a check to TestBreakpointNames that, without this fix, notices the ID getting mutated and fails. Reviewers: jingham, JDevlieghere Reviewed By: JDevlieghere Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70907
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
index 4a5ed87e330..9513278ba08 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
@@ -155,8 +155,13 @@ class BreakpointNames(TestBase):
def do_check_using_names(self):
"""Use Python APIs to check names work in place of breakpoint ID's."""
+ # Create a dummy breakpoint to use up ID 1
+ _ = self.target.BreakpointCreateByLocation(self.main_file_spec, 30)
+
+ # Create a breakpiont to test with
bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
bkpt_name = "ABreakpoint"
+ bkpt_id = bkpt.GetID()
other_bkpt_name= "_AnotherBreakpoint"
# Add a name and make sure we match it:
@@ -169,6 +174,7 @@ class BreakpointNames(TestBase):
self.assertTrue(bkpts.GetSize() == 1, "One breakpoint matched.")
found_bkpt = bkpts.GetBreakpointAtIndex(0)
self.assertTrue(bkpt.GetID() == found_bkpt.GetID(),"The right breakpoint.")
+ self.assertTrue(bkpt.GetID() == bkpt_id,"With the same ID as before.")
retval = lldb.SBCommandReturnObject()
self.dbg.GetCommandInterpreter().HandleCommand("break disable %s"%(bkpt_name), retval)
OpenPOWER on IntegriCloud