Revision 1009d2ed

b/cpu-exec.c
196 196
    return tb;
197 197
}
198 198

  
199
static CPUDebugExcpHandler *debug_excp_handler;
200

  
201
CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
202
{
203
    CPUDebugExcpHandler *old_handler = debug_excp_handler;
204

  
205
    debug_excp_handler = handler;
206
    return old_handler;
207
}
208

  
209
static void cpu_handle_debug_exception(CPUState *env)
210
{
211
    CPUWatchpoint *wp;
212

  
213
    if (!env->watchpoint_hit) {
214
        QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
215
            wp->flags &= ~BP_WATCHPOINT_HIT;
216
        }
217
    }
218
    if (debug_excp_handler) {
219
        debug_excp_handler(env);
220
    }
221
}
222

  
199 223
/* main execution loop */
200 224

  
201 225
volatile sig_atomic_t exit_request;
......
269 293
                if (env->exception_index >= EXCP_INTERRUPT) {
270 294
                    /* exit request from the cpu execution loop */
271 295
                    ret = env->exception_index;
296
                    if (ret == EXCP_DEBUG) {
297
                        cpu_handle_debug_exception(env);
298
                    }
272 299
                    break;
273 300
                } else {
274 301
#if defined(CONFIG_USER_ONLY)
b/cpus.c
166 166
    return true;
167 167
}
168 168

  
169
static CPUDebugExcpHandler *debug_excp_handler;
170

  
171
CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
172
{
173
    CPUDebugExcpHandler *old_handler = debug_excp_handler;
174

  
175
    debug_excp_handler = handler;
176
    return old_handler;
177
}
178

  
179
static void cpu_handle_debug_exception(CPUState *env)
169
static void cpu_handle_guest_debug(CPUState *env)
180 170
{
181
    CPUWatchpoint *wp;
182

  
183
    if (!env->watchpoint_hit) {
184
        QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
185
            wp->flags &= ~BP_WATCHPOINT_HIT;
186
        }
187
    }
188
    if (debug_excp_handler) {
189
        debug_excp_handler(env);
190
    }
191

  
192 171
    gdb_set_stop_cpu(env);
193 172
    qemu_system_debug_request();
194 173
#ifdef CONFIG_IOTHREAD
......
818 797
        if (cpu_can_run(env)) {
819 798
            r = kvm_cpu_exec(env);
820 799
            if (r == EXCP_DEBUG) {
821
                cpu_handle_debug_exception(env);
800
                cpu_handle_guest_debug(env);
822 801
            }
823 802
        }
824 803
        qemu_kvm_wait_io_event(env);
......
1110 1089
                r = tcg_cpu_exec(env);
1111 1090
            }
1112 1091
            if (r == EXCP_DEBUG) {
1113
                cpu_handle_debug_exception(env);
1092
                cpu_handle_guest_debug(env);
1114 1093
                break;
1115 1094
            }
1116 1095
        } else if (env->stop || env->stopped) {

Also available in: Unified diff