This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What should a CPU simulator support?


Wenbo Yang <wenbo.yang@simplnano.com> writes:
>> I'm trying to implement a gdb stub for a CPU simulator.
>> The CPU simulator interprets each instruction in a big while loop.
>> My question is: Is it enough for my simulator to support a single step
>> run (simulate a single instruction per called) function to the gdb
>> stub?
> If your simulator supports "break" or similar instruction, and the GDB
> for your architecture can do software single stepping, I think you can
> realize this function.

(I didn't see the original post, so I'm not sure I have the full
context.)

You really shouldn't need to mess with software single-stepping when
using a simulator.  It's a big distraction, and given the structure of
your simulator, it should be easy to provide what GDB wants directly.

The functions GDB requires are listed in 'include/gdb/remote-sim.h';
none of those should be hard to implement in a simulator; the 'sim'
directory contains many examples of how to hook things up.  You should
consider using the 'sim/common' code if you can, but if not, look at
'sim/m32c' for a very simple-minded approach.  gdb-if.c implements the
remote-sim.h functions in terms of the rest of the sim, which was
originally written as a stand-alone simulator.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]