Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH]: TUI, secondary prompts do not work
@ 2002-10-01  7:03 Ton van Overbeek
  2002-10-26  3:51 ` Stephane Carrez
  0 siblings, 1 reply; 4+ messages in thread
From: Ton van Overbeek @ 2002-10-01  7:03 UTC (permalink / raw)
  To: gdb-patches, stcarrez

[-- 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: TUI, secondary prompts do not work
  2002-10-01  7:03 [PATCH]: TUI, secondary prompts do not work Ton van Overbeek
@ 2002-10-26  3:51 ` Stephane Carrez
  2002-10-28 13:49   ` Ton van Overbeek
  0 siblings, 1 reply; 4+ messages in thread
From: Stephane Carrez @ 2002-10-26  3:51 UTC (permalink / raw)
  To: Ton van Overbeek; +Cc: gdb-patches

Hi Ton,

Ton van Overbeek wrote:

> 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).
> 


Thanks for the report.

It was a bug in the TUI and not in the way gdb manages prompts.
See http://sources.redhat.com/ml/gdb-patches/2002-10/msg00561.html

	Stephane

-----------------------------------------------------------------------
         Home                               Office
E-mail: stcarrez@nerim.fr                  Stephane.Carrez@solsoft.fr
WWW:    http://stcarrez.nerim.net          http://www.solsoft.com
         Free the Software!                 Visual Security Policy Management



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: TUI, secondary prompts do not work
  2002-10-26  3:51 ` Stephane Carrez
@ 2002-10-28 13:49   ` Ton van Overbeek
  2002-10-29  8:03     ` Christopher Faylor
  0 siblings, 1 reply; 4+ messages in thread
From: Ton van Overbeek @ 2002-10-28 13:49 UTC (permalink / raw)
  To: Stephane Carrez; +Cc: gdb-patches

At 14:50 10/26/2002 +0200, Stephane Carrez wrote:

>Thanks for the report.
>
>It was a bug in the TUI and not in the way gdb manages prompts.
>See http://sources.redhat.com/ml/gdb-patches/2002-10/msg00561.html

Checked your fix, and I can confirm it fixes the problem.
It is (as expected) a much better fix than the one I proposed.
Merci beaucoup for including it on both main-line and 5.3 branch.

I still have some other TUI problems I am working on. These are:
- configure test should check for (n)curses when --enable-tui
  (now it also accepts termcap). Cygwin check for (n)curses is wrong
  and produces the wrong Makefile (links with -ltermcap instear of -lncurses).
- first TUI screen (after starting gdb and entering tui with C-X A)
  is garbled. Needs a 'refresh' command to draw correctly.
- changing window heights with 'wh' works only partially because
  command window is not treated correctly (Curses info for command window
  is not updated).
- Handling of terminal window resize (SIGWINCH) not working on Cygwin.

All these are on a Cygwin system.

As soon as I have some more concrete info and fixes I'll report back.

Ton van Overbeek


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: TUI, secondary prompts do not work
  2002-10-28 13:49   ` Ton van Overbeek
@ 2002-10-29  8:03     ` Christopher Faylor
  0 siblings, 0 replies; 4+ messages in thread
From: Christopher Faylor @ 2002-10-29  8:03 UTC (permalink / raw)
  To: gdb-patches

On Mon, Oct 28, 2002 at 10:49:50PM +0100, Ton van Overbeek wrote:
>At 14:50 10/26/2002 +0200, Stephane Carrez wrote:
>
>>Thanks for the report.
>>
>>It was a bug in the TUI and not in the way gdb manages prompts.
>>See http://sources.redhat.com/ml/gdb-patches/2002-10/msg00561.html
>
>Checked your fix, and I can confirm it fixes the problem.
>It is (as expected) a much better fix than the one I proposed.
>Merci beaucoup for including it on both main-line and 5.3 branch.
>
>I still have some other TUI problems I am working on. These are:
>- configure test should check for (n)curses when --enable-tui
>  (now it also accepts termcap). Cygwin check for (n)curses is wrong
>  and produces the wrong Makefile (links with -ltermcap instear of -lncurses).
>- first TUI screen (after starting gdb and entering tui with C-X A)
>  is garbled. Needs a 'refresh' command to draw correctly.
>- changing window heights with 'wh' works only partially because
>  command window is not treated correctly (Curses info for command window
>  is not updated).
>- Handling of terminal window resize (SIGWINCH) not working on Cygwin.

It should work correctly in Cygwin 1.3.14.

cgf


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-29 16:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-01  7:03 [PATCH]: TUI, secondary prompts do not work Ton van Overbeek
2002-10-26  3:51 ` Stephane Carrez
2002-10-28 13:49   ` Ton van Overbeek
2002-10-29  8:03     ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox