@@ -30,13 +30,14 @@ void BreakpointLocationCollection::Add(const BreakpointLocationSP &bp_loc) {
3030 if (!old_bp_loc.get ()) {
3131 m_break_loc_collection.push_back (bp_loc);
3232 if (m_preserving_bkpts) {
33+ lldb::break_id_t bp_loc_id = bp_loc->GetID ();
3334 Breakpoint &bkpt = bp_loc->GetBreakpoint ();
3435 lldb::break_id_t bp_id = bkpt.GetID ();
35- auto entry = m_preserved_bps.find (bp_id);
36+ std::pair<lldb::break_id_t , lldb::break_id_t > key
37+ = std::make_pair (bp_id, bp_loc_id);
38+ auto entry = m_preserved_bps.find (key);
3639 if (entry == m_preserved_bps.end ())
37- m_preserved_bps.emplace (bp_id, RefCountedBPSP (bkpt.shared_from_this ()));
38- else
39- entry->second .ref_cnt ++;
40+ m_preserved_bps.emplace (key, bkpt.shared_from_this ());
4041 }
4142 }
4243}
@@ -47,10 +48,12 @@ bool BreakpointLocationCollection::Remove(lldb::break_id_t bp_id,
4748 collection::iterator pos = GetIDPairIterator (bp_id, bp_loc_id); // Predicate
4849 if (pos != m_break_loc_collection.end ()) {
4950 if (m_preserving_bkpts) {
50- auto entry = m_preserved_bps.find (bp_id);
51- assert (entry != m_preserved_bps.end () &&
52- " Breakpoint added to base but not preserving map." );
53- if (--entry->second .ref_cnt == 0 )
51+ std::pair<lldb::break_id_t , lldb::break_id_t > key
52+ = std::make_pair (bp_id, bp_loc_id);
53+ auto entry = m_preserved_bps.find (key);
54+ if (entry == m_preserved_bps.end ())
55+ assert (0 && " Breakpoint added to collection but not preserving map." );
56+ else
5457 m_preserved_bps.erase (entry);
5558 }
5659 m_break_loc_collection.erase (pos);
0 commit comments