Commit e90096763d74b1126cf502c2d710d64df5ecbb63
1 parent
43fb823b
report user mode gdb exit codes (Paul Brook)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1401 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
19 additions
and
0 deletions
gdbstub.c
@@ -656,6 +656,22 @@ gdb_handlesig (CPUState *env, int sig) | @@ -656,6 +656,22 @@ gdb_handlesig (CPUState *env, int sig) | ||
656 | } | 656 | } |
657 | return sig; | 657 | return sig; |
658 | } | 658 | } |
659 | + | ||
660 | +/* Tell the remote gdb that the process has exited. */ | ||
661 | +void gdb_exit(CPUState *env, int code) | ||
662 | +{ | ||
663 | + GDBState *s; | ||
664 | + char buf[4]; | ||
665 | + | ||
666 | + if (gdbserver_fd < 0) | ||
667 | + return; | ||
668 | + | ||
669 | + s = &gdbserver_state; | ||
670 | + | ||
671 | + snprintf(buf, sizeof(buf), "W%02x", code); | ||
672 | + put_packet(s, buf); | ||
673 | +} | ||
674 | + | ||
659 | #else | 675 | #else |
660 | static int gdb_can_read(void *opaque) | 676 | static int gdb_can_read(void *opaque) |
661 | { | 677 | { |
gdbstub.h
linux-user/syscall.c
@@ -1603,6 +1603,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | @@ -1603,6 +1603,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | ||
1603 | #ifdef HAVE_GPROF | 1603 | #ifdef HAVE_GPROF |
1604 | _mcleanup(); | 1604 | _mcleanup(); |
1605 | #endif | 1605 | #endif |
1606 | + gdb_exit(cpu_env, arg1); | ||
1606 | /* XXX: should free thread stack and CPU env */ | 1607 | /* XXX: should free thread stack and CPU env */ |
1607 | _exit(arg1); | 1608 | _exit(arg1); |
1608 | ret = 0; /* avoid warning */ | 1609 | ret = 0; /* avoid warning */ |
@@ -2409,6 +2410,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | @@ -2409,6 +2410,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | ||
2409 | #ifdef __NR_exit_group | 2410 | #ifdef __NR_exit_group |
2410 | /* new thread calls */ | 2411 | /* new thread calls */ |
2411 | case TARGET_NR_exit_group: | 2412 | case TARGET_NR_exit_group: |
2413 | + gdb_exit(cpu_env, arg1); | ||
2412 | ret = get_errno(exit_group(arg1)); | 2414 | ret = get_errno(exit_group(arg1)); |
2413 | break; | 2415 | break; |
2414 | #endif | 2416 | #endif |