@@ -225,7 +225,7 @@ ReplayTimeline::Mark ReplayTimeline::mark() {
225
225
ReplayTimeline::Mark ReplayTimeline::recreate_mark_from_data (const MarkData& mark_data, ReplaySession::shr_ptr session) {
226
226
Mark result;
227
227
auto m = make_shared<InternalMark>(this , mark_data, session);
228
-
228
+ m-> inc_refcount ();
229
229
auto & mark_vector = marks[m->proto .key ];
230
230
mark_vector.push_back (m);
231
231
result.ptr = mark_vector.back ();
@@ -235,11 +235,7 @@ ReplayTimeline::Mark ReplayTimeline::recreate_mark_from_data(const MarkData& mar
235
235
void ReplayTimeline::register_mark_as_checkpoint (Mark& m) {
236
236
DEBUG_ASSERT (m.ptr && m.ptr ->checkpoint && " Can't register mark as checkpoint if no checkpoint exists" );
237
237
auto key = m.ptr ->proto .key ;
238
- if (marks_with_checkpoints.find (key) == marks_with_checkpoints.end ()) {
239
- marks_with_checkpoints[key] = 1 ;
240
- } else {
241
- marks_with_checkpoints[key]++;
242
- }
238
+ increase_mark_with_checkpoints (key);
243
239
m.ptr ->inc_refcount ();
244
240
}
245
241
@@ -313,6 +309,15 @@ ReplayTimeline::Mark ReplayTimeline::lazy_reverse_singlestep(const Mark& from,
313
309
return Mark ();
314
310
}
315
311
312
+ void ReplayTimeline::increase_mark_with_checkpoints (
313
+ const MarkKey& key) noexcept {
314
+ if (marks_with_checkpoints.find (key) == marks_with_checkpoints.end ()) {
315
+ marks_with_checkpoints[key] = 1 ;
316
+ } else {
317
+ marks_with_checkpoints[key]++;
318
+ }
319
+ }
320
+
316
321
ReplayTimeline::Mark ReplayTimeline::add_explicit_checkpoint () {
317
322
DEBUG_ASSERT (current->can_clone ());
318
323
@@ -321,11 +326,7 @@ ReplayTimeline::Mark ReplayTimeline::add_explicit_checkpoint() {
321
326
unapply_breakpoints_and_watchpoints ();
322
327
m.ptr ->checkpoint = current->clone ();
323
328
auto key = m.ptr ->proto .key ;
324
- if (marks_with_checkpoints.find (key) == marks_with_checkpoints.end ()) {
325
- marks_with_checkpoints[key] = 1 ;
326
- } else {
327
- marks_with_checkpoints[key]++;
328
- }
329
+ increase_mark_with_checkpoints (key);
329
330
}
330
331
m.ptr ->inc_refcount ();
331
332
return m;
@@ -798,11 +799,9 @@ ReplayTimeline::Mark ReplayTimeline::recreate_marks_for_non_explicit(const Check
798
799
// first add the mark with an actual clone, this is not a GDB checkpoint, but an RR checkpoint
799
800
auto mark = recreate_mark_from_data (cp.clone_data , clone);
800
801
reverse_exec_checkpoints[mark] = estimate_progress_of (*clone);
801
- mark.get_internal ()->inc_refcount ();
802
802
register_mark_as_checkpoint (mark);
803
803
// then add the mark with no clone, the one that will be visible to GDB, i.e. non explicit checkpoint
804
804
Mark result = recreate_mark_from_data (*cp.non_explicit_mark_data , nullptr );
805
- // auto internal = make_shared<InternalMark>(this, *cp.non_explicit_data, nullptr);
806
805
return result;
807
806
}
808
807
@@ -1736,8 +1735,8 @@ std::shared_ptr<ReplayTimeline::Mark> ReplayTimeline::find_closest_mark_with_clo
1736
1735
for (auto it = std::rbegin (marks_found->second ); it != std::rend (marks_found->second ); it++) {
1737
1736
DEBUG_ASSERT (it->get () != nullptr );
1738
1737
if ((*it)->checkpoint ) {
1739
- std::shared_ptr<Mark> result = std::make_shared<Mark>();
1740
- result->ptr = *it ;
1738
+ auto result = std::make_shared<Mark>();
1739
+ result->ptr = *(it) ;
1741
1740
return result;
1742
1741
}
1743
1742
}
0 commit comments