VAX: Add the ability to 'STEP OUT" of the most recent subroutine call.

This is invoked with STEP -R nnn, or CONT -R.  Execution will continue
across any new subroutines which are called and stop after the current
routine executes a RET or RSB instruction.
This commit is contained in:
Mark Pizzolato 2016-02-24 10:44:12 -08:00
parent 6148585610
commit 9d979360b4

View file

@ -283,6 +283,7 @@ int32 hst_lnt = 0; /* history length */
int32 hst_switches; /* history option switches */ int32 hst_switches; /* history option switches */
FILE *hst_log; /* history log file */ FILE *hst_log; /* history log file */
int32 hst_log_p; /* history last log written pointer */ int32 hst_log_p; /* history last log written pointer */
int32 step_out_nest_level = 0; /* step to call return - nest level */
const uint32 byte_mask[33] = { 0x00000000, const uint32 byte_mask[33] = { 0x00000000,
0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x00000001, 0x00000003, 0x00000007, 0x0000000F,
@ -2204,12 +2205,16 @@ for ( ;; ) {
Write (SP - 4, PC, L_LONG, WA); /* push PC on stk */ Write (SP - 4, PC, L_LONG, WA); /* push PC on stk */
SP = SP - 4; /* decr stk ptr */ SP = SP - 4; /* decr stk ptr */
BRANCHB (brdisp); /* branch */ BRANCHB (brdisp); /* branch */
if (sim_switches & SWMASK ('R'))
++step_out_nest_level;
break; break;
case BSBW: case BSBW:
Write (SP - 4, PC, L_LONG, WA); /* push PC on stk */ Write (SP - 4, PC, L_LONG, WA); /* push PC on stk */
SP = SP - 4; /* decr stk ptr */ SP = SP - 4; /* decr stk ptr */
BRANCHW (brdisp); /* branch */ BRANCHW (brdisp); /* branch */
if (sim_switches & SWMASK ('R'))
++step_out_nest_level;
break; break;
case BGEQ: case BGEQ:
@ -2290,6 +2295,8 @@ for ( ;; ) {
case JSB: case JSB:
Write (SP - 4, PC, L_LONG, WA); /* push PC on stk */ Write (SP - 4, PC, L_LONG, WA); /* push PC on stk */
SP = SP - 4; /* decr stk ptr */ SP = SP - 4; /* decr stk ptr */
if (sim_switches & SWMASK ('R'))
++step_out_nest_level;
case JMP: case JMP:
JUMP (op0); /* jump */ JUMP (op0); /* jump */
@ -2299,6 +2306,12 @@ for ( ;; ) {
temp = Read (SP, L_LONG, RA); /* get top of stk */ temp = Read (SP, L_LONG, RA); /* get top of stk */
SP = SP + 4; /* incr stk ptr */ SP = SP + 4; /* incr stk ptr */
JUMP (temp); JUMP (temp);
if (sim_switches & SWMASK ('R')) {
if (step_out_nest_level <= 0)
ABORT (SCPE_STEP);
else
--step_out_nest_level;
}
break; break;
/* SOB instructions - op idx.ml,disp.bb /* SOB instructions - op idx.ml,disp.bb
@ -2582,14 +2595,24 @@ for ( ;; ) {
case CALLS: case CALLS:
cc = op_call (opnd, TRUE, acc); cc = op_call (opnd, TRUE, acc);
if (sim_switches & SWMASK ('R'))
++step_out_nest_level;
break; break;
case CALLG: case CALLG:
cc = op_call (opnd, FALSE, acc); cc = op_call (opnd, FALSE, acc);
if (sim_switches & SWMASK ('R'))
++step_out_nest_level;
break; break;
case RET: case RET:
cc = op_ret (acc); cc = op_ret (acc);
if (sim_switches & SWMASK ('R')) {
if (step_out_nest_level <= 0)
ABORT (SCPE_STEP);
else
--step_out_nest_level;
}
break; break;
/* Miscellaneous instructions */ /* Miscellaneous instructions */
@ -3629,6 +3652,7 @@ t_stat cpu_load_bootcode (const char *filename, const unsigned char *builtin_cod
{ {
char args[CBUFSIZE]; char args[CBUFSIZE];
t_stat r; t_stat r;
int32 saved_sim_switches = sim_switches;
sim_printf ("Loading boot code from %s%s\n", builtin_code ? "internal " : "", filename); sim_printf ("Loading boot code from %s%s\n", builtin_code ? "internal " : "", filename);
if (builtin_code) if (builtin_code)
@ -3639,6 +3663,7 @@ else
sprintf (args, "-O %s %X", filename, (int)offset); sprintf (args, "-O %s %X", filename, (int)offset);
r = load_cmd (0, args); r = load_cmd (0, args);
sim_set_memory_load_file (NULL, 0); sim_set_memory_load_file (NULL, 0);
sim_switches = saved_sim_switches;
return r; return r;
} }