Commit e568902a02aa58dc53d4158aa2942ef3ff08a9ce
1 parent
4870852c
qemu: use debug_requested global instead of cpu_exec return (Marcelo Tosatti)
Necessary for the next refactoring patch. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7245 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
14 additions
and
3 deletions
vl.c
| @@ -3568,6 +3568,7 @@ static QEMUResetEntry *first_reset_entry; | @@ -3568,6 +3568,7 @@ static QEMUResetEntry *first_reset_entry; | ||
| 3568 | static int reset_requested; | 3568 | static int reset_requested; |
| 3569 | static int shutdown_requested; | 3569 | static int shutdown_requested; |
| 3570 | static int powerdown_requested; | 3570 | static int powerdown_requested; |
| 3571 | +static int debug_requested; | ||
| 3571 | 3572 | ||
| 3572 | int qemu_shutdown_requested(void) | 3573 | int qemu_shutdown_requested(void) |
| 3573 | { | 3574 | { |
| @@ -3590,6 +3591,13 @@ int qemu_powerdown_requested(void) | @@ -3590,6 +3591,13 @@ int qemu_powerdown_requested(void) | ||
| 3590 | return r; | 3591 | return r; |
| 3591 | } | 3592 | } |
| 3592 | 3593 | ||
| 3594 | +static int qemu_debug_requested(void) | ||
| 3595 | +{ | ||
| 3596 | + int r = debug_requested; | ||
| 3597 | + debug_requested = 0; | ||
| 3598 | + return r; | ||
| 3599 | +} | ||
| 3600 | + | ||
| 3593 | void qemu_register_reset(QEMUResetHandler *func, void *opaque) | 3601 | void qemu_register_reset(QEMUResetHandler *func, void *opaque) |
| 3594 | { | 3602 | { |
| 3595 | QEMUResetEntry **pre, *re; | 3603 | QEMUResetEntry **pre, *re; |
| @@ -4019,6 +4027,8 @@ static int vm_can_run(void) | @@ -4019,6 +4027,8 @@ static int vm_can_run(void) | ||
| 4019 | return 0; | 4027 | return 0; |
| 4020 | if (shutdown_requested) | 4028 | if (shutdown_requested) |
| 4021 | return 0; | 4029 | return 0; |
| 4030 | + if (debug_requested) | ||
| 4031 | + return 0; | ||
| 4022 | return 1; | 4032 | return 1; |
| 4023 | } | 4033 | } |
| 4024 | 4034 | ||
| @@ -4045,6 +4055,7 @@ static void main_loop(void) | @@ -4045,6 +4055,7 @@ static void main_loop(void) | ||
| 4045 | ret = qemu_cpu_exec(env); | 4055 | ret = qemu_cpu_exec(env); |
| 4046 | if (ret == EXCP_DEBUG) { | 4056 | if (ret == EXCP_DEBUG) { |
| 4047 | gdb_set_stop_cpu(env); | 4057 | gdb_set_stop_cpu(env); |
| 4058 | + debug_requested = 1; | ||
| 4048 | break; | 4059 | break; |
| 4049 | } | 4060 | } |
| 4050 | } | 4061 | } |
| @@ -4055,11 +4066,11 @@ static void main_loop(void) | @@ -4055,11 +4066,11 @@ static void main_loop(void) | ||
| 4055 | #ifdef CONFIG_PROFILER | 4066 | #ifdef CONFIG_PROFILER |
| 4056 | dev_time += profile_getclock() - ti; | 4067 | dev_time += profile_getclock() - ti; |
| 4057 | #endif | 4068 | #endif |
| 4058 | - } while (ret != EXCP_DEBUG && vm_can_run()); | 4069 | + } while (vm_can_run()); |
| 4059 | 4070 | ||
| 4060 | - if (ret == EXCP_DEBUG) | ||
| 4061 | - vm_stop(EXCP_DEBUG); | ||
| 4062 | 4071 | ||
| 4072 | + if (qemu_debug_requested()) | ||
| 4073 | + vm_stop(EXCP_DEBUG); | ||
| 4063 | if (qemu_shutdown_requested()) { | 4074 | if (qemu_shutdown_requested()) { |
| 4064 | if (no_shutdown) { | 4075 | if (no_shutdown) { |
| 4065 | vm_stop(0); | 4076 | vm_stop(0); |