Message ID | 1413982654-15995-1-git-send-email-yao@codesourcery.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 18262 invoked by alias); 22 Oct 2014 13:01:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 18252 invoked by uid 89); 22 Oct 2014 13:01:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Oct 2014 13:01:43 +0000 Received: from svr-orw-fem-05.mgc.mentorg.com ([147.34.97.43]) by relay1.mentorg.com with esmtp id 1XgvXn-0005tP-UJ from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 22 Oct 2014 06:01:39 -0700 Received: from qiyao.dyndns.org.com (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.3.181.6; Wed, 22 Oct 2014 06:01:39 -0700 From: Yao Qi <yao@codesourcery.com> To: <gdb-patches@sourceware.org> Subject: [PATCH] Don't replace '\' with '\\' in before_prompt_hook Date: Wed, 22 Oct 2014 20:57:34 +0800 Message-ID: <1413982654-15995-1-git-send-email-yao@codesourcery.com> In-Reply-To: <878ukfkkog.fsf@codesourcery.com> References: <878ukfkkog.fsf@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes |
Commit Message
Yao Qi
Oct. 22, 2014, 12:57 p.m. UTC
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 '\\\\'.: --- gdb/python/lib/gdb/command/prompt.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Comments
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.
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.) Cheers Phil
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
Phil Muldoon <pmuldoon@redhat.com> writes: >> 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? Phil, this patch is for mainline.
Yao Qi <yao@codesourcery.com> writes: >>> 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? > > Phil, > this patch is for mainline. I've pushed it in to mainline.
diff --git a/gdb/python/lib/gdb/command/prompt.py b/gdb/python/lib/gdb/command/prompt.py index e7dc3da..5e973e4 100644 --- a/gdb/python/lib/gdb/command/prompt.py +++ b/gdb/python/lib/gdb/command/prompt.py @@ -58,8 +58,7 @@ The currently defined substitutions are: def before_prompt_hook(self, current): if self.value is not '': - newprompt = gdb.prompt.substitute_prompt(self.value) - return newprompt.replace('\\', '\\\\') + return gdb.prompt.substitute_prompt(self.value) else: return None