Skip to content

Commit

Permalink
report user mode gdb exit codes (Paul Brook)
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1401 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
bellard committed Apr 26, 2005
1 parent 43fb823 commit e900967
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,22 @@ 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];

if (gdbserver_fd < 0)
return;

s = &gdbserver_state;

snprintf(buf, sizeof(buf), "W%02x", code);
put_packet(s, buf);
}

#else
static int gdb_can_read(void *opaque)
{
Expand Down
1 change: 1 addition & 0 deletions gdbstub.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#ifdef CONFIG_USER_ONLY
int gdb_handlesig (CPUState *, int);
void gdb_exit(CPUState *, int);
#endif
int gdbserver_start(int);

Expand Down
2 changes: 2 additions & 0 deletions linux-user/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
#ifdef HAVE_GPROF
_mcleanup();
#endif
gdb_exit(cpu_env, arg1);
/* XXX: should free thread stack and CPU env */
_exit(arg1);
ret = 0; /* avoid warning */
Expand Down Expand Up @@ -2409,6 +2410,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
#ifdef __NR_exit_group
/* new thread calls */
case TARGET_NR_exit_group:
gdb_exit(cpu_env, arg1);
ret = get_errno(exit_group(arg1));
break;
#endif
Expand Down

0 comments on commit e900967

Please sign in to comment.