From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129057 invoked by alias); 6 May 2016 12:43:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 129008 invoked by uid 89); 6 May 2016 12:43:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 06 May 2016 12:43:15 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0704C04B303 for ; Fri, 6 May 2016 12:35:21 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u46CZ5IE017259 for ; Fri, 6 May 2016 08:35:21 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v3 17/34] Introduce display_mi_prompt Date: Fri, 06 May 2016 12:43:00 -0000 Message-Id: <1462538104-19109-18-git-send-email-palves@redhat.com> In-Reply-To: <1462538104-19109-1-git-send-email-palves@redhat.com> References: <1462538104-19109-1-git-send-email-palves@redhat.com> X-SW-Source: 2016-05/txt/msg00120.txt.bz2 Just a refactor. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * mi/mi-interp.c (display_mi_prompt): New function. --- gdb/mi/mi-interp.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 8f6a57b..b4d498d 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -88,6 +88,15 @@ static void mi_on_sync_execution_done (void); static int report_initial_inferior (struct inferior *inf, void *closure); +/* Display the MI prompt. */ + +static void +display_mi_prompt (void) +{ + fputs_unfiltered ("(gdb) \n", raw_stdout); + gdb_flush (raw_stdout); +} + /* Returns the INTERP's data cast as mi_interp if INTERP is an MI, and returns NULL otherwise. */ @@ -299,10 +308,7 @@ mi_on_sync_execution_done (void) /* If MI is sync, then output the MI prompt now, indicating we're ready for further input. */ if (!mi_async_p ()) - { - fputs_unfiltered ("(gdb) \n", raw_stdout); - gdb_flush (raw_stdout); - } + display_mi_prompt (); } /* mi_execute_command_wrapper wrapper suitable for INPUT_HANDLER. */ @@ -318,10 +324,7 @@ mi_execute_command_input_handler (char *cmd) 'synchronous_command_done' observer when the target next stops. */ if (!sync_execution) - { - fputs_unfiltered ("(gdb) \n", raw_stdout); - gdb_flush (raw_stdout); - } + display_mi_prompt (); } static void @@ -332,8 +335,7 @@ mi_command_loop (void *data) sevenbit_strings = 1; /* Tell the world that we're alive. */ - fputs_unfiltered ("(gdb) \n", raw_stdout); - gdb_flush (raw_stdout); + display_mi_prompt (); start_event_loop (); } -- 2.5.5