1
0
mirror of https://github.com/prirun/p50em.git synced 2026-01-13 23:26:13 +00:00

Minor tracing enhancements

Deconflict some values of instruction count with some of the
other tracing options by making it require a leading # before
the integer count.

Add/fix support for tracing execution within a designated segno.

Announce to the trace file that tracing is initialized.
This commit is contained in:
Dennis Boone 2020-06-23 17:35:53 -04:00
parent 6bf6e2ea48
commit 4771f09e1e
2 changed files with 18 additions and 4 deletions

2
em.1
View File

@ -275,7 +275,7 @@ all|Everything
flush|Flush trace file after each write
tlb|STLB and IOTLB changes
OWNERL|Execution of this PCB
instruction count|Begin after specified number of instructions
#instruction count|Begin after specified number of instructions
octal segno|Execution in the given segment number
process number|Execution of this user number
.TE

20
em.c
View File

@ -4608,12 +4608,12 @@ int main (int argc, char **argv) {
gv.traceflags |= T_TLB;
else if (isdigit(argv[i][0]) && strlen(argv[i]) <= 3 && sscanf(argv[i],"%d", &templ) == 1)
gv.traceuser = 0100000 | (templ<<6); /* form OWNERL for user # */
else if (isdigit(argv[i][0]) && sscanf(argv[i],"%d", &templ) == 1)
gv.traceinstcount = templ;
else if (strlen(argv[i]) == 6 && sscanf(argv[i],"%o", &templ) == 1)
gv.traceuser = templ; /* specify OWNERL directly */
else if (strlen(argv[i]) == 4 && sscanf(argv[i],"%o", &templ) == 1)
gv.traceseg = templ; /* specify RPH segno */
else if (argv[i][0] == '#' && sscanf(argv[i]+1,"%d", &templ) == 1)
gv.traceinstcount = templ;
else if (strlen(argv[i]) <= 8 && argv[i][0] != '-') {
if (gv.numtraceprocs >= MAXTRACEPROCS)
fprintf(stderr,"Only %d trace procs are allowed\n", MAXTRACEPROCS);
@ -4704,6 +4704,7 @@ int main (int argc, char **argv) {
/* finish setting up tracing after all options are read, ie, maps */
#ifndef NOTRACE
TRACEA("Trace file initialized\n");
TRACEA("Trace flags = 0x%x\n", gv.traceflags);
gv.savetraceflags = gv.traceflags;
gv.traceflags = 0;
@ -4713,6 +4714,14 @@ int main (int argc, char **argv) {
TRACEA("Tracing enabled for all users\n");
if (gv.traceinstcount != 0)
TRACEA("Tracing enabled after instruction %u\n", gv.traceinstcount);
if (gv.traceseg != 0)
{
TRACEA("Tracing enabled for segment %04o\n", gv.traceseg);
/* This could be splattering other settings that aren't really
compatible with RPH trace. C'est la vie? */
gv.savetraceflags |= T_FLOW;
gv.tracetriggered = 0;
}
for (i=0; i<gv.numtraceprocs; i++) {
for (j=0; j<numsyms; j++) {
if (strcasecmp(mapsym[j].symname, traceprocs[i].name) == 0 && mapsym[j].symtype == 'e') {
@ -4939,7 +4948,12 @@ fetch:
#endif
#ifndef NOTRACE
gv.traceflags = 0;
if (gv.traceseg != 0)
if (gv.traceseg == (RPH & 0xFFF))
gv.tracetriggered = 1;
else
gv.tracetriggered = 0;
gv.traceflags = 0;
if (gv.tracetriggered &&
(gv.instcount >= gv.traceinstcount) &&
(TRACEUSER && ((gv.traceseg == 0) || (gv.traceseg == (RPH & 0xFFF))))