[PATCH 1/3] gdb: remove callback in macro expand functions

Simon Marchi simark@simark.ca
Tue Jun 30 22:26:12 GMT 2020


On 2020-06-30 6:14 p.m., Matt Rice via Gdb-patches wrote:
> On Tue, Jun 30, 2020 at 8:47 PM Tom Tromey <tom@tromey.com> wrote:
>>
>>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
>> Simon> From: Simon Marchi <simon.marchi@efficios.com>
>> Simon> I started to look into changing the callbacks in macroexp.h to use
>> Simon> gdb::function_view.  However, I noticed that the passed lookup function
>> Simon> was always `standard_macro_lookup`, which looks up a macro in a
>> Simon> `macro_scope` object.  Since that doesn't look like a very useful
>> Simon> abstraction, it would be simpler to just pass the scope around and have
>> Simon> the various functions call standard_macro_lookup themselves.  This is
>> Simon> what this patch does.
>>
>> This seems fine to me.
>>
>> I don't remember, but maybe this lookup function used to vary at some
>> point in the past.  That would explain the abstraction anyway.  Or maybe
>> it was just planned somehow.
> 
> It looks like it never varied, I think that perhaps varying it could
> have been in anticipation of the
> macro_expand_once, for storing partial expansion tables in the baton
> perhaps, it looks like
> all the other unimplemented commands at the time of initial commit
> have been implemented without it
> (though I didn't do an exhaustive look) anyhow that is just a guess *shrug*.
> 

Ok, thanks for checking.  In any case, if this abstraction is ever actually
needed, it won't be really hard to add it back.  And if not, then we can just
enjoy the simpler code.

Simon


More information about the Gdb-patches mailing list