pico-gdb
.
These libraries work in multiple configurations.
You may or may not wish to use the loader built into the backend.
pico-gdb
does not use this loader. It supplies its own ELF loader and
user interface.
The following is a standard list of functions provided by the simulation library. The default memory configuration is 16MB. You can define other memory sizes by setting the environment variable PICOJAVA_MEMORY_SIZE.
Most of these functions have been derived from the gdb interface. Some of them do nothing, but are required for compatibility.
Library Function | Description |
---|---|
void sim_open (char *args); | Initialize the simulator. This function shd be called when starting the program. the args argument is currently unused. |
void sim_close (int quitting); | Terminate the simulator. Should be called when the program is about to exit. IAS ignores the quitting argument. | int sim_load (char *prog, int from_tty); | Load a program (in some format) into program memory. This function currently does nothing. The loading needs to happen externally through sim_write calls (see below) | void sim_create_inferior (SIM_ADDR start_address, char **argv, char **env); | Initialize all registers to their power-on values. Sets PC to start_address. |
void sim_kill (void); | This function does nothing. |
int sim_read (SIM_ADDR mem, unsigned char *buf, int length); | Read length bytes from the simulated program's memory and store in buf. Result is number of bytes read, or zero if error. No alignment restrictions on mem. |
int sim_write (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. No alignment restrictions on mem. |
void sim_fetch_register (int regno, unsigned char *buf); | Fetch register regno and store the raw value in buf.
no alignment restrictions on buf.
4 bytes representing the contents of the register are filled into
the 4 consecutive bytes from *buf (big-endian, MSB first)
Register numbers are defined as: 0: PC, 1: VARS, 2: FRAME, 3: OPTOP, 4: OPLIN, 5: CONST_POOL, 6: PSR, 7: TRAPBASE, 8: USERRANGE1, 9: VERSIONID, 10: HCR, 11: SCBOTTOM, 12..15: GLOBAL0..3, 16: USERRANGE2, 17/18: LOCKADDR0/1 19/20: LOCKCOUNT0/1, 21: GC_CONFIG, 22: BRK12C, 23/24: BRK1A/2A |
void sim_store_register (int regno, unsigned char *buf); | Store register regno from buf. no alignment restrictions on buf. 4 bytes are read from *buf onwards (big-endian) and the word formed is written to regno. regno's are the same as for sim_fetch_register, but writes to regs. 9, 10, 11 are not allowed, such writes will be silently dropped. |
void sim_info (int verbose); enum sim_stop { sim_exited, sim_stopped, sim_signalled }; |
Prints, out version information from the simulator. Berbose is non-zero for the wordy version. Currently verbose doesn't do anything. |
void sim_stop_reason (enum sim_stop *reason, int *sigrc); | Fetch why the program stopped. if breakpoint was hit, *reason = sim_stopped, *sigrc = SIGTRAP if SIGINT was received, *reason = sim_stopped, *sigrc = SIGINT if program ended, *reason = sim_exited, *sigrc = exit code of program |
void sim_resume (int step, int signal); | if step == 0, execute one instruction and return. if step == 1, Run the program from the current PC till a breakpoint is hit, or till it ends or control c is hit During execution of this function, the simulator captures the SIGINT signal and restores the original handler when returning. The status of SIGINT is only checked between instructions so the the simulator is in a consistent state when it returns due to a SIGINT. The signal parameter is ignored. |
void sim_do_command (char *cmd); | This function is a catch-all pass through for other commands that the simulator
might support. The supported commands supported are: cmd = itrace trace_level, where Prints out debug information as the program runs. Successively higher levels print out more debug information. cmd = dumpDcache set Prints out contents of set no. set in the D-cache cmd = dumpIcache set Prints out contents of set no. set in the D-cache cmd = configure icache|dcache|fpu ... Configures the core for cache sizes or fpu present or absent |