SCP: Add sim_brk_message() to facilitate easy reporting of matched breakpoints.
Also extended the optional VM supplied routines to include sim_vm_sprint_addr. Simulators which provide sim_vm_fprint_addr should also provide sim_vm_sprint_addr with sim_vm_fprint_addr reworked to leverage sim_vm_sprint_addr internally. sim_vm_sprint_addr is currently only used by sim_brk_message() which is an API which a simulator may choose to use if it supports multiple breakpoint types,
This commit is contained in:
parent
e06b815d2a
commit
222ae77436
5 changed files with 45 additions and 2 deletions
BIN
doc/simh.doc
BIN
doc/simh.doc
Binary file not shown.
Binary file not shown.
33
scp.c
33
scp.c
|
@ -344,6 +344,7 @@ WEAK void (*sim_vm_init) (void);
|
|||
char* (*sim_vm_read) (char *ptr, int32 size, FILE *stream) = NULL;
|
||||
void (*sim_vm_post) (t_bool from_scp) = NULL;
|
||||
CTAB *sim_vm_cmd = NULL;
|
||||
void (*sim_vm_sprint_addr) (char *buf, DEVICE *dptr, t_addr addr) = NULL;
|
||||
void (*sim_vm_fprint_addr) (FILE *st, DEVICE *dptr, t_addr addr) = NULL;
|
||||
t_addr (*sim_vm_parse_addr) (DEVICE *dptr, CONST char *cptr, CONST char **tptr) = NULL;
|
||||
t_value (*sim_vm_pc_value) (void) = NULL;
|
||||
|
@ -405,7 +406,6 @@ SCHTAB *get_asearch (CONST char *cptr, int32 radix, SCHTAB *schptr);
|
|||
int32 test_search (t_value *val, SCHTAB *schptr);
|
||||
static const char *get_glyph_gen (const char *iptr, char *optr, char mchar, t_bool uc, t_bool quote, char escape_char);
|
||||
int32 get_switches (const char *cptr);
|
||||
char *put_switches (char *buf, size_t bufsize, int32 sw);
|
||||
CONST char *get_sim_sw (CONST char *cptr);
|
||||
t_stat get_aval (t_addr addr, DEVICE *dptr, UNIT *uptr);
|
||||
t_value get_rval (REG *rptr, uint32 idx);
|
||||
|
@ -474,6 +474,7 @@ int32 sim_is_running = 0;
|
|||
t_bool sim_processing_event = FALSE;
|
||||
uint32 sim_brk_summ = 0;
|
||||
uint32 sim_brk_types = 0;
|
||||
BRKTYPTAB *sim_brk_type_desc = NULL; /* type descriptions */
|
||||
uint32 sim_brk_dflt = 0;
|
||||
uint32 sim_brk_match_type;
|
||||
t_addr sim_brk_match_addr;
|
||||
|
@ -8138,7 +8139,7 @@ return cptr;
|
|||
buf = buffer with switches converted to text
|
||||
*/
|
||||
|
||||
char *put_switches (char *buf, size_t bufsize, int32 sw)
|
||||
const char *put_switches (char *buf, size_t bufsize, uint32 sw)
|
||||
{
|
||||
char *optr = buf;
|
||||
size_t i = 0;
|
||||
|
@ -8537,6 +8538,7 @@ switch (format) {
|
|||
}
|
||||
if (!buffer)
|
||||
return strlen(dbuf+d);
|
||||
*buffer = '\0';
|
||||
if (width < strlen(dbuf+d))
|
||||
return SCPE_IOERR;
|
||||
strcpy(buffer, dbuf+d);
|
||||
|
@ -9388,6 +9390,33 @@ if (spc < SIM_BKPT_N_SPC) {
|
|||
}
|
||||
}
|
||||
|
||||
const char *sim_brk_message(void)
|
||||
{
|
||||
static char msg[256];
|
||||
char addr[65];
|
||||
char buf[32];
|
||||
|
||||
msg[0] = '\0';
|
||||
if (sim_vm_sprint_addr)
|
||||
sim_vm_sprint_addr (addr, sim_dflt_dev, (t_value)sim_brk_match_addr);
|
||||
else sprint_val (addr, (t_value)sim_brk_match_addr, sim_dflt_dev->aradix, sim_dflt_dev->awidth, PV_LEFT);
|
||||
if (sim_brk_type_desc) {
|
||||
BRKTYPTAB *brk = sim_brk_type_desc;
|
||||
|
||||
while (2 == strlen (put_switches (buf, sizeof(buf), brk->btyp))) {
|
||||
if (brk->btyp == sim_brk_match_type) {
|
||||
sprintf (msg, "%s: %s", brk->desc, addr);
|
||||
break;
|
||||
}
|
||||
brk++;
|
||||
}
|
||||
}
|
||||
if (!msg[0])
|
||||
sprintf (msg, "%s Breakpoint at: %o\n", put_switches (buf , sizeof(buf), sim_brk_match_type), sim_brk_match_addr);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/* Expect package. This code provides a mechanism to stop and control simulator
|
||||
execution based on traffic coming out of simulated ports and as well as a means
|
||||
to inject data into those ports. It can conceptually viewed as a string
|
||||
|
|
5
scp.h
5
scp.h
|
@ -150,6 +150,7 @@ int sim_isgraph (char c);
|
|||
int sim_isalnum (char c);
|
||||
int sim_strncasecmp (const char* string1, const char* string2, size_t len);
|
||||
CONST char *get_sim_opt (int32 opt, CONST char *cptr, t_stat *st);
|
||||
const char *put_switches (char *buf, size_t bufsize, uint32 sw);
|
||||
CONST char *get_glyph (const char *iptr, char *optr, char mchar);
|
||||
CONST char *get_glyph_nc (const char *iptr, char *optr, char mchar);
|
||||
CONST char *get_glyph_quoted (const char *iptr, char *optr, char mchar);
|
||||
|
@ -165,6 +166,7 @@ int Fprintf (FILE *f, const char* fmt, ...) GCC_FMT_ATTR(2, 3);
|
|||
t_stat sim_set_memory_load_file (const unsigned char *data, size_t size);
|
||||
int Fgetc (FILE *f);
|
||||
t_stat fprint_val (FILE *stream, t_value val, uint32 rdx, uint32 wid, uint32 fmt);
|
||||
t_stat sprint_val (char *buf, t_value val, uint32 rdx, uint32 wid, uint32 fmt);
|
||||
t_stat sim_print_val (t_value val, uint32 radix, uint32 width, uint32 format);
|
||||
char *read_line (char *cptr, int32 size, FILE *stream);
|
||||
void fprint_reg_help (FILE *st, DEVICE *dptr);
|
||||
|
@ -186,6 +188,7 @@ uint32 sim_brk_test (t_addr bloc, uint32 btyp);
|
|||
void sim_brk_clrspc (uint32 spc, uint32 btyp);
|
||||
void sim_brk_npc (uint32 cnt);
|
||||
void sim_brk_setact (const char *action);
|
||||
const char *sim_brk_message(void);
|
||||
t_stat sim_send_input (SEND *snd, uint8 *data, size_t size, uint32 after, uint32 delay);
|
||||
t_stat sim_show_send_input (FILE *st, const SEND *snd);
|
||||
t_bool sim_send_poll_data (SEND *snd, t_stat *stat);
|
||||
|
@ -274,6 +277,7 @@ extern uint32 sim_brk_dflt;
|
|||
extern uint32 sim_brk_summ;
|
||||
extern uint32 sim_brk_match_type;
|
||||
extern t_addr sim_brk_match_addr;
|
||||
extern BRKTYPTAB *sim_brk_type_desc; /* type descriptions */
|
||||
extern FILE *stdnul;
|
||||
extern t_bool sim_asynch_enabled;
|
||||
|
||||
|
@ -298,6 +302,7 @@ WEAK extern void (*sim_vm_init) (void);
|
|||
extern char* (*sim_vm_read) (char *ptr, int32 size, FILE *stream);
|
||||
extern void (*sim_vm_post) (t_bool from_scp);
|
||||
extern CTAB *sim_vm_cmd;
|
||||
extern void (*sim_vm_sprint_addr) (char *buf, DEVICE *dptr, t_addr addr);
|
||||
extern void (*sim_vm_fprint_addr) (FILE *st, DEVICE *dptr, t_addr addr);
|
||||
extern t_addr (*sim_vm_parse_addr) (DEVICE *dptr, CONST char *cptr, CONST char **tptr);
|
||||
extern t_bool (*sim_vm_fprint_stopped) (FILE *st, t_stat reason);
|
||||
|
|
|
@ -419,6 +419,7 @@ typedef struct SHTAB SHTAB;
|
|||
typedef struct MTAB MTAB;
|
||||
typedef struct SCHTAB SCHTAB;
|
||||
typedef struct BRKTAB BRKTAB;
|
||||
typedef struct BRKTYPTAB BRKTYPTAB;
|
||||
typedef struct EXPTAB EXPTAB;
|
||||
typedef struct EXPECT EXPECT;
|
||||
typedef struct SEND SEND;
|
||||
|
@ -726,6 +727,14 @@ struct BRKTAB {
|
|||
BRKTAB *next; /* list with same address value */
|
||||
};
|
||||
|
||||
/* Breakpoint table */
|
||||
|
||||
struct BRKTYPTAB {
|
||||
uint32 btyp; /* type mask */
|
||||
const char *desc; /* description */
|
||||
};
|
||||
#define BRKTYPE(typ,descrip) {SWMASK(typ), descrip}
|
||||
|
||||
/* Expect rule */
|
||||
|
||||
struct EXPTAB {
|
||||
|
|
Loading…
Add table
Reference in a new issue