+2020-12-11 Tom Tromey <tom@tromey.com>
+
+ * inferior.c (current_inferior_): Change type.
+ (current_inferior, set_current_inferior, initialize_inferiors):
+ Update.
+
2020-12-11 Tom Tromey <tom@tromey.com>
* gdbthread.h (class enable_thread_stack_temporaries) <m_thr>:
/* The Current Inferior. This is a strong reference. I.e., whenever
an inferior is the current inferior, its refcount is
incremented. */
-static struct inferior *current_inferior_ = NULL;
+static inferior_ref current_inferior_;
struct inferior*
current_inferior (void)
{
- return current_inferior_;
+ return current_inferior_.get ();
}
void
/* There's always an inferior. */
gdb_assert (inf != NULL);
- inf->incref ();
- current_inferior_->decref ();
- current_inferior_ = inf;
+ current_inferior_ = inferior_ref::new_reference (inf);
}
private_inferior::~private_inferior () = default;
can only allocate an inferior when all those modules have done
that. Do this after initialize_progspace, due to the
current_program_space reference. */
- current_inferior_ = add_inferior_silent (0);
- current_inferior_->incref ();
+ set_current_inferior (add_inferior_silent (0));
current_inferior_->pspace = current_program_space;
current_inferior_->aspace = current_program_space->aspace;
/* The architecture will be initialized shortly, by