From 4771f09e1e75e9df8a77540f136b72dbd8fe2f63 Mon Sep 17 00:00:00 2001 From: Dennis Boone Date: Tue, 23 Jun 2020 17:35:53 -0400 Subject: [PATCH] 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. --- em.1 | 2 +- em.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/em.1 b/em.1 index 7f1faae..c772ee3 100644 --- a/em.1 +++ b/em.1 @@ -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 diff --git a/em.c b/em.c index 635915e..d3b1976 100644 --- a/em.c +++ b/em.c @@ -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.traceinstcount) && (TRACEUSER && ((gv.traceseg == 0) || (gv.traceseg == (RPH & 0xFFF))))