corelow and threads question
Pedro Alves
pedro@codesourcery.com
Fri Jun 5 19:24:00 GMT 2009
On Friday 05 June 2009 19:54:54, Aleksandar Ristovski wrote:
> With corelow.c patched as proposed, on Neutrino I could do this:
>
> For NTO, I "hijack" core_ops:
> static void
> init_nto_core_ops ()
> {
> struct target_ops *core_ops;
>
> core_ops = find_core_target ();
> gdb_assert (core_ops && core_ops->to_shortname != NULL
> && !!"core_ops must be initialized first!");
> original_core_ops = *core_ops;
> core_ops->to_extra_thread_info =
> nto_target_extra_thread_info;
> core_ops->to_open = nto_core_open;
> core_ops->to_xfer_partial = nto_core_xfer_partial;
> core_ops->to_pid_to_str = nto_pid_to_str;
> }
As I mentioned in the other threads, this is fine as a local change,
but not so to have in GDB proper, so it does go against
your goal of pushing all your local changes. :-/
This is depending on the order of which the _initialize
routines are called, hence the gdb_assert. I just cleaned
up the only left over target that was doing a similar hack
(sol-threads.c) a couple of months ago, to not do so.
Again, it's hard to come up with a better alternative
without knowing what you're doing in those overrides. Maybe
what you need is a thread_stratum target sitting on top of
nto-procfs.c or corelow.c. Maybe we need new gdbarch
callbacks.
--
Pedro Alves
More information about the Gdb
mailing list