aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@redhat.com>2011-07-21 11:03:48 +0000
committerPhil Muldoon <pmuldoon@redhat.com>2011-07-21 11:03:48 +0000
commitd17b6f81012b6844de08934193fe7cb7db8cbd5f (patch)
tree38de35dc7c7f44f1f76fbe6af3bed4037b600e00 /gdb/top.c
parent3779080d04bb9504542076e02969f77dff46ae63 (diff)
downloadgdb-d17b6f81012b6844de08934193fe7cb7db8cbd5f.zip
gdb-d17b6f81012b6844de08934193fe7cb7db8cbd5f.tar.gz
gdb-d17b6f81012b6844de08934193fe7cb7db8cbd5f.tar.bz2
2011-07-21 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey <tromey@redhat.com> * top.c (set_prompt): Rewrite to free previous prompt, free asynch_new_prompt and set both on new prompts. * event-top.c (display_gdb_prompt): Add prompt substitution logic. * python/python.c (before_prompt_hook): New function. 2011-07-21 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/python.exp: Add prompt substitution tests. 2011-07-21 Phil Muldoon <pmuldoon@redhat.com> * observer.texi (GDB Observers): Add before_prompt observer. * gdb.texinfo (Basic Python): Add documentation for prompt substitution.
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));
}