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.
It is caused by http://sources.redhat.com/ml/gdb-patches/2006-04/msg00122.html
It is present upstream, I already was checking it a bit but so far no fix. Thanks for the report.
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)
Here is the gdb PR: http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2173&return_url=http%3A%2F%2Fsources.redhat.com%2Fcgi-bin%2Fgnatsweb.pl%3Fdatabase%3Dgdb%26category%3Dall%26severity%3Dall%26priority%3Dall%26responsible%3Dall%26submitter_id%3Dall%26state%3Dall%26ignoreclosed%3DIgnore%2520Closed%26class%3Dall%26synopsis%3D%26multitext%3D%26originatedbyme%3DOriginated%2520by%2520You%26columns%3Dcategory%26columns%3Dstate%26columns%3Dclass%26columns%3Dresponsible%26columns%3Dsynopsis%26displaydate%3DDisplay%2520Current%2520Date%26cmd%3Dsubmit%2520query%26sortby%3DResponsible%26.cgifields%3Ddisplaydate%26.cgifields%3Dignoreclosed%26.cgifields%3Doriginatedbyme%26.cgifields%3Dcolumns
Created attachment 141834 [details] A patch This kludge seems to work for me.
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.
Regression from RHEL 4. Fix available, and hand tested. Will add .exp test case.
Created attachment 141935 [details] Testcase
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.
jkratoch: can you describe the impact if we go to GA without this fix? What is lost, what will customers be unable to do?
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.
My suggestion would be to delay until 5.1.
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.
Per recommendations, upstream and users not noticed bug for >year so not critical, marking for 5.1
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.
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).
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.
Reopening as a regression from RHEL 4 - therefore it makes sense for a RHEL5 backport.
Another patch (rl_readline_unwind()) posted upstream: http://sources.redhat.com/ml/gdb-patches/2007-06/msg00458.html
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.
It should not have been closed for RHEL by Fedora (in COmment 35).
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