[RFC 30/32] convert to_search_memory

Tom Tromey tromey@redhat.com
Tue Jan 14 20:20:00 GMT 2014


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> -      if ((*t)->to_can_run && target_can_run (*t))
>> +      if ((*t)->to_can_run != delegate_can_run && target_can_run (*t))

Pedro> OOC, I'm wondering how you envision translating checks
Pedro> like this into a C++ world?

Good question.

Code like this only appears in places like find_default_run_target.
These functions iterate over all the target_ops structures to find a
suitable one to return.

In the multi-target model, this idea does not really work.  Abstractly,
find_default_run_target is returning a type, not an instance; but in the
long run we want most of the code to deal solely with instances.  I'm
not sure if this way of putting it makes sense... basically
find_default_run_target can't return an instance of a target, but in
order to do nearly anything useful with a target (in the multi-target
future) the target must be instantiated to have an object with state.

This means we're already going to need some restructuring in this area.
So, while a straightforward translation to C++ is not really possible, I
suspect it will also not be needed.

But, if it is needed in the end, I think it can be done simply by adding
fields to target_ops.

Tom



More information about the Gdb-patches mailing list