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: [rfc] Prompt memory management/cleanups


>>>>> "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


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