diff --git a/scp.c b/scp.c index 08fa8ec8..ea6c1f8f 100644 --- a/scp.c +++ b/scp.c @@ -959,6 +959,14 @@ static const char simh_help[] = "+++++++++D MQ 0\n" "++BREAK 100; delete action on break at 100\n\n" /***************** 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 DEBUG=opt1{;opt2}\" and\n" + " \"SET NODEBUG=opt1{;opt2}\" commands.\n\n" + /***************** 80 character line width template *************************/ "2Connecting and Disconnecting Devices\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" @@ -1998,6 +2006,8 @@ static CTAB cmd_table[] = { { "BOOT", &run_cmd, RU_BOOT, HLP_BOOT, NULL, &run_cmd_message }, { "BREAK", &brk_cmd, SSH_ST, HLP_BREAK }, { "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 }, { "DETACH", &detach_cmd, 0, HLP_DETACH }, { "ASSIGN", &assign_cmd, 0, HLP_ASSIGN }, @@ -5830,6 +5840,25 @@ if ((stat == SCPE_OK) && (copy_state.count)) 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 */ t_stat brk_cmd (int32 flg, CONST char *cptr) diff --git a/scp.h b/scp.h index 80657140..12e7b03c 100644 --- a/scp.h +++ b/scp.h @@ -109,6 +109,7 @@ t_stat screenshot_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 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 */ #if !defined __GNUC__ diff --git a/sim_console.c b/sim_console.c index c293bb47..4b89ce16 100644 --- a/sim_console.c +++ b/sim_console.c @@ -771,6 +771,8 @@ static CTAB allowed_master_remote_cmds[] = { { "NOBREAK", &brk_cmd, SSH_CL }, { "EXPECT", &expect_cmd, 1 }, { "NOEXPECT", &expect_cmd, 0 }, + { "DEBUG", &debug_cmd, 1 }, + { "NODEBUG", &debug_cmd, 0 }, { "SEND", &send_cmd, 0 }, { NULL, NULL } }; @@ -2204,7 +2206,6 @@ char gbuf[CBUFSIZE]; t_stat r; time_t now; -sim_deb_switches = sim_switches; /* save debug switches */ if ((cptr == NULL) || (*cptr == 0)) /* need arg */ return SCPE_2FARG; 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) return r; +sim_deb_switches = sim_switches; /* save debug switches */ if (sim_deb_switches & SWMASK ('R')) { clock_gettime(CLOCK_REALTIME, &sim_deb_basetime); if (!(sim_deb_switches & (SWMASK ('A') | SWMASK ('T'))))