Re: [RFA] deleting breakpoints inside of 'commands' [Repost]

Kevin Buettner
2001-09-19T14:22:00Z

On Sep 19, 4:53pm, Fernando Nasser wrote:

> Kevin Buettner wrote:
> >
> > I don't think that reference counting is the right way to go. You'll
> > be adding complexity to GDB in the form of making certain parts of GDB
> > responsible for updating the reference counts. Also, there's the
> > overhead of maintaining the reference counts. I agree that making a
> > copy of the commands might be a little bit slower, but it has the
> > advantage of being simple which makes it easier to verify correctness.
> >
>
> What complexity? The same parts of GDB that allocate/deallocate the
> list
> (maybe two places?) will to call a slightly different function. The one
> that deallocates checks the counter first intead of blindly freeing up
> memory. The only addition is a couple of calls where we pick a list of
> commands to be executed (one place perhaps) to make sure the fact we are
> using it is known.

This doesn't sound too bad; if the patches look reasonable, I may change
my mind...

HOWEVER, I'm against reference counts in general because it can be
very hard to get the counter increments / decrements put in the right
places. If you screw it up, you either get memory leaks or memory
corruption or both. If we're contemplating the use of reference
counts for other areas of GDB, I think we ought to rethink the problem
and use some other garbage collection technique instead.

Kevin