From: Phil Muldoon <pmuldoon@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc] Prompt memory management/cleanups
Date: Wed, 20 Jul 2011 15:21:00 -0000 [thread overview]
Message-ID: <m3fwm1ugoj.fsf@redhat.com> (raw)
In-Reply-To: <m3y5ztyp5m.fsf@fleche.redhat.com> (Tom Tromey's message of "Wed, 20 Jul 2011 08:58:45 -0600")
Tom Tromey <tromey@redhat.com> writes:
>>>>>> "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?
The only use I can find is "", which may have meaning to the annotations
stuff. This seems unlikely to me too. If we think nobody uses it or is
likely to use it in the future, we can declare those elements dead, and
just remove them?
> Do we still need the PROMPT, PREFIX, and SUFFIX defines in event-top.h?
No. They should not be accessible except from top.c and event-top.c
anymore. So I will remove them.
Cheers,
Phil
next prev parent reply other threads:[~2011-07-20 15:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-20 13:46 Phil Muldoon
2011-07-20 14:30 ` Pedro Alves
2011-07-20 14:37 ` Phil Muldoon
2011-07-20 15:01 ` Pedro Alves
2011-07-20 15:06 ` Phil Muldoon
2011-07-20 15:15 ` Pedro Alves
2011-07-20 15:45 ` Tom Tromey
2011-07-20 16:04 ` Pedro Alves
2011-07-20 16:06 ` Tom Tromey
2011-07-20 15:05 ` Tom Tromey
2011-07-20 15:21 ` Phil Muldoon [this message]
2011-07-20 15:35 ` Tom Tromey
2011-07-21 17:15 ` Phil Muldoon
2011-07-21 20:42 ` Tom Tromey
2011-07-22 13:26 ` Phil Muldoon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3fwm1ugoj.fsf@redhat.com \
--to=pmuldoon@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox