From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Cohen To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: Patch to provide m68k simulator to gdb Date: Thu, 01 Mar 2001 11:24:00 -0000 Message-id: <3A9EA1B9.471A7BE9@redhat.com> References: <3A9C3128.A52307A@redhat.com> <3A9D2941.ECA95C7E@cygnus.com> X-SW-Source: 2001-03/msg00021.html There are a number of changes between the old interfaces used by m68k (and sh) and the newer simulators. Using nrun.c requires a number of other things to be modified. Is there there some documentation that describes the various defines and functions required by this newer interface? Or is the situation "The code IS the documentation"? If "The code IS the documentation," which simulator is the best one to model the changes after? I would like to remove these hard-coded numbers in the sim_fetch_registers and sim_store_register functions. Where should REGISTER_SIM_REGNO be defined. I couldn't find an example of its definition in the version of gdb I am using. -Will Andrew Cagney wrote: > > Below are some quick comment about things that are often missed when > integrating a new simulator. > > -- > > New simulators use a header file (include/sim-XXX.h - eg > include/sim-d10v.h) as a way of avoiding magic numbers like: > > sim_fetch_register() > > + case 0: case 1: case 2: case 3: case 4: case 5: case 6: > case 7: > + /* address regs "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp" > */ > + case 8: case 9: case 10: case 11: case 12: case 13: case 14: > case 15: > + val = saved_state.regs[rn]; > > That header along with REGISTER_SIM_REGNO() make it possible to decouple > the simulators register numbers from GDBs. Could the code please be > changed to at least use the header file. > > -- > > I have a feeling that this code is implementing a number of > older/deprecated methods. Have a look over include/remote-sim.h where > it clearly identifies deprecated interfaces. For instance: > > /* Single-step simulator with tracing enabled. > THIS PROCEDURE IS DEPRECIATED. > THIS PROCEDURE IS EVEN MORE DEPRECATED THAN SIM_SET_TRACE > GDB and NRUN do not use this interface. > > Make certain that you use `nrun.c'' and not the older ``run.c''. Add > the line: > > # List of main object files for `run'. > SIM_RUN_OBJS = nrun.o > > to your Makefile.in. It is probably why you implemented sim_trace() > et.al. > > Andrew