Re: [RFA] Remove unnecessary target defaults.

Vladimir Prus
2008-08-15T14:16:58Z

On Friday 15 August 2008 17:08:42 Pedro Alves wrote:
> On Friday 15 August 2008 13:45:30, Vladimir Prus wrote:
>
> > - de_fault (to_can_async_p,
> > - (int (*) (void))
> > - return_zero);
> > - de_fault (to_is_async_p,
> > - (int (*) (void))
> > - return_zero);
>
> I believe this is incorrect. You don't notice it when connected
> to remote, because those methods are implemented in remote_ops. But,
> when connected to e.g., remote-sim.c, and because gdbsim_ops doesn't define
> those, you'll inherit the dummy target's implementation, which looks
> for asyncness in the default run target instead --- while you should be
> looking for asyncness in the remote-sim target.

As we seem to have agreed on IRC, this is pre-existing problem. We inherit
a method before applying defaults, so we'll always inherit dummy's version
of to_is_async_p, and the code I remove above will never manage to change
method to return_zero.

The problem you raise is real, however. I think one approach to solve it
is to just make remote-sim define to_can_async_p. More generic solution
would be to arrange so that if we have a target on process stratum, it
never goes to targets below for to_can_async_p. For example, if we have

- exec
- dummy

and you do run, then target_can_async_p will look at exec, then at dummy,
then find_default_can_async_p will return some results. But if we have

- remote-sim
- exec
- dummy

then target_can_async_p will either invoke a method in remote-sim (if present),
or return 0.

How does this sound?

- Volodya