]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: adjust remote-sim.c to multi-target
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 13 Jan 2020 15:58:52 +0000 (10:58 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 13 Jan 2020 15:59:09 +0000 (10:59 -0500)
commite0037b4cc727274248aebc11543f2ea3a711dacb
tree55bbe9a5c82253c3e4b0199e9c9940c318a1f8cd
parent82e9597c9ec1c14a402d47f2d9b544235998be1e
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.
gdb/ChangeLog
gdb/remote-sim.c