diff options
author | Hans-Peter Nilsson <hp@axis.com> | 2006-10-02 03:21:28 +0000 |
---|---|---|
committer | Hans-Peter Nilsson <hp@axis.com> | 2006-10-02 03:21:28 +0000 |
commit | 466b1d33082997a5a2f267897b435364cde0131c (patch) | |
tree | 73899397915659fc9f158b4ae45d0d6c52810a58 /sim/cris/sim-if.c | |
parent | 1654a6f72803b321cfe3d7ac28ea1abed5d26fd9 (diff) | |
download | gdb-466b1d33082997a5a2f267897b435364cde0131c.zip gdb-466b1d33082997a5a2f267897b435364cde0131c.tar.gz gdb-466b1d33082997a5a2f267897b435364cde0131c.tar.bz2 |
* cris/cris-sim.h (enum cris_unknown_syscall_action_type)
(cris_unknown_syscall_action): Declare.
* cris/sim-if.c (cris_unknown_syscall_action): Define.
(cris_options): Add cris-unknown-syscall option.
(cris_option_handler): Correct comment about and error message for
invalid --cris-cycles argument. Handle --cris-unknown-syscall.
* cris/traps.c: Include stdarg.h
(cris_unknown_syscall): New function.
(cris_break_13_handler): Instead of sim_io_eprintf and
sim_engine_halt, call cris_unknown_syscall to handle more or less
unknown syscalls. Adjust code as necessary to handle return
value.
Diffstat (limited to 'sim/cris/sim-if.c')
-rw-r--r-- | sim/cris/sim-if.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index 86d19b2..bfa360c 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -80,6 +80,10 @@ static char cris_bare_iron = 0; /* Whether 0x9000000xx have simulator-specific meanings. */ char cris_have_900000xxif = 0; +/* What to do when we face a more or less unknown syscall. */ +enum cris_unknown_syscall_action_type cris_unknown_syscall_action + = CRIS_USYSC_MSG_STOP; + /* Records simulator descriptor so utilities like cris_dump_regs can be called from gdb. */ SIM_DESC current_state; @@ -90,6 +94,7 @@ typedef enum { OPTION_CRIS_TRACE, OPTION_CRIS_NAKED, OPTION_CRIS_900000XXIF, + OPTION_CRIS_UNKNOWN_SYSCALL } CRIS_OPTIONS; static const OPTION cris_options[] = @@ -108,6 +113,10 @@ static const OPTION cris_options[] = { {"cris-900000xx", no_argument, NULL, OPTION_CRIS_900000XXIF}, '\0', NULL, "Define addresses at 0x900000xx with simulator semantics", cris_option_handler, NULL }, + { {"cris-unknown-syscall", required_argument, NULL, + OPTION_CRIS_UNKNOWN_SYSCALL}, + '\0', "stop|enosys|enosys-quiet", "Action at an unknown system call", + cris_option_handler, NULL }, { {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL, NULL } }; @@ -152,9 +161,9 @@ cris_option_handler (SIM_DESC sd, sim_cpu *cpu ATTRIBUTE_UNUSED, int opt, *tracefp = FLAG_CRIS_MISC_PROFILE_ALL; else { - /* We'll actually never get here; the caller handles the - error case. */ - sim_io_eprintf (sd, "Unknown option `--cris-stats=%s'\n", arg); + /* Beware; the framework does not handle the error case; + we have to do it ourselves. */ + sim_io_eprintf (sd, "Unknown option `--cris-cycles=%s'\n", arg); return SIM_RC_FAIL; } break; @@ -177,6 +186,21 @@ cris_option_handler (SIM_DESC sd, sim_cpu *cpu ATTRIBUTE_UNUSED, int opt, cris_have_900000xxif = 1; break; + case OPTION_CRIS_UNKNOWN_SYSCALL: + if (strcmp (arg, "enosys") == 0) + cris_unknown_syscall_action = CRIS_USYSC_MSG_ENOSYS; + else if (strcmp (arg, "enosys-quiet") == 0) + cris_unknown_syscall_action = CRIS_USYSC_QUIET_ENOSYS; + else if (strcmp (arg, "stop") == 0) + cris_unknown_syscall_action = CRIS_USYSC_MSG_STOP; + else + { + sim_io_eprintf (sd, "Unknown option `--cris-unknown-syscall=%s'\n", + arg); + return SIM_RC_FAIL; + } + break; + default: /* We'll actually never get here; the caller handles the error case. */ |