/* Select target systems and architectures at runtime for GDB.
- Copyright 1990, 1992, 1993, 1994 Free Software Foundation, Inc.
+ Copyright 1990, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GDB.
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>
#include <ctype.h>
+#include "gdb_string.h"
#include "target.h"
#include "gdbcmd.h"
#include "symtab.h"
de_fault (to_mourn_inferior, (void (*)())noprocess);
de_fault (to_can_run, return_zero);
de_fault (to_notice_signals, (void (*)())ignore);
- de_fault (to_thread_alive, (void (*)())ignore);
+ de_fault (to_thread_alive, (int (*)())ignore);
de_fault (to_stop, (void (*)())ignore);
#undef de_fault
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
{"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"},
#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)
#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
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)
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);
fprintf_unfiltered (stderr, "target_notice_signals (%d)\n", pid);
}
-static void
+static int
debug_to_thread_alive (pid)
int pid;
{
- debug_target.to_thread_alive (pid);
+ int retval;
- fprintf_unfiltered (stderr, "target_thread_alive (%d)\n", pid);
+ retval = debug_target.to_thread_alive (pid);
+
+ fprintf_unfiltered (stderr, "target_thread_alive (%d) = %d\n", pid, retval);
+
+ return retval;
}
static void