From: Ton van Overbeek <v-overbeek@cistron.nl>
To: <gdb-patches@sources.redhat.com>, <stcarrez@nerim.fr>
Subject: [PATCH]: TUI, secondary prompts do not work
Date: Tue, 01 Oct 2002 07:03:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.33.0210011558390.4999-200000@picard.cistron.nl> (raw)
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1712 bytes --]
I have been following the TUI developments on the gdb-5.3 branch.
My interest is in using TUI for a cross debugger (m68k-palmos, see
http://prc-tools.sourceforge.net).
I found some problems with the current state of the TUI.
This post is concerned with secondary prompts.
When tui is active, secondary prompts do not work.
Try to do a command with many lines of output, i.e. 'show copying'.
You will not get the '---Type <return> to continue, or q <return> to quit---'
prompt, but just the normal (gdb) prompt.
Same is true when prompting for commands in the 'commands' command
for commands to be executed at a breakpoint.
Tui relies on the prompt stack. However this stack is not used
for these cases. I 'fixed' it by adding a push_prompt/pop_prompt
pair around the readline() call in gdb_readline_wrapper.
Also had to fix the pop_prompt logic for the changing annotation level
case as a consequence.
I do not know if this has repercussions in other areas of gdb, so I
happily accept criticisms or proposals to fix this in a better way.
Here is the Changelog entry for my fix (and patch attached).
Diff is against the branch snapshot from today (2002-10-01).
2002-10-01 Ton van Overbeek (v-overbeek@cistron.nl)
* event-top.h: Introduced change_annotation_level parameter to
pop_prompt ().
* event-top.c (pop_prompt): Added change_annotation_level parameter.
(change_annotation_level, async_enable_stdin, command_line_handler):
Use new parameter in pop_prompt.
* top.c (gdb_readline_wrapper): Added push-prompt/pop_prompt pair
around readline call for tui secondary prompts to work.
I hope this patch is accepted. If I need to complete a copyright
assignment for this, let me know.
Ton van Overbeek
[-- Attachment #2: Type: TEXT/PLAIN, Size: 2639 bytes --]
--- event-top.c.orig 2002-07-03 22:27:12.000000000 +0200
+++ event-top.c 2002-09-22 12:39:54.000000000 +0200
@@ -350,7 +350,7 @@ change_annotation_level (void)
if (strcmp (PREFIX (0), "") && strcmp (SUFFIX (0), ""))
{
/* Pop the top of the stack, we are going back to annotation < 1. */
- pop_prompt ();
+ pop_prompt (1);
}
}
}
@@ -378,11 +378,11 @@ push_prompt (char *prefix, char *prompt,
/* Pops the top of the prompt stack, and frees the memory allocated for it. */
void
-pop_prompt (void)
+pop_prompt (int change_annotation_level)
{
/* If we are not during a 'synchronous' execution command, in which
case, the top prompt would be empty. */
- if (strcmp (PROMPT (0), ""))
+ if (change_annotation_level && strcmp (PROMPT (0), ""))
/* This is for the case in which the prompt is set while the
annotation level is 2. The top prompt will be changed, but when
we return to annotation level < 2, we want that new prompt to be
@@ -430,7 +430,7 @@ async_enable_stdin (void *dummy)
sync_execution. Current target_terminal_ours() implementations
check for sync_execution before switching the terminal. */
target_terminal_ours ();
- pop_prompt ();
+ pop_prompt (0);
sync_execution = 0;
}
@@ -636,7 +636,7 @@ command_line_handler (char *rl)
p = readline_input_state.linebuffer_ptr;
xfree (readline_input_state.linebuffer);
more_to_come = 0;
- pop_prompt ();
+ pop_prompt (0);
}
#ifdef STOP_SIGNAL
--- event-top.h.orig 2001-11-27 05:15:10.000000000 +0100
+++ event-top.h 2002-09-22 12:37:44.000000000 +0200
@@ -88,7 +88,7 @@ extern void handle_stop_sig (int sig);
#endif
#endif
extern void handle_sigint (int sig);
-extern void pop_prompt (void);
+extern void pop_prompt (int change_annotation_level);
extern void push_prompt (char *prefix, char *prompt, char *suffix);
extern void gdb_readline2 (void *client_data);
extern void mark_async_signal_handler_wrapper (void *token);
--- top.c.orig 2002-09-15 01:32:00.000000000 +0200
+++ top.c 2002-09-22 12:42:16.000000000 +0200
@@ -960,6 +960,8 @@ static char *history_filename;
char *
gdb_readline_wrapper (char *prompt)
{
+ char *ret;
+
/* Set the hook that works in this case. */
if (event_loop_p && after_char_processing_hook)
{
@@ -967,7 +969,11 @@ gdb_readline_wrapper (char *prompt)
after_char_processing_hook = NULL;
}
- return readline (prompt);
+ push_prompt ("", prompt, "");
+ ret = readline (prompt);
+ pop_prompt (0);
+
+ return ret;
}
\f
next reply other threads:[~2002-10-01 14:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-01 7:03 Ton van Overbeek [this message]
2002-10-26 3:51 ` Stephane Carrez
2002-10-28 13:49 ` Ton van Overbeek
2002-10-29 8:03 ` Christopher Faylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.33.0210011558390.4999-200000@picard.cistron.nl \
--to=v-overbeek@cistron.nl \
--cc=gdb-patches@sources.redhat.com \
--cc=stcarrez@nerim.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox