This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR tui/2173: Arrow keys no longer works in breakpoint command list


Hi,

Chet, the patch would be ported later from the current GDB readline-5.1 to 5.2.


On Mon, 04 Jun 2007 03:06:33 +0200, Daniel Jacobowitz wrote:
> On Mon, Jun 04, 2007 at 10:54:25AM +1200, Nick Roberts wrote:
> > 
> > This change breaks the behaviour of annotations with commands that span
> > multiple lines, like if, while, etc:
> 
> Sorry, I didn't even know we had special annotations for this (and the
> testsuite must not cover it).  I'm not sure how to fix it, either -
> the patch you cited was very tricky to come up with already :-(

The regression happened as the patch was very complex:
	http://sourceware.org/ml/gdb-cvs/2007-01/msg00022.html

The synchronous readline() call has no asynchronous counterpart in libreadline.
Any asynchronous readline() emulation on top of the current libreadline API may
work but it is hard to make it precisely backward compatible.

Facts review:

* longjmp() out of readline() is so far documented API usage of libreadline:
  	@node Readline Signal Handling
  	If the application's signal handler does more than update its idea of
  	the terminal size and return (for example, a @code{longjmp} back to
  	a main processing loop),

* Application (GDB) cannot maintain the RL_STATE_CALLBACK flag as it is
  undocumented and therefore internal to libreadline.

* Any (non-unwinder) based libreadline code cannot set the RL_STATE_CALLBACK
  flag properly as it cannot find if the application longjmp()ed into a stack
  depth originally being in callback or non-callback mode.  Proof pseudocode:
  	http://sources.redhat.com/ml/gdb-patches/2006-12/msg00224.html

Multiple solutions exist:

(1) Code a new libreadline API function readline_async() which will try to
    be backward compatible with readline().
    - Such function complies with active RL_STATE_CALLBACK requreiment but
      a synchronous function would better fit the current use in GDB.

(2) Provide a new documented way to abort readline() from a signal handler.
    Provided rl_readline_unwind() needed to be called right before longjmp().
    Proposed, patch attached.
    + Fully crossplatform, backward compatible.
    + Not affecting most of the apps as they do not longjmp() out of readline().
    - New libreadline API function.

(3) Provide C++ try/catch handling (attached, GDB -lstd++ needed, deprecated).
    + Transparent to the application.
    - libreadline.a has no backward compatible linking (-lstdc++ is needed)
    - Systems without C++ will link but the current bug remains present there.

(4) Custom C based unwinder registration (such as C++ but without -lstdc++)
    - gcc dependent, generally noncrossplatform.


Regards,
Jan

Attachment: gdb-cvs-readline-sync-by-rl_readline_unwind.patch
Description: Proposed patch implementing rl_readline_unwind().

Attachment: gdb-cvs-readline-async-revert.patch
Description: Revert of the so far committed patch.

Attachment: readline-c++.patch
Description: Preview of the deprecated C++ libreadline patch.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]