gdb: Delay releasing target_desc_up in more cases
[binutils-gdb.git] / gdbserver / tracepoint.cc
index bbca48b2efd36c2bd3f9b427b6f293eec94398f2..6881f31c0cecf610a0c02d2242e090a536e7be1b 100644 (file)
@@ -863,7 +863,7 @@ EXTERN_C_POP
 
 static struct tracepoint *last_tracepoint;
 
-static const char *eval_result_names[] =
+static const char * const eval_result_names[] =
   {
     "terror:in the attic",  /* this should never be reported */
     "terror:empty expression",
@@ -2433,7 +2433,7 @@ clear_installed_tracepoints (void)
   struct tracepoint *tpoint;
   struct tracepoint *prev_stpoint;
 
-  pause_all (1);
+  target_pause_all (true);
 
   prev_stpoint = NULL;
 
@@ -2486,7 +2486,7 @@ clear_installed_tracepoints (void)
       tpoint->handle = NULL;
     }
 
-  unpause_all (1);
+  target_unpause_all (true);
 }
 
 /* Parse a packet that defines a tracepoint.  */
@@ -2602,14 +2602,14 @@ cmd_qtdp (char *own_buf)
       struct tracepoint *tp = NULL;
 
       /* Pause all threads temporarily while we patch tracepoints.  */
-      pause_all (0);
+      target_pause_all (false);
 
       /* download_tracepoint will update global `tracepoints'
         list, so it is unsafe to leave threads in jump pad.  */
-      stabilize_threads ();
+      target_stabilize_threads ();
 
       /* Freeze threads.  */
-      pause_all (1);
+      target_pause_all (true);
 
 
       if (tpoint->type != trap_tracepoint)
@@ -2658,7 +2658,7 @@ cmd_qtdp (char *own_buf)
            write_ok (own_buf);
        }
 
-      unpause_all (1);
+      target_unpause_all (true);
       return;
     }
 
@@ -3117,17 +3117,11 @@ install_fast_tracepoint (struct tracepoint *tpoint, char *errbuf)
   trampoline_size = 0;
 
   /* Install the jump pad.  */
-  err = install_fast_tracepoint_jump_pad (tpoint->obj_addr_on_target,
-                                         tpoint->address,
-                                         collect,
-                                         ipa_sym_addrs.addr_collecting,
-                                         tpoint->orig_size,
-                                         &jentry,
-                                         &trampoline, &trampoline_size,
-                                         fjump, &fjump_size,
-                                         &tpoint->adjusted_insn_addr,
-                                         &tpoint->adjusted_insn_addr_end,
-                                         errbuf);
+  err = target_install_fast_tracepoint_jump_pad
+    (tpoint->obj_addr_on_target, tpoint->address, collect,
+     ipa_sym_addrs.addr_collecting, tpoint->orig_size, &jentry,
+     &trampoline, &trampoline_size, fjump, &fjump_size,
+     &tpoint->adjusted_insn_addr, &tpoint->adjusted_insn_addr_end, errbuf);
 
   if (err)
     return 1;
@@ -3220,16 +3214,16 @@ cmd_qtstart (char *packet)
   trace_debug ("Starting the trace");
 
   /* Pause all threads temporarily while we patch tracepoints.  */
-  pause_all (0);
+  target_pause_all (false);
 
   /* Get threads out of jump pads.  Safe to do here, since this is a
      top level command.  And, required to do here, since we're
      deleting/rewriting jump pads.  */
 
-  stabilize_threads ();
+  target_stabilize_threads ();
 
   /* Freeze threads.  */
-  pause_all (1);
+  target_pause_all (true);
 
   /* Sync the fast tracepoints list in the inferior ftlib.  */
   if (agent_loaded_p ())
@@ -3370,7 +3364,7 @@ cmd_qtstart (char *packet)
       clear_installed_tracepoints ();
       if (*packet == '\0')
        write_enn (packet);
-      unpause_all (1);
+      target_unpause_all (true);
       return;
     }
 
@@ -3418,7 +3412,7 @@ cmd_qtstart (char *packet)
        error ("Error setting flush_trace_buffer breakpoint");
     }
 
-  unpause_all (1);
+  target_unpause_all (true);
 
   write_ok (packet);
 }
@@ -3445,7 +3439,7 @@ stop_tracing (void)
      when we're sure we can move all threads out of the jump pads).
      We can't now, since we may be getting here due to the inferior
      agent calling us.  */
-  pause_all (1);
+  target_pause_all (true);
 
   /* Stop logging. Tracepoints can still be hit, but they will not be
      recorded.  */
@@ -3522,7 +3516,7 @@ stop_tracing (void)
       flush_trace_buffer_bkpt = NULL;
     }
 
-  unpause_all (1);
+  target_unpause_all (true);
 }
 
 static int
@@ -3668,11 +3662,11 @@ cmd_qtstatus (char *packet)
 
   if (agent_loaded_p ())
     {
-      pause_all (1);
+      target_pause_all (true);
 
       upload_fast_traceframes ();
 
-      unpause_all (1);
+      target_unpause_all (true);
    }
 
   stop_reason_rsp = (char *) tracing_stop_reason;
@@ -6578,12 +6572,12 @@ upload_fast_traceframes (void)
 
   trace_debug ("Done uploading traceframes [%d]\n", curr_tbctrl_idx);
 
-  pause_all (1);
+  target_pause_all (true);
 
   delete_breakpoint (about_to_request_buffer_space_bkpt);
   about_to_request_buffer_space_bkpt = NULL;
 
-  unpause_all (1);
+  target_unpause_all (true);
 
   if (trace_buffer_is_full)
     stop_tracing ();
@@ -6861,13 +6855,13 @@ run_inferior_command (char *cmd, int len)
 
   trace_debug ("run_inferior_command: running: %s", cmd);
 
-  pause_all (0);
+  target_pause_all (false);
   uninsert_all_breakpoints ();
 
   err = agent_run_command (pid, (const char *) cmd, len);
 
   reinsert_all_breakpoints ();
-  unpause_all (0);
+  target_unpause_all (false);
 
   return err;
 }