From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79963 invoked by alias); 6 May 2016 12:35:37 -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 79860 invoked by uid 89); 6 May 2016 12:35:36 -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=userdefined, user-defined 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:35:25 +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 6CDC4627DC for ; Fri, 6 May 2016 12:35:24 +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 u46CZ5IH017259 for ; Fri, 6 May 2016 08:35:23 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v3 20/34] Make gdb_in_secondary_prompt_p() be per UI Date: Fri, 06 May 2016 12:35:00 -0000 Message-Id: <1462538104-19109-21-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/msg00103.txt.bz2 gdb/ChangeLog: yyyy-mm-dd Pedro Alves * top.c (gdb_secondary_prompt_depth): Delete. (gdb_in_secondary_prompt_p): Add ui parameter. Use it. (gdb_readline_wrapper_cleanup, gdb_readline_wrapper): Adjust to per-UI gdb_secondary_prompt_depth. * top.h (struct ui) : New field. --- gdb/top.c | 15 +++++---------- gdb/top.h | 9 +++++++-- gdb/tui/tui-io.c | 4 ++-- gdb/tui/tui.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gdb/top.c b/gdb/top.c index 7e82dcf..79f4293 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -757,17 +757,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; } @@ -828,8 +823,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; @@ -859,7 +854,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 3447a2f..efe97b1 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -73,6 +73,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 @@ -190,9 +194,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 6f2d892..ed79b44 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -212,7 +212,7 @@ tui_redisplay_readline (void) The command could call prompt_for_continue and we must not restore SingleKey so that the prompt and normal keymap are used. */ if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0 - && !gdb_in_secondary_prompt_p ()) + && !gdb_in_secondary_prompt_p (current_ui)) tui_set_key_mode (TUI_SINGLE_KEY_MODE); if (tui_current_key_mode == TUI_SINGLE_KEY_MODE) @@ -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); diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 96f8df7..d67cfd9 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -304,7 +304,7 @@ tui_rl_startup_hook (void) { rl_already_prompted = 1; if (tui_current_key_mode != TUI_COMMAND_MODE - && !gdb_in_secondary_prompt_p ()) + && !gdb_in_secondary_prompt_p (current_ui)) tui_set_key_mode (TUI_SINGLE_KEY_MODE); tui_redisplay_readline (); return 0; -- 2.5.5