Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: pmuldoon@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc] Prompt memory management/cleanups
Date: Wed, 20 Jul 2011 15:05:00 -0000	[thread overview]
Message-ID: <m3y5ztyp5m.fsf@fleche.redhat.com> (raw)
In-Reply-To: <m3zkk9w1a0.fsf@redhat.com> (Phil Muldoon's message of "Wed, 20	Jul 2011 14:05:11 +0100")

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


  parent reply	other threads:[~2011-07-20 14:59 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 [this message]
2011-07-20 15:21   ` Phil Muldoon
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=m3y5ztyp5m.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pmuldoon@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