FRONTPANEL: Add breakpoint support to support a debugger using the API
This commit is contained in:
parent
5eb6750800
commit
d497aea17e
3 changed files with 136 additions and 2 deletions
|
@ -179,7 +179,7 @@ panel = sim_panel_start_simulator_debug (sim_path,
|
|||
debug? "frontpanel.dbg" : NULL);
|
||||
|
||||
if (!panel) {
|
||||
printf ("Error starting simulator: %s\n", sim_panel_get_error());
|
||||
printf ("Error starting simulator %s with config %s: %s\n", sim_path, sim_config, sim_panel_get_error());
|
||||
goto Done;
|
||||
}
|
||||
|
||||
|
@ -335,6 +335,23 @@ if (sim_panel_dismount (panel, "RL0")) {
|
|||
goto Done;
|
||||
}
|
||||
remove ("TEST-RL.DSK");
|
||||
if (sim_panel_break_set (panel, "400")) {
|
||||
printf ("Unexpected establishing a breakpoint: %s\n", sim_panel_get_error());
|
||||
goto Done;
|
||||
}
|
||||
if (sim_panel_break_clear (panel, "400")) {
|
||||
printf ("Unexpected clearing a breakpoint: %s\n", sim_panel_get_error());
|
||||
goto Done;
|
||||
}
|
||||
if (sim_panel_break_output_set (panel, "\"32..31..30\"")) {
|
||||
printf ("Unexpected establishing an output breakpoint: %s\n", sim_panel_get_error());
|
||||
goto Done;
|
||||
}
|
||||
if (sim_panel_break_output_clear (panel, "\"32..31..30\"")) {
|
||||
printf ("Unexpected clearing an output breakpoint: %s\n", sim_panel_get_error());
|
||||
goto Done;
|
||||
}
|
||||
sim_panel_clear_error ();
|
||||
while (1) {
|
||||
size_t i;
|
||||
char cmd[512];
|
||||
|
|
|
@ -1176,6 +1176,90 @@ panel->State = Run;
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sim_panel_break_set (PANEL *panel, const char *condition)
|
||||
{
|
||||
if (!panel || (panel->State == Error)) {
|
||||
sim_panel_set_error ("Invalid Panel");
|
||||
return -1;
|
||||
}
|
||||
if (panel->parent) {
|
||||
sim_panel_set_error ("Can't establish a breakpoint from device front panel");
|
||||
return -1;
|
||||
}
|
||||
if (panel->State == Run) {
|
||||
sim_panel_set_error ("Not Halted");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_panel_sendf (panel, 1, NULL, "BREAK %s\r", condition))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sim_panel_break_clear (PANEL *panel, const char *condition)
|
||||
{
|
||||
if (!panel || (panel->State == Error)) {
|
||||
sim_panel_set_error ("Invalid Panel");
|
||||
return -1;
|
||||
}
|
||||
if (panel->parent) {
|
||||
sim_panel_set_error ("Can't clear a breakpoint from device front panel");
|
||||
return -1;
|
||||
}
|
||||
if (panel->State == Run) {
|
||||
sim_panel_set_error ("Not Halted");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_panel_sendf (panel, 1, NULL, "NOBREAK %s\r", condition))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sim_panel_break_output_set (PANEL *panel, const char *condition)
|
||||
{
|
||||
if (!panel || (panel->State == Error)) {
|
||||
sim_panel_set_error ("Invalid Panel");
|
||||
return -1;
|
||||
}
|
||||
if (panel->parent) {
|
||||
sim_panel_set_error ("Can't establish an output breakpoint from device front panel");
|
||||
return -1;
|
||||
}
|
||||
if (panel->State == Run) {
|
||||
sim_panel_set_error ("Not Halted");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_panel_sendf (panel, 1, NULL, "EXPECT %s\r", condition))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sim_panel_break_output_clear (PANEL *panel, const char *condition)
|
||||
{
|
||||
if (!panel || (panel->State == Error)) {
|
||||
sim_panel_set_error ("Invalid Panel");
|
||||
return -1;
|
||||
}
|
||||
if (panel->parent) {
|
||||
sim_panel_set_error ("Can't clear an output breakpoint from device front panel");
|
||||
return -1;
|
||||
}
|
||||
if (panel->State == Run) {
|
||||
sim_panel_set_error ("Not Halted");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_panel_sendf (panel, 1, NULL, "NOEXPECT %s\r", condition))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
sim_panel_gen_examine
|
||||
|
|
|
@ -57,7 +57,7 @@ extern "C" {
|
|||
|
||||
#if !defined(__VAX) /* Unsupported platform */
|
||||
|
||||
#define SIM_FRONTPANEL_VERSION 1
|
||||
#define SIM_FRONTPANEL_VERSION 2
|
||||
|
||||
/**
|
||||
|
||||
|
@ -232,6 +232,39 @@ sim_panel_exec_run (PANEL *panel);
|
|||
int
|
||||
sim_panel_exec_step (PANEL *panel);
|
||||
|
||||
/**
|
||||
|
||||
When a front panel application wants to describe conditions that
|
||||
should stop instruction execution an execution or an output
|
||||
should be used. To established or clear a breakpoint, one of
|
||||
the following routines should be called:
|
||||
|
||||
sim_panel_break_set - Establish a simulation breakpoint
|
||||
sim_panel_break_clear - Cancel/Delete a previously defined
|
||||
breakpoint
|
||||
sim_panel_break_output_set - Establish a simulator output
|
||||
breakpoint
|
||||
sim_panel_break_output_clear - Cancel/Delete a previously defined
|
||||
output breakpoint
|
||||
|
||||
Note: Any breakpoint switches/flags must be located at the
|
||||
beginning of the condition string
|
||||
|
||||
*/
|
||||
|
||||
int
|
||||
sim_panel_break_set (PANEL *panel, const char *condition);
|
||||
|
||||
int
|
||||
sim_panel_break_clear (PANEL *panel, const char *condition);
|
||||
|
||||
int
|
||||
sim_panel_break_output_set (PANEL *panel, const char *condition);
|
||||
|
||||
int
|
||||
sim_panel_break_output_clear (PANEL *panel, const char *condition);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
When a front panel application needs to change or access
|
||||
|
|
Loading…
Add table
Reference in a new issue