From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:46551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGVhf-0007Fw-Np for qemu-devel@nongnu.org; Wed, 19 Oct 2011 08:57:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGVhe-0007nx-7M for qemu-devel@nongnu.org; Wed, 19 Oct 2011 08:57:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16027) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGVhd-0007nl-T9 for qemu-devel@nongnu.org; Wed, 19 Oct 2011 08:57:02 -0400 From: Luiz Capitulino Date: Wed, 19 Oct 2011 10:56:48 -0200 Message-Id: <1319029011-11706-3-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1319029011-11706-1-git-send-email-lcapitulino@redhat.com> References: <1319029011-11706-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 2/5] runstate: Print state transition when invalid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com Cc: qemu-devel@nongnu.org Makes it easier to debug. Signed-off-by: Luiz Capitulino --- vl.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/vl.c b/vl.c index 2dce3ae..2a634a7 100644 --- 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(); } -- 1.7.7.rc3