Add -mevexrcig={rne|rd|ru|rz} option to x86 assembler.
[deliverable/binutils-gdb.git] / gdb / target.c
index 16151c498266642036fd10b07a75d1d263928a71..339b1d14e640d3d95077fe7d7f9fe278d40125a2 100644 (file)
@@ -20,8 +20,6 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
-#include <errno.h>
-#include <string.h>
 #include "target.h"
 #include "target-dcache.h"
 #include "gdbcmd.h"
@@ -119,13 +117,10 @@ static void init_dummy_target (void);
 
 static void update_current_target (void);
 
-/* Pointer to array of target architecture structures; the size of the
-   array; the current index into the array; the allocated size of the
-   array.  */
-struct target_ops **target_structs;
-unsigned target_struct_size;
-unsigned target_struct_allocsize;
-#define        DEFAULT_ALLOCSIZE       10
+/* Vector of existing target structures. */
+typedef struct target_ops *target_ops_p;
+DEF_VEC_P (target_ops_p);
+static VEC (target_ops_p) *target_structs;
 
 /* The initial current target, so that there is always a semi-valid
    current target.  */
@@ -381,20 +376,7 @@ add_target_with_completer (struct target_ops *t,
 
   complete_target_initialization (t);
 
-  if (!target_structs)
-    {
-      target_struct_allocsize = DEFAULT_ALLOCSIZE;
-      target_structs = (struct target_ops **) xmalloc
-       (target_struct_allocsize * sizeof (*target_structs));
-    }
-  if (target_struct_size >= target_struct_allocsize)
-    {
-      target_struct_allocsize *= 2;
-      target_structs = (struct target_ops **)
-       xrealloc ((char *) target_structs,
-                 target_struct_allocsize * sizeof (*target_structs));
-    }
-  target_structs[target_struct_size++] = t;
+  VEC_safe_push (target_ops_p, target_structs, t);
 
   if (targetlist == NULL)
     add_prefix_cmd ("target", class_run, target_command, _("\
@@ -1287,6 +1269,22 @@ target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
     return TARGET_XFER_E_IO;
 }
 
+/* See target/target.h.  */
+
+int
+target_read_uint32 (CORE_ADDR memaddr, uint32_t *result)
+{
+  gdb_byte buf[4];
+  int r;
+
+  r = target_read_memory (memaddr, buf, sizeof buf);
+  if (r != 0)
+    return r;
+  *result = extract_unsigned_integer (buf, sizeof buf,
+                                     gdbarch_byte_order (target_gdbarch ()));
+  return 0;
+}
+
 /* Like target_read_memory, but specify explicitly that this is a read
    from the target's raw memory.  That is, this read bypasses the
    dcache, breakpoint shadowing, etc.  */
@@ -2365,15 +2363,15 @@ find_default_run_target (char *do_mesg)
 
   if (auto_connect_native_target)
     {
-      struct target_ops **t;
+      struct target_ops *t;
       int count = 0;
+      int i;
 
-      for (t = target_structs; t < target_structs + target_struct_size;
-          ++t)
+      for (i = 0; VEC_iterate (target_ops_p, target_structs, i, t); ++i)
        {
-         if ((*t)->to_can_run != delegate_can_run && target_can_run (*t))
+         if (t->to_can_run != delegate_can_run && target_can_run (t))
            {
-             runable = *t;
+             runable = t;
              ++count;
            }
        }
@@ -3029,6 +3027,31 @@ target_stop (ptid_t ptid)
   (*current_target.to_stop) (&current_target, ptid);
 }
 
+/* See target/target.h.  */
+
+void
+target_stop_ptid (ptid_t ptid)
+{
+  struct target_waitstatus status;
+  int was_non_stop = non_stop;
+
+  non_stop = 1;
+  target_stop (ptid);
+
+  memset (&status, 0, sizeof (status));
+  target_wait (ptid, &status, 0);
+
+  non_stop = was_non_stop;
+}
+
+/* See target/target.h.  */
+
+void
+target_continue_ptid (ptid_t ptid)
+{
+  target_resume (ptid, 0, GDB_SIGNAL_0);
+}
+
 /* Concatenate ELEM to LIST, a comma separate list, and return the
    result.  The LIST incoming argument is released.  */
 
This page took 0.036787 seconds and 4 git commands to generate.