Commit ba70a624e9fae13d349111311b522771122a4dd9
1 parent
ca87d03b
Improve readability by moving the continue operation into aseparate function.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4059 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
13 additions
and
15 deletions
gdbstub.c
| ... | ... | @@ -121,6 +121,16 @@ int use_gdb_syscalls(void) |
| 121 | 121 | return gdb_syscall_mode == GDB_SYS_ENABLED; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | +/* Resume execution. */ | |
| 125 | +static inline void gdb_continue(GDBState *s) | |
| 126 | +{ | |
| 127 | +#ifdef CONFIG_USER_ONLY | |
| 128 | + s->running_state = 1; | |
| 129 | +#else | |
| 130 | + vm_start(); | |
| 131 | +#endif | |
| 132 | +} | |
| 133 | + | |
| 124 | 134 | static void put_buffer(GDBState *s, const uint8_t *buf, int len) |
| 125 | 135 | { |
| 126 | 136 | #ifdef CONFIG_USER_ONLY |
| ... | ... | @@ -908,11 +918,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) |
| 908 | 918 | env->pc = addr; |
| 909 | 919 | #endif |
| 910 | 920 | } |
| 911 | -#ifdef CONFIG_USER_ONLY | |
| 912 | - s->running_state = 1; | |
| 913 | -#else | |
| 914 | - vm_start(); | |
| 915 | -#endif | |
| 921 | + gdb_continue(s); | |
| 916 | 922 | return RS_IDLE; |
| 917 | 923 | case 's': |
| 918 | 924 | if (*p != '\0') { |
| ... | ... | @@ -935,11 +941,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) |
| 935 | 941 | #endif |
| 936 | 942 | } |
| 937 | 943 | cpu_single_step(env, 1); |
| 938 | -#ifdef CONFIG_USER_ONLY | |
| 939 | - s->running_state = 1; | |
| 940 | -#else | |
| 941 | - vm_start(); | |
| 942 | -#endif | |
| 944 | + gdb_continue(s); | |
| 943 | 945 | return RS_IDLE; |
| 944 | 946 | case 'F': |
| 945 | 947 | { |
| ... | ... | @@ -961,11 +963,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) |
| 961 | 963 | if (type == 'C') { |
| 962 | 964 | put_packet(s, "T02"); |
| 963 | 965 | } else { |
| 964 | -#ifdef CONFIG_USER_ONLY | |
| 965 | - s->running_state = 1; | |
| 966 | -#else | |
| 967 | - vm_start(); | |
| 968 | -#endif | |
| 966 | + gdb_continue(s); | |
| 969 | 967 | } |
| 970 | 968 | } |
| 971 | 969 | break; | ... | ... |