]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/target.c
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / target.c
index 2062733037ec8252f3e4da76b9eb943490c98897..75c78bdbdcbee1c36aff92cc48e47b6fde59e8b7 100644 (file)
@@ -1,7 +1,7 @@
 /* Select target systems and architectures at runtime for GDB.
 
-   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.
@@ -40,6 +40,7 @@
 #include "gdb_assert.h"
 #include "gdbcore.h"
 #include "exceptions.h"
+#include "target-descriptions.h"
 
 static void target_info (char *, int);
 
@@ -464,6 +465,7 @@ update_current_target (void)
       INHERIT (to_find_memory_regions, t);
       INHERIT (to_make_corefile_notes, t);
       INHERIT (to_get_thread_local_address, t);
+      /* Do not inherit to_read_description.  */
       INHERIT (to_magic, t);
       /* Do not inherit to_memory_map.  */
       /* Do not inherit to_flash_erase.  */
@@ -641,6 +643,7 @@ update_current_target (void)
   de_fault (to_async,
            (void (*) (void (*) (enum inferior_event_type, void*), void*))
            tcomplain);
+  current_target.to_read_description = NULL;
 #undef de_fault
 
   /* Finally, position the target-stack beneath the squashed
@@ -1602,6 +1605,8 @@ void
 target_pre_inferior (int from_tty)
 {
   invalidate_target_mem_regions ();
+
+  target_clear_description ();
 }
 
 /* This is to be called by the open routine before it does
@@ -1689,6 +1694,27 @@ target_follow_fork (int follow_child)
                  "could not find a target to follow fork");
 }
 
+/* Look for a target which can describe architectural features, starting
+   from TARGET.  If we find one, return its description.  */
+
+const struct target_desc *
+target_read_description (struct target_ops *target)
+{
+  struct target_ops *t;
+
+  for (t = target; t != NULL; t = t->beneath)
+    if (t->to_read_description != NULL)
+      {
+       const struct target_desc *tdesc;
+
+       tdesc = t->to_read_description (t);
+       if (tdesc)
+         return tdesc;
+      }
+
+  return NULL;
+}
+
 /* Look through the list of possible targets for a target that can
    execute a run or attach command without any other data.  This is
    used to locate the default process stratum.
@@ -2360,10 +2386,10 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type)
 {
   int retval;
 
-  retval = debug_target.to_insert_watchpoint (addr, len, type);
+  retval = debug_target.to_remove_watchpoint (addr, len, type);
 
   fprintf_unfiltered (gdb_stdlog,
-                     "target_insert_watchpoint (0x%lx, %d, %d) = %ld\n",
+                     "target_remove_watchpoint (0x%lx, %d, %d) = %ld\n",
                      (unsigned long) addr, len, type, (unsigned long) retval);
   return retval;
 }