summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-07-26 12:06:08 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-07-26 12:06:08 +0000
commit4c3a88a284b288e0ed3c097de7fc07111d848003 (patch)
tree8f4a8190c97d326f26b4e7d603ac8f98c50e8706 /exec.c
parentd6b4936796b37f629879de69d847c5cdc4892157 (diff)
downloadqemu-4c3a88a284b288e0ed3c097de7fc07111d848003.tar.gz
qemu-4c3a88a284b288e0ed3c097de7fc07111d848003.tar.bz2
qemu-4c3a88a284b288e0ed3c097de7fc07111d848003.zip
gdb stub breakpoints support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@332 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index e7f5081d0b..fc0a0cf7af 100644
--- a/exec.c
+++ b/exec.c
@@ -617,6 +617,48 @@ static void tb_reset_jump_recursive(TranslationBlock *tb)
tb_reset_jump_recursive2(tb, 1);
}
+/* add a breakpoint */
+int cpu_breakpoint_insert(CPUState *env, uint32_t pc)
+{
+#if defined(TARGET_I386)
+ int i;
+
+ for(i = 0; i < env->nb_breakpoints; i++) {
+ if (env->breakpoints[i] == pc)
+ return 0;
+ }
+
+ if (env->nb_breakpoints >= MAX_BREAKPOINTS)
+ return -1;
+ env->breakpoints[env->nb_breakpoints++] = pc;
+ tb_invalidate_page(pc);
+ return 0;
+#else
+ return -1;
+#endif
+}
+
+/* remove a breakpoint */
+int cpu_breakpoint_remove(CPUState *env, uint32_t pc)
+{
+#if defined(TARGET_I386)
+ int i;
+ for(i = 0; i < env->nb_breakpoints; i++) {
+ if (env->breakpoints[i] == pc)
+ goto found;
+ }
+ return -1;
+ found:
+ memmove(&env->breakpoints[i], &env->breakpoints[i + 1],
+ (env->nb_breakpoints - (i + 1)) * sizeof(env->breakpoints[0]));
+ env->nb_breakpoints--;
+ tb_invalidate_page(pc);
+ return 0;
+#else
+ return -1;
+#endif
+}
+
/* mask must never be zero */
void cpu_interrupt(CPUState *env, int mask)
{