diff options
author | Caroline Tice <ctice@apple.com> | 2011-02-02 17:48:16 +0000 |
---|---|---|
committer | Caroline Tice <ctice@apple.com> | 2011-02-02 17:48:16 +0000 |
commit | 2bf67986efa6114df72535085df4337e9208ce6b (patch) | |
tree | cedb67d2798df52c968d1ffa6af6c7c77ecb9e14 | |
parent | da3b02fdb3cfa7ba6e7edbdf00ac9db6d6b55bbe (diff) | |
download | bcm5719-llvm-2bf67986efa6114df72535085df4337e9208ce6b.tar.gz bcm5719-llvm-2bf67986efa6114df72535085df4337e9208ce6b.zip |
Fix breakpoint id test to work with clang as well as gcc; added a few
more test cases
Fixed minor bug in the breakpoint id range translation code.
llvm-svn: 124729
-rw-r--r-- | lldb/source/Breakpoint/BreakpointIDList.cpp | 15 | ||||
-rw-r--r-- | lldb/test/breakpoint_ids/TestBreakpointIDs.py | 20 |
2 files changed, 28 insertions, 7 deletions
diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp index 50a89c72066..b4a80705548 100644 --- a/lldb/source/Breakpoint/BreakpointIDList.cpp +++ b/lldb/source/Breakpoint/BreakpointIDList.cpp @@ -258,6 +258,19 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman result.SetStatus (eReturnStatusFailed); return; } + + + if (((start_loc_id == LLDB_INVALID_BREAK_ID) + && (end_loc_id != LLDB_INVALID_BREAK_ID)) + || ((start_loc_id != LLDB_INVALID_BREAK_ID) + && (end_loc_id == LLDB_INVALID_BREAK_ID))) + { + new_args.Clear (); + result.AppendErrorWithFormat ("Invalid breakpoint id range: Either both ends of range must specify" + " a breakpoint location, or neither can specify a breakpoint location.\n"); + result.SetStatus (eReturnStatusFailed); + return; + } // We have valid range starting & ending breakpoint IDs. Go through all the breakpoints in the // target and find all the breakpoints that fit into this range, and add them to new_args. @@ -298,7 +311,7 @@ BreakpointIDList::FindAndReplaceIDRanges (Args &old_args, Target *target, Comman for (size_t k = 0; k < num_locations; ++k) { BreakpointLocation * bp_loc = breakpoint->GetLocationAtIndex(k).get(); - if (bp_loc->GetID() >= start_loc_id) + if ((bp_loc->GetID() >= start_loc_id) && (bp_loc->GetID() <= end_loc_id)) { StreamString canonical_id_str; BreakpointID::GetCanonicalReference (&canonical_id_str, cur_bp_id, bp_loc->GetID()); diff --git a/lldb/test/breakpoint_ids/TestBreakpointIDs.py b/lldb/test/breakpoint_ids/TestBreakpointIDs.py index 89eee0d618b..4713479ae38 100644 --- a/lldb/test/breakpoint_ids/TestBreakpointIDs.py +++ b/lldb/test/breakpoint_ids/TestBreakpointIDs.py @@ -26,24 +26,32 @@ class BreakpointIDTestCase(TestBase): patterns = [ "Current executable set to .*a.out" ]) self.expect ("breakpoint set -n product", - startstr = "Breakpoint created: 1: name = 'product', locations = 2") + startstr = "Breakpoint created: 1: name = 'product', locations =") self.expect ("breakpoint set -n sum", - startstr = "Breakpoint created: 2: name = 'sum', locations = 3") + startstr = "Breakpoint created: 2: name = 'sum', locations =") self.expect ("breakpoint set -n junk", startstr = "Breakpoint created: 3: name = 'junk', locations = 0 (pending)", substrs = [ "WARNING: Unable to resolve breakpoint to any actual locations." ] ) - self.expect ("breakpoint disable 1.2 - 2.2 ", + self.expect ("breakpoint disable 1.1 - 2.2 ", COMMAND_FAILED_AS_EXPECTED, error = True, startstr = "error: Invalid range: Ranges that specify particular breakpoint locations must be within the same major breakpoint; you specified two different major breakpoints, 1 and 2.") - self.expect ("breakpoint disable 1.1 - 1.2", + self.expect ("breakpoint disable 2 - 2.2", + COMMAND_FAILED_AS_EXPECTED, error = True, + startstr = "error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.") + + self.expect ("breakpoint disable 2.1 - 2", + COMMAND_FAILED_AS_EXPECTED, error = True, + startstr = "error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.") + + self.expect ("breakpoint disable 2.1 - 2.2", startstr = "2 breakpoints disabled.") - self.expect ("breakpoint enable 1.*", - startstr = "2 breakpoints enabled.") + self.expect ("breakpoint enable 2.*", + patterns = [ ".* breakpoints enabled."] ) if __name__ == '__main__': import atexit |