gdb: adjust remote-sim.c to multi-target
The remote-sim.c file doesn't build since the main multi-target patch
(
5b6d1e4f, "Multi-target support"), this patch is an attempt to fix it.
I have only build-tested it, so I'm not sure it runs fine, but it should
get us close at least.
I made these functions methods of the gdbsim_target, because they need
to pass the target down to some GDB core functions, like
find_inferior_ptid:
- get_sim_inferior_data_by_ptid (renamed to get_inferior_data_by_ptid)
- gdbsim_resume_inferior (renamed to resume_one_inferior)
- gdbsim_close_inferior (renamed to close_one_inferior)
In the last two, I changed iterate_over_inferiors to a range-based for,
since that gives simpler code (no need to pass data through the void
pointer).
The next_pid variable, INITIAL_PID macro and sim_inferior_data structure
are simply moved up in the file, above gdbsim_target.
gdb/ChangeLog:
* remote-sim.c (next_pid, INITIAL_PID, sim_inferior_data): Move
up.
(gdbsim_target) <get_inferior_data_by_ptid, resume_one_inferior,
close_one_inferior>: New methods.
(get_sim_inferior_data_by_ptid): Move to gdbsim_target,
pass down target to find_inferior_pid.
(gdbsim_target::fetch_registers, gdbsim_target::store_registers):
Pass down target to find_inferior_ptid.
(gdbsim_target::create_inferior): Pass down target to
add_thread_silent.
(gdbsim_close_inferior): Move to gdbsim_close_inferior, pass
target down to find_inferior_ptid and switch_to_thread.
(gdbsim_target::close): Update to call close_one_inferior.
(struct resume_data): Remove.
(gdbsim_resume_inferior): Move to gdbsim_target. Take arguments
directly, rather than through a void pointer.
(gdbsim_target::resume): Update to call resume_one_inferior.