diff options
author | Paul Brook <paul@codesourcery.com> | 2010-06-16 13:03:51 +0100 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2010-06-16 13:03:51 +0100 |
commit | 0e1c9c54afb9ce6be2339923ced025a0d2a541ea (patch) | |
tree | 37ecff9eb90d4c880b80bfdcb53ab976dc6236e8 /gdbstub.c | |
parent | 1884533c74aea64f8acac735a30bc8f427de161f (diff) |
GDB exit status for semihosting
Report exit status to GDB when a semihosted application exits.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'gdbstub.c')
-rw-r--r-- | gdbstub.c | 34 |
1 files changed, 20 insertions, 14 deletions
@@ -2373,6 +2373,26 @@ static void gdb_read_byte(GDBState *s, int ch) } } +/* Tell the remote gdb that the process has exited. */ +void gdb_exit(CPUState *env, int code) +{ + GDBState *s; + char buf[4]; + + s = gdbserver_state; + if (!s) { + return; + } +#ifdef CONFIG_USER_ONLY + if (gdbserver_fd < 0 || s->fd < 0) { + return; + } +#endif + + snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code); + put_packet(s, buf); +} + #ifdef CONFIG_USER_ONLY int gdb_queuesig (void) @@ -2436,20 +2456,6 @@ gdb_handlesig (CPUState *env, int sig) return sig; } -/* Tell the remote gdb that the process has exited. */ -void gdb_exit(CPUState *env, int code) -{ - GDBState *s; - char buf[4]; - - s = gdbserver_state; - if (gdbserver_fd < 0 || s->fd < 0) - return; - - snprintf(buf, sizeof(buf), "W%02x", code); - put_packet(s, buf); -} - /* Tell the remote gdb that the process has exited due to SIG. */ void gdb_signalled(CPUState *env, int sig) { |