GDB enables implementers to link gdb to a built-in simulator, so that a simulated target may be executed through use of the target sim command.
The simulator should be built as a library,
libsim.a
, implementing the standard GDB
simulator interface. The location of the library is specified by
setting the gdb_sim
parameter in
configure.tgt
.
The interface consists of a set of functions which should be
implemented. The detailed specification is found in the header
remote-sim.h
in the include directory.
sim_open
. Initialize the simulator.
sim_close
. Destroy the simulator instance,
including freeing any memory.
sim_load
. Load a program into the simulator's
memory.
sim_create_inferior
. Prepare to run the
simulated program. Don't actually run it until
sim_resume
(see below) is called.
sim_read
and
sim_write
. Read and write bytes from and to
the simulator's memory.
sim_fetch_register
and
sim_store_register
. Read and write the
simulator's registers.
sim_info
. Print information for the
info sim command.
sim_resume
. Resume (or start) execution of
the simulated program.
sim_stop
. Stop execution of the simulated
program.
sim_stop_reason
. Return the reason why the
program stopped.
sim_do_command
. Execute some arbitrary
command that the simulator supports.