Bug 215816 - Arrow keys no longer works in breakpoint command list
Summary: Arrow keys no longer works in breakpoint command list
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gdb
Version: 5.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jan Kratochvil
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-11-15 21:36 UTC by H.J. Lu
Modified: 2008-05-21 16:54 UTC (History)
4 users (show)

Fixed In Version: RHBA-2008-0332
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-05-21 16:54:59 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
A patch (1021 bytes, patch)
2006-11-21 21:27 UTC, H.J. Lu
no flags Details | Diff
Identical patch but moved into readline(3) (1.02 KB, patch)
2006-11-22 19:44 UTC, Jan Kratochvil
no flags Details | Diff
Testcase (3.35 KB, patch)
2006-11-22 20:17 UTC, Jan Kratochvil
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2008:0332 0 normal SHIPPED_LIVE gdb bug fix and enhancement update 2008-05-20 17:58:35 UTC

Description H.J. Lu 2006-11-15 21:36:00 UTC
In gdb-6.5-12.el5, arrow keys no longer works in breakpoint command list.

[hjl@gnu-26 hist]$ cat x.c
#include <stdio.h>

int
main ()
{
  printf ("hello\n");
  return 0;
}
[hjl@gnu-26 hist]$ gcc -g x.c
[hjl@gnu-26 hist]$ gdb a.out
GNU gdb Red Hat Linux (6.5-12.el5rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...
Using host libthread_db library "/lib64/tls/libthread_db.so.1".
(gdb) p main
$1 = {int ()} 0x400478 <main>
(gdb) b main
Breakpoint 1 at 0x40047c: file x.c, line 6.
(gdb) command 1
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just "end".
> [A[A[A

When I pressed the up arrow key, I only got "[A". With
the older gdb, I got

[hjl@gnu-26 hist]$ old-gdb a.out
GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db
library "/lib64/tls/libthread_db.so.1".

(gdb) p main
$1 = {int ()} 0x400478 <main>
(gdb) b main
Breakpoint 1 at 0x40047c: file x.c, line 6.
(gdb) command 1
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just "end".
> command 1

When I pressed the up arrow key, I got the last command I typed.

Comment 1 H.J. Lu 2006-11-21 18:16:51 UTC
It is caused by

http://sources.redhat.com/ml/gdb-patches/2006-04/msg00122.html

Comment 2 Jan Kratochvil 2006-11-21 19:16:50 UTC
It is present upstream, I already was checking it a bit but so far no fix.
Thanks for the report.


Comment 3 H.J. Lu 2006-11-21 20:28:41 UTC
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.

(top-gdb) bt
#0  _rl_dispatch_subseq (key=27, map=0x8e8920, got_subseq=0)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/readline/readline.c:633
#1  0x000000000056e3f0 in _rl_dispatch (key=27, map=0x8e8920)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/readline/readline.c:529
#2  0x000000000056e2a4 in readline_internal_char ()
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/readline/readline.c:443
#3  0x000000000056e376 in readline_internal_charloop ()
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/readline/readline.c:489
#4  0x000000000056e397 in readline_internal ()
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/readline/readline.c:503
#5  0x000000000056dff0 in readline (prompt=<value optimized out>)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/readline/readline.c:299
#6  0x00000000004446f5 in gdb_readline_wrapper (
    prompt=0x1b <Address 0x1b out of bounds>)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/top.c:731
#7  0x0000000000444a68 in command_line_input (prompt_arg=0x7fbffff0c0 ">", 
    repeat=1, annotation_suffix=0x60419e "commands")
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/top.c:922
#8  0x00000000004770d1 in read_next_line (command=0x7fbffff200)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/cli/cli-script.c:734
#9  0x00000000004775a6 in read_command_lines (
    prompt_arg=<value optimized out>, from_tty=1)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/cli/cli-script.c:957
---Type <return> to continue, or q <return> to quit---
#10 0x000000000048cd97 in commands_command (arg=<value optimized out>, 
    from_tty=1) at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/breakpoint.c:622
#11 0x000000000047434f in do_cfunc (c=0x16, 
    args=0x1b <Address 0x1b out of bounds>, from_tty=1)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/cli/cli-decode.c:57
#12 0x00000000004762f0 in cmd_func (cmd=0x92d140, args=0x90e108 "1", 
    from_tty=1)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/cli/cli-decode.c:1631
#13 0x0000000000444178 in execute_command (p=0x90e108 "1", from_tty=1)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/top.c:452
#14 0x00000000004d4de5 in command_handler (command=0x90e100 "command 1")
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/event-top.c:512
#15 0x00000000004d5501 in command_line_handler (rl=0x9b6b40 "\220l\233")
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/event-top.c:797
#16 0x000000000057dbc4 in rl_callback_read_char ()
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/readline/callback.c:123
#17 0x00000000004d45e9 in rl_callback_read_char_wrapper (client_data=0x1b)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/event-top.c:178
#18 0x00000000004d4cab in stdin_event_handler (error=<value optimized out>, 
    client_data=0x8e8920)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/event-top.c:428
#19 0x00000000004d3bc2 in handle_file_event (
    event_file_desc=<value optimized out>)
---Type <return> to continue, or q <return> to quit---
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/event-loop.c:730
#20 0x00000000004d354d in process_event ()
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/event-loop.c:343
#21 0x00000000004d3596 in gdb_do_one_event (data=<value optimized out>)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/event-loop.c:380
#22 0x00000000004d0b9e in catch_errors (func=0x4d356c <gdb_do_one_event>, 
    func_args=0x0, errstring=0x5fab65 "", mask=<value optimized out>)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/exceptions.c:515
#23 0x00000000004835c0 in tui_command_loop (data=<value optimized out>)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/tui/tui-interp.c:151
#24 0x00000000004d101b in current_interp_command_loop ()
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/interps.c:278
#25 0x000000000043f109 in captured_command_loop (data=0x1b)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/main.c:101
#26 0x00000000004d0b9e in catch_errors (func=0x43f100 <captured_command_loop>, 
    func_args=0x0, errstring=0x5fab65 "", mask=<value optimized out>)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/exceptions.c:515
#27 0x000000000043fe19 in captured_main (data=<value optimized out>)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/main.c:834
#28 0x00000000004d0b9e in catch_errors (func=0x43f13d <captured_main>, 
    func_args=0x7fbffff6a0, errstring=0x5fab65 "", mask=<value optimized out>)
    at /net/gnu-13/export/gnu/src/gdb-next/gdb/gdb/exceptions.c:515
#29 0x000000000043fe3f in gdb_main (args=0x8e8920)


Comment 5 H.J. Lu 2006-11-21 21:27:44 UTC
Created attachment 141834 [details]
A patch

This kludge seems to work for me.

Comment 6 Jan Kratochvil 2006-11-22 19:44:30 UTC
Created attachment 141930 [details]
Identical patch but moved into readline(3)

Thanks very much for even bugfixing it, together with the RHEL5 testing.

I believe it would be fine to move it into readline(3) itself, wouldn't be?
Sending to upstream <bug-readline> as you already posted it to gdb.

Comment 8 Andrew Cagney 2006-11-22 20:02:26 UTC
Regression from RHEL 4.
Fix available, and hand tested.  Will add .exp test case.


Comment 9 Jan Kratochvil 2006-11-22 20:17:37 UTC
Created attachment 141935 [details]
Testcase

Comment 10 Jan Kratochvil 2006-11-25 18:30:56 UTC
Upstream responded that it probably went to readline-upstream, to commit the
H.J.Lu's patch there:

On Fri, 24 Nov 2006 02:46:22 +0100, Chet Ramey wrote:
> Thanks.  The patch seems reasonable, but I'm wondering what other
> gotchas there will be when mixing the callback and non-callback
> styles.  Frankly, I'm surprised it worked to begin with.
>
> The changes to add more state to readline to deal with callbacks and
> the functions that require state (e.g., incremental search) are probably
> what uncovered this problem.


Comment 12 James Laska 2006-12-13 21:11:04 UTC
jkratoch: can you describe the impact if we go to GA without this fix?  What is
lost, what will customers be unable to do?

Comment 13 Jan Kratochvil 2006-12-13 21:18:29 UTC
Not much, highly experienced gdb users will have command history unavailable for
some rare commands.
This bug was present upstream unnoticed for almost a year.


Comment 14 Jay Turner 2006-12-14 02:19:19 UTC
My suggestion would be to delay until 5.1.

Comment 15 RHEL Program Management 2006-12-14 02:27:57 UTC
This bugzilla has Keywords: Regression.  

Since no regressions are allowed between releases, 
it is also being proposed as a blocker for this release.  

Please resolve ASAP.

Comment 16 Andrew Cagney 2006-12-21 19:40:13 UTC
Per recommendations, upstream and users not noticed bug for >year so not
critical, marking for 5.1


Comment 17 Jan Kratochvil 2006-12-29 20:41:59 UTC
Last patch posted upstream:
http://sourceware.org/ml/gdb-patches/2006-12/msg00319.html

The patch currently in RawHide is a very trivia one:
* Sat Nov 25 2006 Jan Kratochvil <jan.kratochvil> - 6.5-18
- Fix readline history for input mode commands like `command' (BZ 215816).

and while it is apparently broken no regressions are detectable for me.

Suspended until there will be a RawHide/FC7 bugreport or RHEL5.1 comes close.


Comment 18 Jan Kratochvil 2007-01-11 22:21:32 UTC
http://sources.redhat.com/ml/gdb-patches/2007-01/msg00079.html

Update in RawHide with Jacobowitz's fixed version:
* Thu Jan 11 2007 Jan Kratochvil <jan.kratochvil> - 6.5-24
- Backport readline history for input mode commands like `command' (BZ 215816).


Comment 19 Jan Kratochvil 2007-02-25 18:13:02 UTC
Closing as RawHide as it is not serious enough for RHEL backport without a
customer Issue Tracker entry and the fix may also have unforeseen regressions.


Comment 20 Jan Kratochvil 2007-02-25 18:14:41 UTC
Reopening as a regression from RHEL 4 - therefore it makes sense for a RHEL5
backport.


Comment 30 Jan Kratochvil 2007-06-26 13:15:29 UTC
Another patch (rl_readline_unwind()) posted upstream:
http://sources.redhat.com/ml/gdb-patches/2007-06/msg00458.html


Comment 33 RHEL Program Management 2007-12-13 18:36:42 UTC
This bugzilla has Keywords: Regression.  

Since no regressions are allowed between releases, 
it is also being proposed as a blocker for this release.  

Please resolve ASAP.

Comment 35 Fedora Update System 2007-12-23 22:51:48 UTC
gdb-6.6-38.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 36 Jan Kratochvil 2007-12-23 22:56:24 UTC
It should not have been closed for RHEL by Fedora (in COmment 35).


Comment 37 Fedora Update System 2007-12-26 23:52:04 UTC
gdb-6.6-38.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 42 errata-xmlrpc 2008-05-21 16:54:59 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0332.html



Note You need to log in before you can comment on or make changes to this bug.