From 6427bef6d182b98dce746467c7c09e19e7cf7e2d Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 30 Oct 2014 09:42:36 +0800 Subject: [PATCH] Don't replace '\' with '\\' in before_prompt_hook 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. gdb: 2014-10-30 Yao Qi * python/lib/gdb/command/prompt.py (before_prompt_hook): Don't replace '\\' with '\\\\'. --- gdb/ChangeLog | 5 +++++ gdb/python/lib/gdb/command/prompt.py | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d4dc470953..6d4a9af708 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-10-30 Yao Qi + + * python/lib/gdb/command/prompt.py (before_prompt_hook): Don't + replace '\\' with '\\\\'. + 2014-10-29 Joel Brobecker GDB 7.8.1 released. diff --git a/gdb/python/lib/gdb/command/prompt.py b/gdb/python/lib/gdb/command/prompt.py index e7dc3daa24..5e973e4b6e 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