This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] Prompt memory management/cleanups
- From: Tom Tromey <tromey at redhat dot com>
- To: pmuldoon at redhat dot com
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 20 Jul 2011 08:58:45 -0600
- Subject: Re: [rfc] Prompt memory management/cleanups
- References: <m3zkk9w1a0.fsf@redhat.com>
>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
Phil> While working on the Python patch to allow prompt substitution in
Phil> Python, I noticed that in some cases prompts were leaking memory. In
Phil> several cases, scenarios like: PROMPT (0) = xstrdup(someprompt), did not
Phil> xfree the prompt first. I decided to use functions calls to replace
Phil> access to PROMPT/SUFFIX/PREFIX so that memory management can be
Phil> performed centrally. Attached is a patch. I'd appreciate comments on
Phil> this; the testsuite shows no regressions, but my knowledge of the prompt
Phil> area of GDB is about three days old. I'd especially like comments on the
Phil> acceptance on NULL in the set_prompt/prefix/suffix functions. Pop/push
Phil> prompt uses different prompt levels and requires that, after use, they
Phil> are cleaned. It normally just does this with xfree. I'm unsure if my
Phil> API for that scenario is preferable.
The patch seems fine, but I have a few questions.
Does anything ever set the prefix or suffix to a non-empty value?
I couldn't find an instance. So how about just removing all this stuff
instead?
Do we still need the PROMPT, PREFIX, and SUFFIX defines in event-top.h?
Tom