Revision 0e1c9c54

b/arm-semi.c
459 459
            return 0;
460 460
        }
461 461
    case SYS_EXIT:
462
        gdb_exit(env, 0);
462 463
        exit(0);
463 464
    default:
464 465
        fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr);
b/gdbstub.c
2373 2373
    }
2374 2374
}
2375 2375

  
2376
/* Tell the remote gdb that the process has exited.  */
2377
void gdb_exit(CPUState *env, int code)
2378
{
2379
  GDBState *s;
2380
  char buf[4];
2381

  
2382
  s = gdbserver_state;
2383
  if (!s) {
2384
      return;
2385
  }
2386
#ifdef CONFIG_USER_ONLY
2387
  if (gdbserver_fd < 0 || s->fd < 0) {
2388
      return;
2389
  }
2390
#endif
2391

  
2392
  snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code);
2393
  put_packet(s, buf);
2394
}
2395

  
2376 2396
#ifdef CONFIG_USER_ONLY
2377 2397
int
2378 2398
gdb_queuesig (void)
......
2436 2456
  return sig;
2437 2457
}
2438 2458

  
2439
/* Tell the remote gdb that the process has exited.  */
2440
void gdb_exit(CPUState *env, int code)
2441
{
2442
  GDBState *s;
2443
  char buf[4];
2444

  
2445
  s = gdbserver_state;
2446
  if (gdbserver_fd < 0 || s->fd < 0)
2447
    return;
2448

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

  
2453 2459
/* Tell the remote gdb that the process has exited due to SIG.  */
2454 2460
void gdb_signalled(CPUState *env, int sig)
2455 2461
{
b/gdbstub.h
17 17
void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...);
18 18
int use_gdb_syscalls(void);
19 19
void gdb_set_stop_cpu(CPUState *env);
20
void gdb_exit(CPUState *, int);
20 21
#ifdef CONFIG_USER_ONLY
21 22
int gdb_queuesig (void);
22 23
int gdb_handlesig (CPUState *, int);
23
void gdb_exit(CPUState *, int);
24 24
void gdb_signalled(CPUState *, int);
25 25
void gdbserver_fork(CPUState *);
26 26
#endif
b/m68k-semi.c
172 172
    args = env->dregs[1];
173 173
    switch (nr) {
174 174
    case HOSTED_EXIT:
175
        gdb_exit(env, env->dregs[0]);
175 176
        exit(env->dregs[0]);
176 177
    case HOSTED_OPEN:
177 178
        if (use_gdb_syscalls()) {

Also available in: Unified diff