From: Matt Rice <ratmice@gmail.com>
To: pmuldoon@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] python prompt additions at first prompt.
Date: Mon, 01 Aug 2011 14:08:00 -0000 [thread overview]
Message-ID: <CACTLOFpdN0PmtsfcUn=WDFUEFnRUFJzWP6G3tmYb4_mPkGZjhA@mail.gmail.com> (raw)
In-Reply-To: <m3ei15sbnl.fsf@redhat.com>
On Mon, Aug 1, 2011 at 2:50 AM, Phil Muldoon <pmuldoon@redhat.com> wrote:
> Matt Rice <ratmice@gmail.com> writes:
>
>> little bug with the new python prompt stuff, the prompt_hook doesn't
>> take effect until the second prompt.
>
> Thanks for doing this. This looks fine to me, apart from one question.
>
> For tests, there are prompt tests in the python.exp file for prompt
> substitutions. For passing arguments to GDB at start-up, see usage of
> $GDBFLAGS in the testsuite.
I'd tried that, but didn't have much luck,
i'll give it another shot.
>> - prompt, otherwise just print the prompt. */
>> - if (async_command_editing_p)
>> - {
>> - int length;
>> - char *a_prompt;
>> - char *gdb_prompt = get_prompt (0);
>> -
>> - /* Tell readline what the prompt to display is and what function
>> - it will need to call after a whole line is read. This also
>> - displays the first prompt. */
>> - length = strlen (get_prefix (0))
>> - + strlen (gdb_prompt) + strlen (get_suffix(0)) + 1;
>> - a_prompt = (char *) alloca (length);
>> - strcpy (a_prompt, get_prefix (0));
>> - strcat (a_prompt, gdb_prompt);
>> - strcat (a_prompt, get_suffix (0));
>> - rl_callback_handler_install (a_prompt, input_handler);
>> - }
>> - else
>> - display_gdb_prompt (0);
>> + display_gdb_prompt (0);
>
>
> display_gdb_prompt removes any handler that is present, and then
> installs a handler. As this is the first prompt, the above code does
> not (because there could not have been a handler installed). I think
> attempting to remove a handler that does not exist just results in a
> NOOP, but it is worth checking. I know very little about readline,
> however. So my question is: with GDB's copy of readline, is this okay?
Yes, the effect of it seems to turn zero's into zero's.
by my reading and valgrind, it seems fine,
the documentation doesn't specify one way or the other though.
If it is deemed not OK, it needs to be handled in display_gdb_prompt regardless,
because gdb -ex 'set editing off' ' followed by a 'set editing on', at
the gdb prompt, results in 2 calls to _remove before the callback is
installed
from display_gdb_prompt, and change_line_handler.
next prev parent reply other threads:[~2011-08-01 14:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-30 22:20 Matt Rice
2011-08-01 9:51 ` Phil Muldoon
2011-08-01 14:08 ` Matt Rice [this message]
2011-08-01 14:13 ` Phil Muldoon
2011-08-01 17:44 ` Matt Rice
2011-08-02 9:07 ` Phil Muldoon
2011-08-02 17:59 ` Matt Rice
2011-08-02 20:37 ` Phil Muldoon
2011-08-03 18:08 ` Tom Tromey
2011-08-09 0:20 ` Matt Rice
2011-08-09 0:25 ` Matt Rice
2011-08-10 15:21 ` Tom Tromey
2011-08-11 12:03 ` Matt Rice
2011-08-12 13:10 ` Matt Rice
2011-08-12 14:44 ` Pedro Alves
2011-08-12 15:07 ` Matt Rice
2011-08-29 16:23 ` Matt Rice
2011-08-29 16:39 ` Pedro Alves
2011-09-02 14:31 ` Pedro Alves
2011-09-02 21:41 ` Matt Rice
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='CACTLOFpdN0PmtsfcUn=WDFUEFnRUFJzWP6G3tmYb4_mPkGZjhA@mail.gmail.com' \
--to=ratmice@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=pmuldoon@redhat.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