Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: msnyder@sonic.net
To: "Michael Snyder" <Michael.Snyder@access-company.com>,
	msnyder@sonic.net,         gdb-patches@sourceware.org
Subject: Re: [OB] Add cleanup, source.c
Date: Fri, 29 Jun 2007 02:05:00 -0000	[thread overview]
Message-ID: <11470.12.7.175.2.1183080998.squirrel@webmail.sonic.net> (raw)
In-Reply-To: <20070628231153.GA14231@caradoc.them.org>

> On Thu, Jun 28, 2007 at 03:59:23PM -0700, Michael Snyder wrote:
>>
>>
>> > There's no call to do_cleanups in this function, so it's quite hard to
>> > see if this cleanup will be run or discarded if error is not called.
>>
>> When are they ever discarded?
>>
>> My last understanding of the mechanism was that the cleanups
>> always get called, eventually.  Presumably when we return to
>> the command / event loop.
>
> No, that's not right.  Cleanups are often discarded after a successful
> operation, in order to not free something that would have been cleaned
> up on error.

Well, I'm pretty sure you're mistaken.

Or put it another way -- one of us is mistaken, and naturally,
I think it's you.   ;-)

1) From logic: I know that frequently when we allocate something,
we call a make_cleanup function to register it to be freed -- and
then we never actually free it.  We depend on it being freed at
cleanup time.  Which is exactly what we're doing here.

2) Empirically: I run gdb with this change, and set a breakpoint
at do_freeargv.  It gets called, from command_handler (event-top.c).
So the change accomplishes what it is meant to do.

3) By example: in the same module (source.c), three other functions
call buildargv and make_cleanup_freeargv -- and none of them calls
do_cleanups.

So you're holding me to a higher standard than the preexisting code.
;-)





  reply	other threads:[~2007-06-29  1:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-28 22:35 msnyder
2007-06-28 22:49 ` Daniel Jacobowitz
2007-06-28 23:12   ` msnyder
     [not found]   ` <655C3D4066B7954481633935A40BB36F041427@ussunex02.svl.access-company.com>
2007-06-29  0:24     ` Daniel Jacobowitz
2007-06-29  2:05       ` msnyder [this message]
2007-06-29 11:37         ` Daniel Jacobowitz
2007-06-29 17:02           ` Joel Brobecker
2007-06-29 20:34             ` Michael Snyder
2007-06-30 10:19           ` Michael Snyder
2007-06-30 14:17             ` Eli Zaretskii
2007-06-30 16:39               ` Michael Snyder
2007-06-30 16:40                 ` Daniel Jacobowitz
2007-06-30 18:25                 ` Eli Zaretskii
2007-07-03 18:13                   ` Jim Blandy
2007-07-04 17:35                     ` Joel Brobecker

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=11470.12.7.175.2.1183080998.squirrel@webmail.sonic.net \
    --to=msnyder@sonic.net \
    --cc=Michael.Snyder@access-company.com \
    --cc=gdb-patches@sourceware.org \
    /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