From patchwork Mon Mar 21 15:21:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 11439 Received: (qmail 128835 invoked by alias); 21 Mar 2016 15:29:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 128815 invoked by uid 89); 21 Mar 2016 15:29:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sourcing 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; Mon, 21 Mar 2016 15:29:33 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 1B3AFC01B3E0 for ; Mon, 21 Mar 2016 15:21:34 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2LFLGPj019569 for ; Mon, 21 Mar 2016 11:21:33 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 17/25] Make gdb_in_secondary_prompt_p() be per UI Date: Mon, 21 Mar 2016 15:21:07 +0000 Message-Id: <1458573675-15478-18-git-send-email-palves@redhat.com> In-Reply-To: <1458573675-15478-1-git-send-email-palves@redhat.com> References: <1458573675-15478-1-git-send-email-palves@redhat.com> --- gdb/top.c | 15 +++++---------- gdb/top.h | 9 +++++++-- gdb/tui/tui-io.c | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gdb/top.c b/gdb/top.c index 56e21b1..dfbd911 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -743,17 +743,12 @@ static char *gdb_readline_wrapper_result; static void (*saved_after_char_processing_hook) (void); -/* The number of nested readline secondary prompts that are currently - active. */ - -static int gdb_secondary_prompt_depth = 0; - /* See top.h. */ int -gdb_in_secondary_prompt_p (void) +gdb_in_secondary_prompt_p (struct ui *ui) { - return gdb_secondary_prompt_depth > 0; + return ui->secondary_prompt_depth > 0; } @@ -814,8 +809,8 @@ gdb_readline_wrapper_cleanup (void *arg) gdb_readline_wrapper_result = NULL; gdb_readline_wrapper_done = 0; - gdb_secondary_prompt_depth--; - gdb_assert (gdb_secondary_prompt_depth >= 0); + ui->secondary_prompt_depth--; + gdb_assert (ui->secondary_prompt_depth >= 0); after_char_processing_hook = saved_after_char_processing_hook; saved_after_char_processing_hook = NULL; @@ -845,7 +840,7 @@ gdb_readline_wrapper (const char *prompt) cleanup->target_is_async_orig = target_is_async_p (); - gdb_secondary_prompt_depth++; + ui->secondary_prompt_depth++; back_to = make_cleanup (gdb_readline_wrapper_cleanup, cleanup); if (cleanup->target_is_async_orig) diff --git a/gdb/top.h b/gdb/top.h index de396a6..e43875e 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -72,6 +72,10 @@ struct ui "start" -ex "next"') are processed. */ int async; + /* The number of nested readline secondary prompts that are + currently active. */ + int secondary_prompt_depth; + /* stdio stream that command input is being read from. Set to stdin normally. Set by source_command to the file we are sourcing. Set to NULL if we are executing a user-defined command or @@ -176,9 +180,10 @@ extern char *get_prompt (void); by gdb for its command prompt. */ extern void set_prompt (const char *s); -/* Return 1 if the current input handler is a secondary prompt, 0 otherwise. */ +/* Return 1 if UI's current input handler is a secondary prompt, 0 + otherwise. */ -extern int gdb_in_secondary_prompt_p (void); +extern int gdb_in_secondary_prompt_p (struct ui *ui); /* From random places. */ extern int readnow_symbol_files; diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index c00ec46..3d5d327 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -585,7 +585,7 @@ tui_getc (FILE *fp) with empty lines with gdb prompt at beginning. Instead of that, stay on the same line but provide a visual effect to show the user we recognized the command. */ - if (rl_end == 0 && !gdb_in_secondary_prompt_p ()) + if (rl_end == 0 && !gdb_in_secondary_prompt_p (current_ui)) { wmove (w, getcury (w), 0);