aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gdb/top.c b/gdb/top.c
index ecb91f2..3ffd000 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1133,14 +1133,17 @@ get_prompt (void)
}
void
-set_prompt (char *s)
+set_prompt (const char *s)
{
-/* ??rehrauer: I don't know why this fails, since it looks as though
- assignments to prompt are wrapped in calls to xstrdup...
- if (prompt != NULL)
- xfree (prompt);
- */
- PROMPT (0) = xstrdup (s);
+ char *p = xstrdup (s);
+
+ xfree (PROMPT (0));
+ PROMPT (0) = p;
+
+ /* Also, free and set new_async_prompt so prompt changes sync up
+ with set/show prompt. */
+ xfree (new_async_prompt);
+ new_async_prompt = xstrdup (PROMPT (0));
}