This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] [python] Prompt substitution


Tom Tromey <tromey@redhat.com> writes:

>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
>
> Phil> Current patch attached.
>
> Code bits are ok.
>
> Remember to send an updated ChangeLog when you update a patch.

Thanks, and so committed.  One note: as this patch and the upcoming
prompt memory cleanups patch alter set_prompt in similar ways, I changed
this patch to match Pedro's xstrdup request.  I've included the hunk
below.  I also forgot to write a NEWS entry.  I will send a patch for
that soon.

Cheers,

Phil


===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -r1.199 -r1.200
--- src/gdb/top.c	2011/06/27 19:21:50	1.199
+++ src/gdb/top.c	2011/07/21 11:03:45	1.200
@@ -1133,14 +1133,17 @@
 }
 
 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));
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]