Remove sanitized-out Magic Cap support, will never be released
[deliverable/binutils-gdb.git] / gdb / target.c
index 9ae8941482a56297270da18af8981df5cb7d0df0..8e87aaf83a8377832e0c09ff37762b66e83bade8 100644 (file)
@@ -16,7 +16,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include <errno.h>
@@ -445,7 +445,8 @@ push_target (t)
     while (t->to_stratum == cur->target_ops->to_stratum)
       {
        /* There's already something on this stratum.  Close it off.  */
-       (cur->target_ops->to_close) (0);
+       if (cur->target_ops->to_close)
+         (cur->target_ops->to_close) (0);
        if (prev)
          prev->next = cur->next; /* Unchain old target_ops */
        else
@@ -1027,6 +1028,14 @@ static struct {
   {"SIG62", "Real-time event 62"},
   {"SIG63", "Real-time event 63"},
 
+  /* Mach exceptions */
+  {"EXC_BAD_ACCESS", "Could not access memory"},
+  {"EXC_BAD_INSTRUCTION", "Illegal instruction/operand"},
+  {"EXC_ARITHMETIC", "Arithmetic exception"},
+  {"EXC_EMULATION", "Emulation instruction"},
+  {"EXC_SOFTWARE", "Software generated exception"},
+  {"EXC_BREAKPOINT", "Breakpoint"},
+
   {NULL, "Unknown signal"},
   {NULL, "Internal error: printing TARGET_SIGNAL_DEFAULT"},
 
@@ -1224,6 +1233,27 @@ target_signal_from_host (hostsig)
 #if defined (SIGPRIO)
   if (hostsig == SIGPRIO) return TARGET_SIGNAL_PRIO;
 #endif
+
+  /* Mach exceptions.  Assumes that the values for EXC_ are positive! */
+#if defined (EXC_BAD_ACCESS) && defined (_NSIG)
+  if (hostsig == _NSIG + EXC_BAD_ACCESS) return TARGET_EXC_BAD_ACCESS;
+#endif
+#if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
+  if (hostsig == _NSIG + EXC_BAD_INSTRUCTION) return TARGET_EXC_BAD_INSTRUCTION;
+#endif
+#if defined (EXC_ARITHMETIC) && defined (_NSIG)
+  if (hostsig == _NSIG + EXC_ARITHMETIC) return TARGET_EXC_ARITHMETIC;
+#endif
+#if defined (EXC_EMULATION) && defined (_NSIG)
+  if (hostsig == _NSIG + EXC_EMULATION) return TARGET_EXC_EMULATION;
+#endif
+#if defined (EXC_SOFTWARE) && defined (_NSIG)
+  if (hostsig == _NSIG + EXC_SOFTWARE) return TARGET_EXC_SOFTWARE;
+#endif
+#if defined (EXC_BREAKPOINT) && defined (_NSIG)
+  if (hostsig == _NSIG + EXC_BREAKPOINT) return TARGET_EXC_BREAKPOINT;
+#endif
+
 #if defined (REALTIME_LO)
   if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
     return (enum target_signal)
@@ -1377,6 +1407,27 @@ target_signal_to_host (oursig)
 #if defined (SIGPRIO)
     case TARGET_SIGNAL_PRIO: return SIGPRIO;
 #endif
+
+      /* Mach exceptions.  Assumes that the values for EXC_ are positive! */
+#if defined (EXC_BAD_ACCESS) && defined (_NSIG)
+    case TARGET_EXC_BAD_ACCESS: return _NSIG + EXC_BAD_ACCESS;
+#endif
+#if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
+    case TARGET_EXC_BAD_INSTRUCTION: return _NSIG + EXC_BAD_INSTRUCTION;
+#endif
+#if defined (EXC_ARITHMETIC) && defined (_NSIG)
+    case TARGET_EXC_ARITHMETIC: return _NSIG + EXC_ARITHMETIC;
+#endif
+#if defined (EXC_EMULATION) && defined (_NSIG)
+    case TARGET_EXC_EMULATION: return _NSIG + EXC_EMULATION;
+#endif
+#if defined (EXC_SOFTWARE) && defined (_NSIG)
+    case TARGET_EXC_SOFTWARE: return _NSIG + EXC_SOFTWARE;
+#endif
+#if defined (EXC_BREAKPOINT) && defined (_NSIG)
+    case TARGET_EXC_BREAKPOINT: return _NSIG + EXC_BREAKPOINT;
+#endif
+
     default:
 #if defined (REALTIME_LO)
       if (oursig >= TARGET_SIGNAL_REALTIME_33
@@ -1608,7 +1659,8 @@ debug_to_xfer_memory (memaddr, myaddr, len, write, target)
 
   retval = debug_target.to_xfer_memory (memaddr, myaddr, len, write, target);
 
-  fprintf_unfiltered (stderr, "target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d",
+  fprintf_unfiltered (stderr,
+                     "target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d",
                      memaddr, len, write ? "write" : "read", retval);
 
   if (retval > 0)
@@ -1617,7 +1669,11 @@ debug_to_xfer_memory (memaddr, myaddr, len, write, target)
 
       fputs_unfiltered (", bytes =", gdb_stderr);
       for (i = 0; i < retval; i++)
-       fprintf_unfiltered (stderr, " %02x", myaddr[i] & 0xff);
+       {
+         if ((((long) &(myaddr[i])) & 0xf) == 0)
+           fprintf_unfiltered (stderr, "\n");
+         fprintf_unfiltered (stderr, " %02x", myaddr[i] & 0xff);
+       }
     }
 
   fputc_unfiltered ('\n', gdb_stderr);
@@ -1782,10 +1838,13 @@ static int
 debug_to_thread_alive (pid)
      int pid;
 {
-  debug_target.to_thread_alive (pid);
+  int retval;
+
+  retval = debug_target.to_thread_alive (pid);
 
-  fprintf_unfiltered (stderr, "target_thread_alive (%d)\n", pid);
-  return (0);
+  fprintf_unfiltered (stderr, "target_thread_alive (%d) = %d\n", pid, retval);
+
+  return retval;
 }
 
 static void
This page took 0.026443 seconds and 4 git commands to generate.