X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=include%2Fremote-sim.h;h=a4480b49ca577b27f3cd92291855566df080ddd0;hb=8b727aa4d3571f3007f2fd3e4cd76547faf79d0b;hp=06e794df78866fca386fd0afc7e1361bd56e64ef;hpb=fafce69ab16b45fb1ac6bd2ec5afc8e8dbed0374;p=deliverable%2Fbinutils-gdb.git diff --git a/include/remote-sim.h b/include/remote-sim.h index 06e794df78..a4480b49ca 100644 --- a/include/remote-sim.h +++ b/include/remote-sim.h @@ -20,6 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if !defined (REMOTE_SIM_H) #define REMOTE_SIM_H 1 +#ifdef __cplusplus +extern "C" { +#endif + /* This file is used when building stand-alone simulators, so isolate this file from gdb. */ @@ -52,7 +56,10 @@ typedef enum { typedef enum { SIM_RC_FAIL = 0, - SIM_RC_OK = 1 + SIM_RC_OK = 1, + SIM_RC_UNKNOWN_BREAKPOINT = 2, + SIM_RC_INSUFFICIENT_RESOURCES = 3, + SIM_RC_DUPLICATE_BREAKPOINT = 4 } SIM_RC; @@ -118,14 +125,21 @@ void sim_close PARAMS ((SIM_DESC sd, int quitting)); If ABFD is non-NULL, the bfd for the file has already been opened. The result is a return code indicating success. - Hardware simulator: A call to this function should not effect the - state of the processor registers. Multiple calls to this function - are permitted and have an accumulative effect. + Hardware simulator: Normally, each program section is written into + memory according to that sections LMA using physical (direct) + addressing. The exception being systems, such as PPC/CHRP, which + support more complicated program loaders. A call to this function + should not effect the state of the processor registers. Multiple + calls to this function are permitted and have an accumulative + effect. Process simulator: Calls to this function may be ignored. - FIXME: Some hardware targets, before a loaded program can be - executed, require the manipulation of VM registers and tables. + FIXME: Most hardware simulators load the image at the VMA using + virtual addressing. + + FIXME: For some hardware targets, before a loaded program can be + executed, it requires the manipulation of VM registers and tables. Such manipulation should probably (?) occure in sim_create_inferior. */ @@ -152,27 +166,42 @@ SIM_RC sim_load PARAMS ((SIM_DESC sd, char *prog, struct _bfd *abfd, int from_tt SIM_RC sim_create_inferior PARAMS ((SIM_DESC sd, struct _bfd *abfd, char **argv, char **env)); -/* Read LENGTH bytes of the simulated program's memory and store in - BUF. Result is number of bytes read, or zero if error. */ +/* Fetch LENGTH bytes of the simulated program's memory. Start fetch + at virtual address MEM and store in BUF. Result is number of bytes + read, or zero if error. */ int sim_read PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)); -/* Store LENGTH bytes from BUF in the simulated program's memory. - Result is number of bytes write, or zero if error. */ +/* Store LENGTH bytes from BUF into the simulated program's + memory. Store bytes starting at virtual address MEM. Result is + number of bytes write, or zero if error. */ int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)); -/* Fetch register REGNO and store the raw (target endian) value in - BUF. */ +/* Fetch register REGNO storing its raw (target endian) value in the + LENGTH byte buffer BUF. Return the actual size of the register or + zero if REGNO is not applicable. + + Legacy implementations ignore LENGTH and always return -1. + + If LENGTH does not match the size of REGNO no data is transfered + (the actual register size is still returned). */ + +int sim_fetch_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf, int length)); + -void sim_fetch_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf)); +/* Store register REGNO from the raw (target endian) value in BUF. + Return the actual size of the register or zero if REGNO is not + applicable. + Legacy implementations ignore LENGTH and always return -1. -/* Store register REGNO from the raw (target endian) value in BUF. */ + If LENGTH does not match the size of REGNO no data is transfered + (the actual register size is still returned). */ -void sim_store_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf)); +int sim_store_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf, int length)); /* Print whatever statistics the simulator has collected. @@ -199,13 +228,19 @@ int sim_stop PARAMS ((SIM_DESC sd)); SIM_EXITED: The program has terminated. SIGRC indicates the target dependant exit status. - SIM_STOPPED: The program has stopped. SIGRC indicates the reason: - program interrupted by user via a sim_stop request (SIGINT); a - breakpoint instruction (SIGTRAP); a completed step (SIGTRAP); an - internal error condition (SIGABRT). + SIM_STOPPED: The program has stopped. SIGRC uses the host's signal + numbering as a way of identifying the reaon: program interrupted by + user via a sim_stop request (SIGINT); a breakpoint instruction + (SIGTRAP); a completed single step (SIGTRAP); an internal error + condition (SIGABRT); an illegal instruction (SIGILL); Access to an + undefined memory region (SIGSEGV); Mis-aligned memory access + (SIGBUS). - SIM_SIGNALLED: The simulator encountered target code that requires - the signal SIGRC to be delivered to the simulated program. + SIM_SIGNALLED: The program has stopped. The simulator has + encountered target code that requires the (HOST) signal SIGRC to be + delivered to the simulated program. Ex: `kill (getpid (), + TARGET_SIGxxx)'. Where TARGET_SIGxxx has been translated into a + host signal. FIXME: This is not always possible.. SIM_RUNNING, SIM_POLLING: The return of one of these values indicates a problem internal to the simulator. */ @@ -220,6 +255,19 @@ void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc)); or empty CMD. */ void sim_do_command PARAMS ((SIM_DESC sd, char *cmd)); + +/* Call these functions to set and clear breakpoints at ADDR. */ + +SIM_RC sim_set_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); +SIM_RC sim_clear_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); +SIM_RC sim_clear_all_breakpoints PARAMS ((SIM_DESC sd)); + +/* These functions are used to enable and disable breakpoints. */ + +SIM_RC sim_enable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); +SIM_RC sim_disable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); +SIM_RC sim_enable_all_breakpoints PARAMS ((SIM_DESC sd)); +SIM_RC sim_disable_all_breakpoints PARAMS ((SIM_DESC sd)); /* Provide simulator with a default (global) host_callback_struct. @@ -266,4 +314,8 @@ void sim_set_profile_size PARAMS ((int n)); void sim_kill PARAMS ((SIM_DESC sd)); +#ifdef __cplusplus +} +#endif + #endif /* !defined (REMOTE_SIM_H) */