]> Git Repo - qemu.git/commitdiff
runstate: Print state transition when invalid
authorLuiz Capitulino <[email protected]>
Thu, 13 Oct 2011 13:59:07 +0000 (10:59 -0300)
committerLuiz Capitulino <[email protected]>
Wed, 19 Oct 2011 12:48:52 +0000 (10:48 -0200)
Makes it easier to debug.

Signed-off-by: Luiz Capitulino <[email protected]>
vl.c

diff --git a/vl.c b/vl.c
index 2dce3ae51e387c0b526983ac515c1644b646b44e..2a634a7ce69092c467c7a79626e950c74d7a1d05 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -393,9 +393,12 @@ void runstate_init(void)
 /* This function will abort() on invalid state transitions */
 void runstate_set(RunState new_state)
 {
-    if (new_state >= RUN_STATE_MAX ||
-        !runstate_valid_transitions[current_run_state][new_state]) {
-        fprintf(stderr, "invalid runstate transition\n");
+    assert(new_state < RUN_STATE_MAX);
+
+    if (!runstate_valid_transitions[current_run_state][new_state]) {
+        fprintf(stderr, "ERROR: invalid runstate transition: '%s' -> '%s'\n",
+                RunState_lookup[current_run_state],
+                RunState_lookup[new_state]);
         abort();
     }
 
This page took 0.023552 seconds and 4 git commands to generate.