[RFC] How to get target_ops from to_kill method?

Pedro Alves pedro@codesourcery.com
Mon Mar 16 17:02:00 GMT 2009


On Monday 16 March 2009 16:22:47, Joel Brobecker wrote:

> As I was hinting in one of my earlier emails, there is a nasty error
> in darwin-nat.c, in the fact that we set the darwin_ops->to_kill method
> to a procedure that has the wrong profile: darwin_kill_inferior takes
> a target_ops * as its parameter, whereas the to_kill method is supposed
> to take none!

Thank you very much for handling these breakages.

> As it turns out, all the routines being used by darwin_kill_inferior
> don't use the target_ops. So what my second patch did was extract out
> each of these routines inside another identical function, but without
> the target_ops parameter. What this does, basically, is defined the
> target_ops methods as wrappers to the real routines. This is what my
> second patch does.

I much prefer this version over the other.  It's incremental, and
doesn't add any hack or reference to the current_target global.

> 
> However, I'm really wondering whether it would make sense to have
> *all* the methods take the target_ops as the first parameter. We've
> been slowly adding this parameter as we need them, but really, why
> not be consistent across the board?

Mostly, because it's a bunch of work that affects most native
targets.  I tried hard to avoid missing any conversion in
the last set of changes, but, it ended up I broke a lot
of stuff...  But, yeah, there's a lot of inconsistency
here.

-- 
Pedro Alves



More information about the Gdb-patches mailing list