Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Substitute '\' with '\\' in extended-prompt
Date: Fri, 17 Oct 2014 08:28:00 -0000	[thread overview]
Message-ID: <5440D315.5030200@redhat.com> (raw)
In-Reply-To: <87tx33l4l6.fsf@codesourcery.com>

On 17/10/14 05:09, Yao Qi wrote:
>
> Hi Phil,
> Why do we do the substitute in extended-prompt in your extended-prompt
> patch <https://sourceware.org/ml/gdb-patches/2011-08/msg00236.html> as
> below?
>
>> +    def before_prompt_hook(self, current):
>> +        if self.value is not '':
>> +            newprompt = gdb.prompt.substitute_prompt(self.value)
>> +            return newprompt.replace('\\', '\\\\')
>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> +        else:
>> +            return None
>
> I don't see any explanations on this in comments or email.

The lacks of a comment really bothers me!  The short answer is I can't
remember why this is needed.  I think it likely that if "\\" is passed
to readline it is parsed out.

See from the documentation:

+@item @var{\\}
+Substitute a backslash.

So the additional escape sequences are needed (for readline) after the
prompt command substitution.  I think if memory serves, to escape an
escape character, you need the four "\"'s but in the prompt command
language we only specify two.

However I have not looked at it in detail yet, but that is my first
guess. If you remove it, do the Python prompt tests fail?  I'll do
some archaeology and try to find out why today.  However, if it is
blocking your work, and without the substitution all the tests still
pass, then I would suggest we remove it for now.  We can always add it
back, and the next release of GDB is not terribly soon.

Cheers

Phil





  reply	other threads:[~2014-10-17  8:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17  4:13 Yao Qi
2014-10-17  8:28 ` Phil Muldoon [this message]
2014-10-17 11:23   ` Yao Qi
2014-10-22 13:01     ` [PATCH] Don't replace '\' with '\\' in before_prompt_hook Yao Qi
2014-10-29 14:23       ` Yao Qi
2014-10-29 14:34         ` Phil Muldoon
2014-10-29 14:39           ` Phil Muldoon
2014-10-29 23:37             ` Yao Qi
2014-10-30  1:48               ` Yao Qi

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=5440D315.5030200@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.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