gdb: remove BLOCK_FUNCTION macro
[binutils-gdb.git] / gdb / tracectf.c
index 758dd5681d880dc321e68914efa93dd2b922d57b..155c8b7db060a81c96479f05c1f86801fb6c7bc7 100644 (file)
@@ -1,6 +1,6 @@
 /* CTF format support.
 
-   Copyright (C) 2012-2019 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
    Contributed by Hui Zhu <hui_zhu@mentor.com>
    Contributed by Yao Qi <yao@codesourcery.com>
 
@@ -1165,16 +1165,17 @@ ctf_target_open (const char *dirname, int from_tty)
   gdb_assert (start_pos->type == BT_SEEK_RESTORE);
 
   trace_dirname = xstrdup (dirname);
-  push_target (&ctf_ops);
+  current_inferior ()->push_target (&ctf_ops);
 
   inferior_appeared (current_inferior (), CTF_PID);
-  inferior_ptid = ptid_t (CTF_PID);
-  add_thread_silent (inferior_ptid);
+
+  thread_info *thr = add_thread_silent (&ctf_ops, ptid_t (CTF_PID));
+  switch_to_thread (thr);
 
   merge_uploaded_trace_state_variables (&uploaded_tsvs);
   merge_uploaded_tracepoints (&uploaded_tps);
 
-  post_create_inferior (&ctf_ops, from_tty);
+  post_create_inferior (from_tty);
 }
 
 /* This is the implementation of target_ops method to_close.  Destroy
@@ -1187,7 +1188,7 @@ ctf_target::close ()
   xfree (trace_dirname);
   trace_dirname = NULL;
 
-  inferior_ptid = null_ptid;   /* Avoid confusion from thread stuff.  */
+  switch_to_no_thread ();      /* Avoid confusion from thread stuff.  */
   exit_inferior_silent (current_inferior ());
 
   trace_reset_local_state ();
@@ -1199,7 +1200,7 @@ ctf_target::close ()
 void
 ctf_target::files_info ()
 {
-  printf_filtered ("\t`%s'\n", trace_dirname);
+  gdb_printf ("\t`%s'\n", trace_dirname);
 }
 
 /* This is the implementation of target_ops method to_fetch_registers.
@@ -1721,8 +1722,9 @@ ctf_target::traceframe_info ()
 
 /* module initialization */
 
+void _initialize_ctf ();
 void
-_initialize_ctf (void)
+_initialize_ctf ()
 {
 #if HAVE_LIBBABELTRACE
   add_target (ctf_target_info, ctf_target_open, filename_completer);