[PATCH] Remove allocate_symbol et al

Christian Biesinger cbiesinger@google.com
Tue Apr 28 16:22:18 GMT 2020


On Tue, Apr 28, 2020 at 10:26 AM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Christian" == Christian Biesinger via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> >> SYMBOL_OBJFILE_OWNED (symbol) = 0;
> >> +  SYMBOL_SECTION (symbol) = 0;
>
> Christian> Does this not have to set objfile_owned to 0?
>
> It does, it's just in the context, not the patch itself.  It's the line
>
> >> SYMBOL_OBJFILE_OWNED (symbol) = 0;

I can't believe I missed that...

> Christian> Similarly, ada-exp.y has a call:
> Christian>   struct symbol *sym = new (&temp_parse_space) symbol ();
> Christian> Does this not need updating?
>
> Nice find.  This code seems very questionable.
>
> After looking at it, I think special treatment isn't necessary here.
> This creates a temporary placeholder symbol that doesn't outlive
> expression resolution.

Good point. I should have looked more closely at this code. Come to
think of it, there's probably no reason to allocate this on the
obstack, could just be on the stack...

Christian


More information about the Gdb-patches mailing list