Revision 7d03f82f

b/cpu-all.h
760 760

  
761 761
int cpu_watchpoint_insert(CPUState *env, target_ulong addr);
762 762
int cpu_watchpoint_remove(CPUState *env, target_ulong addr);
763
void cpu_watchpoint_remove_all(CPUState *env);
763 764
int cpu_breakpoint_insert(CPUState *env, target_ulong pc);
764 765
int cpu_breakpoint_remove(CPUState *env, target_ulong pc);
766
void cpu_breakpoint_remove_all(CPUState *env);
765 767

  
766 768
#define SSTEP_ENABLE  0x1  /* Enable simulated HW single stepping */
767 769
#define SSTEP_NOIRQ   0x2  /* Do not use IRQ while single stepping */
b/exec.c
1139 1139
    return -1;
1140 1140
}
1141 1141

  
1142
/* Remove all watchpoints. */
1143
void cpu_watchpoint_remove_all(CPUState *env) {
1144
    int i;
1145

  
1146
    for (i = 0; i < env->nb_watchpoints; i++) {
1147
        tlb_flush_page(env, env->watchpoint[i].vaddr);
1148
    }
1149
    env->nb_watchpoints = 0;
1150
}
1151

  
1142 1152
/* add a breakpoint. EXCP_DEBUG is returned by the CPU loop if a
1143 1153
   breakpoint is reached */
1144 1154
int cpu_breakpoint_insert(CPUState *env, target_ulong pc)
......
1162 1172
#endif
1163 1173
}
1164 1174

  
1175
/* remove all breakpoints */
1176
void cpu_breakpoint_remove_all(CPUState *env) {
1177
#if defined(TARGET_HAS_ICE)
1178
    int i;
1179
    for(i = 0; i < env->nb_breakpoints; i++) {
1180
        breakpoint_invalidate(env, env->breakpoints[i]);
1181
    }
1182
    env->nb_breakpoints = 0;
1183
#endif
1184
}
1185

  
1165 1186
/* remove a breakpoint */
1166 1187
int cpu_breakpoint_remove(CPUState *env, target_ulong pc)
1167 1188
{
b/gdbstub.c
962 962
        /* TODO: Make this return the correct value for user-mode.  */
963 963
        snprintf(buf, sizeof(buf), "S%02x", SIGTRAP);
964 964
        put_packet(s, buf);
965
        /* Remove all the breakpoints when this query is issued,
966
         * because gdb is doing and initial connect and the state
967
         * should be cleaned up.
968
         */
969
        cpu_breakpoint_remove_all(env);
970
        cpu_watchpoint_remove_all(env);
965 971
        break;
966 972
    case 'c':
967 973
        if (*p != '\0') {
......
985 991
        }
986 992
        gdb_continue(s);
987 993
	return RS_IDLE;
994
    case 'k':
995
        /* Kill the target */
996
        fprintf(stderr, "\nQEMU: Terminated via GDBstub\n");
997
        exit(0);
998
    case 'D':
999
        /* Detach packet */
1000
        cpu_breakpoint_remove_all(env);
1001
        cpu_watchpoint_remove_all(env);
1002
        gdb_continue(s);
1003
        put_packet(s, "OK");
1004
        break;
988 1005
    case 's':
989 1006
        if (*p != '\0') {
990 1007
            addr = strtoull(p, (char **)&p, 16);

Also available in: Unified diff