gdb/readline-callback.diff

55 lines
1.5 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From nobody Sun Dec 3 11:01:14 2006
From: "H. J. Lu" <hjl@lucon.org>
Subject: PATCH: PR tui/2173: Arrow keys no longer works in breakpoint command list
To: GDB <gdb-patches@sources.redhat.com>
Date: Tue, 21 Nov 2006 13:32:05 -0800
The problem is callback in readline 5.1 is changed. When gdb readline
callback calls readline (), readline is really confused since although
it is called from gdb callback, it isn't really in callback state. This
kludge seems to work for me.
H.J.
----
2006-11-21 H.J. Lu <hongjiu.lu@intel.com>
PR tui/2173
* top.c (gdb_readline_wrapper): Unset and reset RL_STATE_CALLBACK
around readline if needed.
--- gdb/top.c.arrow 2006-07-21 07:46:53.000000000 -0700
+++ gdb/top.c 2006-11-21 13:20:04.000000000 -0800
@@ -724,6 +724,9 @@ The filename in which to record the comm
char *
gdb_readline_wrapper (char *prompt)
{
+ char *line;
+ int in_callback;
+
/* Set the hook that works in this case. */
if (after_char_processing_hook)
{
@@ -731,7 +734,19 @@ gdb_readline_wrapper (char *prompt)
after_char_processing_hook = NULL;
}
- return readline (prompt);
+ /* When we call readline, we have to make sure that readline isn't in
+ the callback state. Otherwise, it will get really confused.
+ PR tui/2173. */
+ in_callback = RL_ISSTATE (RL_STATE_CALLBACK);
+ if (in_callback)
+ RL_UNSETSTATE (RL_STATE_CALLBACK);
+
+ line = readline (prompt);
+
+ if (in_callback)
+ RL_SETSTATE (RL_STATE_CALLBACK);
+
+ return line;
}