1
0
mirror of https://github.com/open-simh/simh.git synced 2026-05-05 23:54:03 +00:00

SCP: Extended debugging to allow for unit specific debug for disk and tape

This commit is contained in:
Mark Pizzolato
2018-04-07 21:38:26 -07:00
parent 81bcd6d319
commit 28e4311039
7 changed files with 222 additions and 102 deletions

View File

@@ -178,7 +178,7 @@ if ((!callback) || !ctx->asynch_io)
\
pthread_mutex_lock (&ctx->io_lock); \
\
sim_debug (ctx->dbit, ctx->dptr, \
sim_debug_unit (ctx->dbit, uptr, \
"sim_tape AIO_CALL(op=%d, unit=%d)\n", op, (int)(uptr-ctx->dptr->units));\
\
if (ctx->callback) \
@@ -229,7 +229,7 @@ struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
this thread needs to run */
sim_os_set_thread_priority (PRIORITY_ABOVE_NORMAL);
sim_debug (ctx->dbit, ctx->dptr, "_tape_io(unit=%d) starting\n", (int)(uptr-ctx->dptr->units));
sim_debug_unit (ctx->dbit, uptr, "_tape_io(unit=%d) starting\n", (int)(uptr-ctx->dptr->units));
pthread_mutex_lock (&ctx->io_lock);
pthread_cond_signal (&ctx->startup_cond); /* Signal we're ready to go */
@@ -298,7 +298,7 @@ struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
}
pthread_mutex_unlock (&ctx->io_lock);
sim_debug (ctx->dbit, ctx->dptr, "_tape_io(unit=%d) exiting\n", (int)(uptr-ctx->dptr->units));
sim_debug_unit (ctx->dbit, uptr, "_tape_io(unit=%d) exiting\n", (int)(uptr-ctx->dptr->units));
return NULL;
}
@@ -317,7 +317,7 @@ static void _tape_completion_dispatch (UNIT *uptr)
struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
TAPE_PCALLBACK callback = ctx->callback;
sim_debug (ctx->dbit, ctx->dptr, "_tape_completion_dispatch(unit=%d, top=%d, callback=%p)\n", (int)(uptr-ctx->dptr->units), ctx->io_top, ctx->callback);
sim_debug_unit (ctx->dbit, uptr, "_tape_completion_dispatch(unit=%d, top=%d, callback=%p)\n", (int)(uptr-ctx->dptr->units), ctx->io_top, ctx->callback);
if (ctx->io_top != TOP_DONE)
abort(); /* horribly wrong, stop */
@@ -342,7 +342,7 @@ static t_bool _tape_is_active (UNIT *uptr)
struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
if (ctx) {
sim_debug (ctx->dbit, ctx->dptr, "_tape_is_active(unit=%d, top=%d)\n", (int)(uptr-ctx->dptr->units), ctx->io_top);
sim_debug_unit (ctx->dbit, uptr, "_tape_is_active(unit=%d, top=%d)\n", (int)(uptr-ctx->dptr->units), ctx->io_top);
return (ctx->io_top != TOP_DONE);
}
return FALSE;
@@ -353,7 +353,7 @@ static t_bool _tape_cancel (UNIT *uptr)
struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
if (ctx) {
sim_debug (ctx->dbit, ctx->dptr, "_tape_cancel(unit=%d, top=%d)\n", (int)(uptr-ctx->dptr->units), ctx->io_top);
sim_debug_unit (ctx->dbit, uptr, "_tape_cancel(unit=%d, top=%d)\n", (int)(uptr-ctx->dptr->units), ctx->io_top);
if (ctx->asynch_io) {
pthread_mutex_lock (&ctx->io_lock);
while (ctx->io_top != TOP_DONE)
@@ -1174,7 +1174,7 @@ t_stat st;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_rdrecf(unit=%d, buf=%p, max=%d)\n", (int)(uptr-ctx->dptr->units), buf, max);
sim_debug_unit (ctx->dbit, uptr, "sim_tape_rdrecf(unit=%d, buf=%p, max=%d)\n", (int)(uptr-ctx->dptr->units), buf, max);
opos = uptr->pos; /* old position */
st = sim_tape_rdrlfwd (uptr, &tbc); /* read rec lnt */
@@ -1241,7 +1241,7 @@ t_stat st;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_rdrecr(unit=%d, buf=%p, max=%d)\n", (int)(uptr-ctx->dptr->units), buf, max);
sim_debug_unit (ctx->dbit, uptr, "sim_tape_rdrecr(unit=%d, buf=%p, max=%d)\n", (int)(uptr-ctx->dptr->units), buf, max);
st = sim_tape_rdrlrev (uptr, &tbc); /* read rec lnt */
if (st != MTSE_OK)
@@ -1294,7 +1294,7 @@ t_mtrlnt sbc;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_wrrecf(unit=%d, buf=%p, bc=%d)\n", (int)(uptr-ctx->dptr->units), buf, bc);
sim_debug_unit (ctx->dbit, uptr, "sim_tape_wrrecf(unit=%d, buf=%p, bc=%d)\n", (int)(uptr-ctx->dptr->units), buf, bc);
sim_tape_data_trace(uptr, buf, bc, "Record Write", ctx->dptr->dctrl & MTSE_DBG_DAT, MTSE_DBG_STR);
MT_CLR_PNU (uptr);
@@ -1377,7 +1377,7 @@ struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_wrtmk(unit=%d)\n", (int)(uptr-ctx->dptr->units));
sim_debug_unit (ctx->dbit, uptr, "sim_tape_wrtmk(unit=%d)\n", (int)(uptr-ctx->dptr->units));
if (MT_GET_FMT (uptr) == MTUF_F_P7B) { /* P7B? */
uint8 buf = P7B_EOF; /* eof mark */
return sim_tape_wrrecf (uptr, &buf, 1); /* write char */
@@ -1403,7 +1403,7 @@ struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_wreom(unit=%d)\n", (int)(uptr-ctx->dptr->units));
sim_debug_unit (ctx->dbit, uptr, "sim_tape_wreom(unit=%d)\n", (int)(uptr-ctx->dptr->units));
if (MT_GET_FMT (uptr) == MTUF_F_P7B) /* cant do P7B */
return MTSE_FMT;
@@ -1433,7 +1433,7 @@ t_stat r;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_wreomrw(unit=%d)\n", (int)(uptr-ctx->dptr->units));
sim_debug_unit (ctx->dbit, uptr, "sim_tape_wreomrw(unit=%d)\n", (int)(uptr-ctx->dptr->units));
if (MT_GET_FMT (uptr) == MTUF_F_P7B) /* cant do P7B */
return MTSE_FMT;
r = sim_tape_wrdata (uptr, MTR_EOM);
@@ -1868,7 +1868,7 @@ const uint32 byte_length = (gaplen * density) / 10; /* the size of the reque
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_wrgap(unit=%d, gaplen=%u)\n", (int)(uptr-ctx->dptr->units), gaplen);
sim_debug_unit (ctx->dbit, uptr, "sim_tape_wrgap(unit=%d, gaplen=%u)\n", (int)(uptr-ctx->dptr->units), gaplen);
if (density == 0) /* if the density has not been set */
return MTSE_IOERR; /* then report an I/O error */
@@ -1964,7 +1964,7 @@ t_stat st;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_sprecf(unit=%d)\n", (int)(uptr-ctx->dptr->units));
sim_debug_unit (ctx->dbit, uptr, "sim_tape_sprecf(unit=%d)\n", (int)(uptr-ctx->dptr->units));
st = sim_tape_rdrlfwd (uptr, bc); /* get record length */
*bc = MTR_L (*bc);
@@ -2007,7 +2007,7 @@ t_mtrlnt tbc;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_sprecsf(unit=%d, count=%d)\n", (int)(uptr-ctx->dptr->units), count);
sim_debug_unit (ctx->dbit, uptr, "sim_tape_sprecsf(unit=%d, count=%d)\n", (int)(uptr-ctx->dptr->units), count);
*skipped = 0;
while (*skipped < count) { /* loopo */
@@ -2054,7 +2054,7 @@ t_stat st;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_sprecr(unit=%d)\n", (int)(uptr-ctx->dptr->units));
sim_debug_unit (ctx->dbit, uptr, "sim_tape_sprecr(unit=%d)\n", (int)(uptr-ctx->dptr->units));
if (MT_TST_PNU (uptr)) {
MT_CLR_PNU (uptr);
@@ -2103,7 +2103,7 @@ t_mtrlnt tbc;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_sprecsr(unit=%d, count=%d)\n", (int)(uptr-ctx->dptr->units), count);
sim_debug_unit (ctx->dbit, uptr, "sim_tape_sprecsr(unit=%d, count=%d)\n", (int)(uptr-ctx->dptr->units), count);
*skipped = 0;
while (*skipped < count) { /* loopo */
@@ -2154,7 +2154,7 @@ uint32 filerecsskipped;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_spfilebyrecf(unit=%d, count=%d, check_leot=%d)\n", (int)(uptr-ctx->dptr->units), count, check_leot);
sim_debug_unit (ctx->dbit, uptr, "sim_tape_spfilebyrecf(unit=%d, count=%d, check_leot=%d)\n", (int)(uptr-ctx->dptr->units), count, check_leot);
if (check_leot) {
t_mtrlnt rbc;
@@ -2224,7 +2224,7 @@ uint32 totalrecsskipped;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_spfilef(unit=%d, count=%d)\n", (int)(uptr-ctx->dptr->units), count);
sim_debug_unit (ctx->dbit, uptr, "sim_tape_spfilef(unit=%d, count=%d)\n", (int)(uptr-ctx->dptr->units), count);
return sim_tape_spfilebyrecf (uptr, count, skipped, &totalrecsskipped, FALSE);
}
@@ -2267,7 +2267,7 @@ uint32 filerecsskipped;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_spfilebyrecr(unit=%d, count=%d)\n", (int)(uptr-ctx->dptr->units), count);
sim_debug_unit (ctx->dbit, uptr, "sim_tape_spfilebyrecr(unit=%d, count=%d)\n", (int)(uptr-ctx->dptr->units), count);
*skipped = 0;
*recsskipped = 0;
@@ -2322,7 +2322,7 @@ uint32 totalrecsskipped;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_spfiler(unit=%d, count=%d)\n", (int)(uptr-ctx->dptr->units), count);
sim_debug_unit (ctx->dbit, uptr, "sim_tape_spfiler(unit=%d, count=%d)\n", (int)(uptr-ctx->dptr->units), count);
return sim_tape_spfilebyrecr (uptr, count, skipped, &totalrecsskipped);
}
@@ -2345,7 +2345,7 @@ struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
if (uptr->flags & UNIT_ATT) {
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n");/* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_rewind(unit=%d)\n", (int)(uptr-ctx->dptr->units));
sim_debug_unit (ctx->dbit, uptr, "sim_tape_rewind(unit=%d)\n", (int)(uptr-ctx->dptr->units));
}
uptr->pos = 0;
MT_CLR_PNU (uptr);
@@ -2370,7 +2370,7 @@ t_stat r = MTSE_OK;
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_position(unit=%d, flags=0x%X, recs=%d, files=%d)\n", (int)(uptr-ctx->dptr->units), flags, recs, files);
sim_debug_unit (ctx->dbit, uptr, "sim_tape_position(unit=%d, flags=0x%X, recs=%d, files=%d)\n", (int)(uptr-ctx->dptr->units), flags, recs, files);
*recsskipped = *filesskipped = *objectsskipped = 0;
if (flags & MTPOS_M_REW)
@@ -2436,7 +2436,7 @@ if (!(uptr->flags & UNIT_ATT)) /* attached? */
if (ctx == NULL) /* if not properly attached? */
return sim_messagef (SCPE_IERR, "Bad Attach\n"); /* that's a problem */
sim_debug (ctx->dbit, ctx->dptr, "sim_tape_reset(unit=%d)\n", (int)(uptr-ctx->dptr->units));
sim_debug_unit (ctx->dbit, uptr, "sim_tape_reset(unit=%d)\n", (int)(uptr-ctx->dptr->units));
_sim_tape_io_flush(uptr);
AIO_VALIDATE;