|
@@ -356,16 +356,27 @@ int gdbserver_start(const char *port_or_path)
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
+static void disable_gdbstub(CPUState *thread_cpu)
|
|
|
+{
|
|
|
+ CPUState *cpu;
|
|
|
+
|
|
|
+ close(gdbserver_user_state.fd);
|
|
|
+ gdbserver_user_state.fd = -1;
|
|
|
+ CPU_FOREACH(cpu) {
|
|
|
+ cpu_breakpoint_remove_all(cpu, BP_GDB);
|
|
|
+ /* no cpu_watchpoint_remove_all for user-mode */
|
|
|
+ cpu_single_step(cpu, 0);
|
|
|
+ }
|
|
|
+ tb_flush(thread_cpu);
|
|
|
+}
|
|
|
+
|
|
|
/* Disable gdb stub for child processes. */
|
|
|
void gdbserver_fork(CPUState *cpu)
|
|
|
{
|
|
|
if (!gdbserver_state.init || gdbserver_user_state.fd < 0) {
|
|
|
return;
|
|
|
}
|
|
|
- close(gdbserver_user_state.fd);
|
|
|
- gdbserver_user_state.fd = -1;
|
|
|
- cpu_breakpoint_remove_all(cpu, BP_GDB);
|
|
|
- /* no cpu_watchpoint_remove_all for user-mode */
|
|
|
+ disable_gdbstub(cpu);
|
|
|
}
|
|
|
|
|
|
/*
|