This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] How to get target_ops from to_kill method?


On Monday 16 March 2009 22:11:03, Joel Brobecker wrote:

> Do you think that the implementation for "target_kill" is good?
> That was my first implementation until I realized that the to_kill
> field is inherited. So perhaps I can simplify the implementation by
> calling the to_kill field from the target layer that's at the top
> of the current target stack?

The implementation of the function itself is good.  What happens is that
we're switching from having the stack "hardcoded" at push time, to have
it traversed on demand, so, this method doesn't need to be inherited and
shouldn't be defaulted anymore.  You can also delete debug_to_kill, it becomes
unreacheable code, since you start the lookup at current_target.beneath,
and you now handle the debug outputting in the new target_kill function.

At some point, I'd like to implement some of the ideas at:

 http://sourceware.org/ml/gdb-patches/2009-02/msg00156.html

The most important/annoying part is to convert the targets and the
method interfaces, due to the need to touch "native" files.

> Other than that, I think I got all implementations, and I recompiled
> all the files that I could recompile on my x86_64-linux machine.
> I also built GDB with --enable-targets=all, even if I don't think
> it help test that much more since most impacted files are "native"
> units.

Yeah, that's the problem with these conversions.  :-)

>  static void
> -hpux_thread_kill_inferior (void)
> +hpux_thread_kill_inferior (struct target_ops *ops)
>  {
> -  deprecated_child_ops.to_kill ();
> +  deprecated_child_ops.to_kill (ops);

Doesn't matter much for a deprecated_child_ops target user,
but, this should be:

 deprecated_child_ops.to_kill (&deprecated_child_ops);

... so the next target in the chain can again do
find_target_beneath (ops)->to_kill (find_target_beneath (ops)),
and so on.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]