This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Don't replace '\' with '\\' in before_prompt_hook
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>, gdb-patches at sourceware dot org
- Date: Wed, 29 Oct 2014 14:39:35 +0000
- Subject: Re: [PATCH] Don't replace '\' with '\\' in before_prompt_hook
- Authentication-results: sourceware.org; auth=none
- References: <878ukfkkog dot fsf at codesourcery dot com> <1413982654-15995-1-git-send-email-yao at codesourcery dot com> <87bnovt0v5 dot fsf at codesourcery dot com> <5450FAED dot 1010005 at redhat dot com>
On 29/10/14 14:34, Phil Muldoon wrote:
> On 29/10/14 14:19, Yao Qi wrote:
>> Yao Qi <yao@codesourcery.com> writes:
>>
>>> In gdb/command/prompt.py:before_prompt_hook, the '\' in the new prompt
>>> is replaced with '\\', shown 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 nor email. As doc
>>> said, "set extended-prompt \w" substitute the current working
>>> directory, but it prints something different from what pwd or
>>> os.getcwdu() prints on mingw32 host.
>>>
>>> (gdb) python print os.getcwdu()^M
>>> \\build2-lucid-cs\yqi\yqi\arm-none-eabi
>>>
>>> (gdb) pwd^M
>>> Working directory \\build2-lucid-cs\yqi\yqi\arm-none-eabi
>>>
>>> (gdb) set extended-prompt \w
>>> \\\\build2-lucid-cs\\yqi\\yqi\\arm-none-eabi
>>>
>>> This makes me think whether the substitution in before_prompt_hook is
>>> necessary or not. This patch is to remove this substitution.
>>>
>>> Run gdb.python on x86_64-linux and arm-none-eabi on mingw32 host. No
>>> regressions. Is it OK?
>>>
>>> gdb:
>>>
>>> 2014-10-22 Yao Qi <yao@codesourcery.com>
>>>
>>> * python/lib/gdb/command/prompt.py (before_prompt_hook): Don't
>>> replace '\\' with '\\\\'.:
>> The trailing : can be removed. I appreciate people familiar with gdb
>> python can review this patch, so, here is a ping.
>>
> If the tests pass, I think it is fine. We are not close to a release,
> so we can put it back if it causes issues (and fix up some new tests
> to catch the regression.)
>
Oops I better clarify, this is for mainline, not the impending 7.8.1 release?
Cheers
Phil