From: Jimmy Guo <guo@cup.hp.com>
To: Elena Zannoni <ezannoni@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH 1 of 2] readline rl_prompt corruption fix
Date: Tue, 01 Aug 2000 10:33:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.10.10008011018230.1500-100000@hpcll168.cup.hp.com> (raw)
In-Reply-To: <14727.1571.65160.775918@kwikemart.cygnus.com>
>In general patches to readline should be sent to the official
>readline maintainer, Chet Ramey. ftp://ftp.cwru.edu/pub/bash/ We don't
>want to diverge from the official readline release unless absolutely
>necessary.
Thanks for the info. I will work with Chet Ramey once we agree if this
is something that we need to patch readline up.
>In any event, I am sligltly confused about the 2 patches.
>What was the original problem? The positioning of the cursor in the TUI?
>Can you explain a little more?
GDB (event-top.c, couple of places) calls rl_callback_install to set the
prompt and the callback function. In one place the prompt string is
allocated via malloc, in another it's allocated via alloca. Today,
readline use the passed in prompt parameter directly and assign the
pointer value to rl_prompt, a global -- no matter what this
implementation is questionable, since it should save a copy itself.
In the TUI mode, TUI code does strlen (rl_prompt) when handling arrow
key input events. Unfortunately rl_prompt can be corrupted if it was
originally from one of the event-top.c callback install which uses
alloca(), and the behavior would be when a user presses arrow keys in
TUI mode to browse source listings, cursor placement will become random.
There are several ways to fix it, some with side effects like memory
leaks (which exist in today's gdb BTW wrt the malloc'd prompt), others
with changes to probably the tui code to use the prompt length
calculated by readline, etc. However, I think the way readline handles
passed in prompt is inviting trouble, and fixing that is probably the
most appropriate approach.
- Jimmy
prev parent reply other threads:[~2000-08-01 10:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.10.10007281012060.7566-100000@hpcll168.cup.hp.com>
2000-08-01 10:17 ` Elena Zannoni
2000-08-01 10:33 ` Jimmy Guo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.10.10008011018230.1500-100000@hpcll168.cup.hp.com \
--to=guo@cup.hp.com \
--cc=ezannoni@cygnus.com \
--cc=gdb-patches@sourceware.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox