diff options
author | jimingham <jingham@apple.com> | 2025-06-26 17:03:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-26 17:03:07 -0700 |
commit | ec48d15b2003253e26d9f902b252f92e89a114e2 (patch) | |
tree | 88b07428e186d307e1318dd152d81668ae9a051e /lldb/source/Commands/CommandObjectBreakpoint.cpp | |
parent | c3811c8474f4a5abe4f6558969a582cd7f19349e (diff) | |
download | llvm-ec48d15b2003253e26d9f902b252f92e89a114e2.zip llvm-ec48d15b2003253e26d9f902b252f92e89a114e2.tar.gz llvm-ec48d15b2003253e26d9f902b252f92e89a114e2.tar.bz2 |
Fix a bug in the breakpoint ID verifier in CommandObjectBreakpoint. (#145994)
It was assuming that for any location M.N, N was always less than the
number of breakpoint locations. But if you rebuild the target and rerun
multiple times, when the section backing one of the locations is no
longer valid, we remove the location, but we don't reuse the ID. So you
can have a breakpoint that only has location 1.3. The num_locations
check would say that was an invalid location.
Diffstat (limited to 'lldb/source/Commands/CommandObjectBreakpoint.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectBreakpoint.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index a0c39cf..4631c97 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -2485,8 +2485,9 @@ void CommandObjectMultiwordBreakpoint::VerifyIDs( Breakpoint *breakpoint = target.GetBreakpointByID(cur_bp_id.GetBreakpointID()).get(); if (breakpoint != nullptr) { - const size_t num_locations = breakpoint->GetNumLocations(); - if (static_cast<size_t>(cur_bp_id.GetLocationID()) > num_locations) { + lldb::break_id_t cur_loc_id = cur_bp_id.GetLocationID(); + // GetLocationID returns 0 when the location isn't specified. + if (cur_loc_id != 0 && !breakpoint->FindLocationByID(cur_loc_id)) { StreamString id_str; BreakpointID::GetCanonicalReference( &id_str, cur_bp_id.GetBreakpointID(), cur_bp_id.GetLocationID()); |