SCP: Add DEBUG command to allow Debug enabling/disabling via Remote Console

This exposes the functionality of SET DEBUG and SET <dev> DEBUG without using
a general SET command which the remote console facility avoids.
This commit is contained in:
Mark Pizzolato 2018-01-07 12:47:42 -08:00
parent 154320bf71
commit eea15bfe4e
3 changed files with 33 additions and 1 deletions

29
scp.c
View file

@ -959,6 +959,14 @@ static const char simh_help[] =
"+++++++++D MQ 0\n" "+++++++++D MQ 0\n"
"++BREAK 100; delete action on break at 100\n\n" "++BREAK 100; delete action on break at 100\n\n"
/***************** 80 character line width template *************************/ /***************** 80 character line width template *************************/
#define HLP_DEBUG "*Commands Stopping_The_Simulator User_Specified_Stop_Conditions DEBUG"
#define HLP_NODEBUG "*Commands Stopping_The_Simulator User_Specified_Stop_Conditions DEBUG"
"4Debug\n"
" The DEBUG snd NODEBUG commands are aliases for the \"SET DEBUG\" and\n"
" \"SET NODEBUG\" commands. Additionally, support is provided that is\n"
" equivalent to the \"SET <dev> DEBUG=opt1{;opt2}\" and\n"
" \"SET <dev> NODEBUG=opt1{;opt2}\" commands.\n\n"
/***************** 80 character line width template *************************/
"2Connecting and Disconnecting Devices\n" "2Connecting and Disconnecting Devices\n"
" Except for main memory and network devices, units are simulated as\n" " Except for main memory and network devices, units are simulated as\n"
" unstructured binary disk files in the host file system. Before using a\n" " unstructured binary disk files in the host file system. Before using a\n"
@ -1998,6 +2006,8 @@ static CTAB cmd_table[] = {
{ "BOOT", &run_cmd, RU_BOOT, HLP_BOOT, NULL, &run_cmd_message }, { "BOOT", &run_cmd, RU_BOOT, HLP_BOOT, NULL, &run_cmd_message },
{ "BREAK", &brk_cmd, SSH_ST, HLP_BREAK }, { "BREAK", &brk_cmd, SSH_ST, HLP_BREAK },
{ "NOBREAK", &brk_cmd, SSH_CL, HLP_NOBREAK }, { "NOBREAK", &brk_cmd, SSH_CL, HLP_NOBREAK },
{ "DEBUG", &debug_cmd, 1, HLP_DEBUG},
{ "NODEBUG", &debug_cmd, 0, HLP_NODEBUG },
{ "ATTACH", &attach_cmd, 0, HLP_ATTACH }, { "ATTACH", &attach_cmd, 0, HLP_ATTACH },
{ "DETACH", &detach_cmd, 0, HLP_DETACH }, { "DETACH", &detach_cmd, 0, HLP_DETACH },
{ "ASSIGN", &assign_cmd, 0, HLP_ASSIGN }, { "ASSIGN", &assign_cmd, 0, HLP_ASSIGN },
@ -5830,6 +5840,25 @@ if ((stat == SCPE_OK) && (copy_state.count))
return copy_state.stat; return copy_state.stat;
} }
/* Debug command */
t_stat debug_cmd (int32 flg, CONST char *cptr)
{
char gbuf[CBUFSIZE];
CONST char *svptr;
DEVICE *dptr;
GET_SWITCHES (cptr); /* get switches */
cptr = get_glyph (svptr = cptr, gbuf, 0); /* get next glyph */
if ((dptr = find_dev (gbuf))) /* device match? */
return set_dev_debug (dptr, NULL, flg, *cptr ? cptr : NULL);
cptr = svptr;
if (flg)
return sim_set_debon (0, cptr);
else
return sim_set_deboff (0, cptr);
}
/* Breakpoint commands */ /* Breakpoint commands */
t_stat brk_cmd (int32 flg, CONST char *cptr) t_stat brk_cmd (int32 flg, CONST char *cptr)

1
scp.h
View file

@ -109,6 +109,7 @@ t_stat screenshot_cmd (int32 flag, CONST char *ptr);
t_stat spawn_cmd (int32 flag, CONST char *ptr); t_stat spawn_cmd (int32 flag, CONST char *ptr);
t_stat echo_cmd (int32 flag, CONST char *ptr); t_stat echo_cmd (int32 flag, CONST char *ptr);
t_stat echof_cmd (int32 flag, CONST char *ptr); t_stat echof_cmd (int32 flag, CONST char *ptr);
t_stat debug_cmd (int32 flag, CONST char *ptr);
/* Allow compiler to help validate printf style format arguments */ /* Allow compiler to help validate printf style format arguments */
#if !defined __GNUC__ #if !defined __GNUC__

View file

@ -771,6 +771,8 @@ static CTAB allowed_master_remote_cmds[] = {
{ "NOBREAK", &brk_cmd, SSH_CL }, { "NOBREAK", &brk_cmd, SSH_CL },
{ "EXPECT", &expect_cmd, 1 }, { "EXPECT", &expect_cmd, 1 },
{ "NOEXPECT", &expect_cmd, 0 }, { "NOEXPECT", &expect_cmd, 0 },
{ "DEBUG", &debug_cmd, 1 },
{ "NODEBUG", &debug_cmd, 0 },
{ "SEND", &send_cmd, 0 }, { "SEND", &send_cmd, 0 },
{ NULL, NULL } { NULL, NULL }
}; };
@ -2204,7 +2206,6 @@ char gbuf[CBUFSIZE];
t_stat r; t_stat r;
time_t now; time_t now;
sim_deb_switches = sim_switches; /* save debug switches */
if ((cptr == NULL) || (*cptr == 0)) /* need arg */ if ((cptr == NULL) || (*cptr == 0)) /* need arg */
return SCPE_2FARG; return SCPE_2FARG;
cptr = get_glyph_nc (cptr, gbuf, 0); /* get file name */ cptr = get_glyph_nc (cptr, gbuf, 0); /* get file name */
@ -2215,6 +2216,7 @@ r = sim_open_logfile (gbuf, FALSE, &sim_deb, &sim_deb_ref);
if (r != SCPE_OK) if (r != SCPE_OK)
return r; return r;
sim_deb_switches = sim_switches; /* save debug switches */
if (sim_deb_switches & SWMASK ('R')) { if (sim_deb_switches & SWMASK ('R')) {
clock_gettime(CLOCK_REALTIME, &sim_deb_basetime); clock_gettime(CLOCK_REALTIME, &sim_deb_basetime);
if (!(sim_deb_switches & (SWMASK ('A') | SWMASK ('T')))) if (!(sim_deb_switches & (SWMASK ('A') | SWMASK ('T'))))