*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / target.c
index edf86970f002532d9827c519e154aa5784eb25f4..fec11abb39db2abc17e7c239b5c09ad18e12c030 100644 (file)
 #include "solib.h"
 #include "exec.h"
 #include "inline-frame.h"
+#include "tracepoint.h"
 
 static void target_info (char *, int);
 
-static void kill_or_be_killed (int);
-
 static void default_terminal_info (char *, int);
 
 static int default_watchpoint_addr_within_range (struct target_ops *,
@@ -57,7 +56,7 @@ static int default_region_ok_for_hw_watchpoint (CORE_ADDR, int);
 
 static int nosymbol (char *, CORE_ADDR *);
 
-static void tcomplain (void) ATTR_NORETURN;
+static void tcomplain (void) ATTRIBUTE_NORETURN;
 
 static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
 
@@ -73,8 +72,6 @@ static void target_command (char *, int);
 
 static struct target_ops *find_default_run_target (char *);
 
-static void nosupport_runtime (void);
-
 static LONGEST default_xfer_partial (struct target_ops *ops,
                                     enum target_object object,
                                     const char *annex, gdb_byte *readbuf,
@@ -519,49 +516,12 @@ nosymbol (char *name, CORE_ADDR *addrp)
   return 1;                    /* Symbol does not exist in target env */
 }
 
-static void
-nosupport_runtime (void)
-{
-  if (ptid_equal (inferior_ptid, null_ptid))
-    noprocess ();
-  else
-    error (_("No run-time support for this"));
-}
-
-
 static void
 default_terminal_info (char *args, int from_tty)
 {
   printf_unfiltered (_("No saved terminal information.\n"));
 }
 
-/* This is the default target_create_inferior and target_attach function.
-   If the current target is executing, it asks whether to kill it off.
-   If this function returns without calling error(), it has killed off
-   the target, and the operation should be attempted.  */
-
-static void
-kill_or_be_killed (int from_tty)
-{
-  if (target_has_execution)
-    {
-      printf_unfiltered (_("You are already running a program:\n"));
-      target_files_info ();
-      if (query (_("Kill it? ")))
-       {
-         target_kill ();
-         if (target_has_execution)
-           error (_("Killing the program did not help."));
-         return;
-       }
-      else
-       {
-         error (_("Program not killed."));
-       }
-    }
-  tcomplain ();
-}
-
 /* A default implementation for the to_get_ada_task_ptid target method.
 
    This function builds the PTID by using both LWP and TID as part of
@@ -694,7 +654,13 @@ update_current_target (void)
       INHERIT (to_trace_stop, t);
       INHERIT (to_trace_find, t);
       INHERIT (to_get_trace_state_variable_value, t);
+      INHERIT (to_save_trace_data, t);
+      INHERIT (to_upload_tracepoints, t);
+      INHERIT (to_upload_trace_state_variables, t);
+      INHERIT (to_get_raw_trace_data, t);
       INHERIT (to_set_disconnected_tracing, t);
+      INHERIT (to_set_circular_trace_buffer, t);
+      INHERIT (to_get_tib_address, t);
       INHERIT (to_magic, t);
       /* Do not inherit to_memory_map.  */
       /* Do not inherit to_flash_erase.  */
@@ -859,19 +825,37 @@ update_current_target (void)
            (void (*) (void))
            tcomplain);
   de_fault (to_get_trace_status,
-           (int (*) (int *))
+           (int (*) (struct trace_status *))
            return_minus_one);
   de_fault (to_trace_stop,
            (void (*) (void))
            tcomplain);
   de_fault (to_trace_find,
            (int (*) (enum trace_find_type, int, ULONGEST, ULONGEST, int *))
-           return_zero);
+           return_minus_one);
   de_fault (to_get_trace_state_variable_value,
            (int (*) (int, LONGEST *))
            return_zero);
+  de_fault (to_save_trace_data,
+           (int (*) (const char *))
+           tcomplain);
+  de_fault (to_upload_tracepoints,
+           (int (*) (struct uploaded_tp **))
+           return_zero);
+  de_fault (to_upload_trace_state_variables,
+           (int (*) (struct uploaded_tsv **))
+           return_zero);
+  de_fault (to_get_raw_trace_data,
+           (LONGEST (*) (gdb_byte *, ULONGEST, LONGEST))
+           tcomplain);
   de_fault (to_set_disconnected_tracing,
            (void (*) (int))
+           target_ignore);
+  de_fault (to_set_circular_trace_buffer,
+           (void (*) (int))
+           target_ignore);
+  de_fault (to_get_tib_address,
+           (int (*) (ptid_t, CORE_ADDR *))
            tcomplain);
 #undef de_fault
 
@@ -1317,6 +1301,10 @@ memory_xfer_partial (struct target_ops *ops, enum target_object object,
     inf = NULL;
 
   if (inf != NULL
+      /* The dcache reads whole cache lines; that doesn't play well
+        with reading from a trace buffer, because reading outside of
+        the collected memory range fails.  */
+      && get_traceframe_number () == -1
       && (region->attrib.cache
          || (stack_cache_enabled_p && object == TARGET_OBJECT_STACK_MEMORY)))
     {
@@ -2102,6 +2090,8 @@ target_detach (char *args, int from_tty)
        them before detaching.  */
     remove_breakpoints_pid (PIDGET (inferior_ptid));
 
+  prepare_for_detach ();
+
   for (t = current_target.beneath; t != NULL; t = t->beneath)
     {
       if (t->to_detach != NULL)
@@ -2202,6 +2192,7 @@ target_resume (ptid_t ptid, int step, enum target_signal signal)
                                step ? "step" : "continue",
                                target_signal_to_name (signal));
 
+         registers_changed_ptid (ptid);
          set_executing (ptid, 1);
          set_running (ptid, 1);
          clear_inline_frame_state (ptid);
@@ -2861,6 +2852,9 @@ init_dummy_target (void)
   dummy_target.to_has_stack = (int (*) (struct target_ops *)) return_zero;
   dummy_target.to_has_registers = (int (*) (struct target_ops *)) return_zero;
   dummy_target.to_has_execution = (int (*) (struct target_ops *)) return_zero;
+  dummy_target.to_stopped_by_watchpoint = return_zero;
+  dummy_target.to_stopped_data_address =
+    (int (*) (struct target_ops *, CORE_ADDR *)) return_zero;
   dummy_target.to_magic = OPS_MAGIC;
 }
 \f
@@ -3084,6 +3078,28 @@ target_core_of_thread (ptid_t ptid)
   return -1;
 }
 
+int
+target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
+{
+  struct target_ops *t;
+
+  for (t = current_target.beneath; t != NULL; t = t->beneath)
+    {
+      if (t->to_verify_memory != NULL)
+       {
+         int retval = t->to_verify_memory (t, data, memaddr, size);
+         if (targetdebug)
+           fprintf_unfiltered (gdb_stdlog, "target_verify_memory (%s, %s) = %d\n",
+                               paddress (target_gdbarch, memaddr),
+                               pulongest (size),
+                               retval);
+         return retval;
+       }
+    }
+
+  tcomplain ();
+}
+
 static void
 debug_to_prepare_to_store (struct regcache *regcache)
 {
This page took 0.039711 seconds and 4 git commands to generate.