ODR warnings for "struct coff_symbol"
[binutils-gdb.git] / gdb / target-connection.c
index bd54d005bef6b07b80640b9200b0dc0f113efe5d..d1da6a2d7b9f318ac1bdac145efa569560a8af97 100644 (file)
@@ -1,6 +1,6 @@
 /* List of target connections for GDB.
 
-   Copyright (C) 2017-2020 Free Software Foundation, Inc.
+   Copyright (C) 2017-2022 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -24,6 +24,7 @@
 
 #include "inferior.h"
 #include "target.h"
+#include "observable.h"
 
 /* A map between connection number and representative process_stratum
    target.  */
@@ -49,6 +50,9 @@ connection_list_add (process_stratum_target *t)
 void
 connection_list_remove (process_stratum_target *t)
 {
+  /* Notify about the connection being removed before we reset the
+     connection number to zero.  */
+  gdb::observers::connection_removed.notify (t);
   process_targets.erase (t->connection_number);
   t->connection_number = 0;
 }
@@ -133,7 +137,7 @@ print_connection (struct ui_out *uiout, const char *requested_connections)
 
       uiout->field_signed ("number", t->connection_number);
 
-      uiout->field_string ("what", make_target_connection_string (t).c_str ());
+      uiout->field_string ("what", make_target_connection_string (t));
 
       uiout->field_string ("description", t->longname ());