This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: struct environment
On Wed, Sep 11, 2002 at 11:33:08AM -0700, David Carlton wrote:
> On 06 Sep 2002 11:56:14 -0700, David Carlton
> <carlton@math.Stanford.EDU> said:
>
> > At some point, I'll give it a look: ALL_BLOCK_SYMBOLS is only used
> > in 29 places, so it should be tractable to survey them by hand.
>
> And of course it turns out that, in at least one place,
> ALL_BLOCK_SYMBOLS calls a function that, in turn, calls
> ALL_BLOCK_SYMBOLS over the exact same block. Oops.
>
> But I think I was making too much of the memory-management
> difficulties: I'll do iterators correctly (so you can have as many of
> them active as you want), and just write an ALL_ENV_SYMBOLS macro that
> allocates them on the stack using alloca().
Or you could just require an iterator to be declared in the function
which uses ALL_BLOCK_SYMBOLS.... why bring alloca into it? The pointer
you allocate into would need to be a local variable so the iterator
might as well just be a local variable. Sure, it makes them a tiny bit
less opaque. But make them opaque -in practice-.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer