diff options
| author | Alastair Reid | 2018-06-28 17:12:13 +0100 |
|---|---|---|
| committer | Alastair Reid | 2018-06-28 17:40:02 +0100 |
| commit | 7dc09d0693d042867e73420acd4ff88707dc6da2 (patch) | |
| tree | a63d009b9c69ac7f5febe42cb3ef8fb46317c507 /lib | |
| parent | b98b4f1181f6b3a3f239ade0ab407771cae35867 (diff) | |
RTS: Add --verbosity flag to C model
This is interpreted as a set of bits that control various bits of output.
Bit 0 is print the PC on every cycle.
(It would probably be useful to standardise a few of these flags across
all models. Other candidates are accesses to physical memory, throwing
SAIL exceptions, current privilege level, ...)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/rts.c | 21 | ||||
| -rw-r--r-- | lib/rts.h | 8 |
2 files changed, 26 insertions, 3 deletions
@@ -30,6 +30,13 @@ unit sail_exit(unit u) return UNIT; } +static uint64_t g_verbosity = 0; + +mach_bits sail_get_verbosity(const unit u) +{ + return g_verbosity; +} + bool g_sleeping = false; unit sleep_request(const unit u) @@ -434,12 +441,13 @@ void get_cycle_count(sail_int *rop, const unit u) /* ***** Argument Parsing ***** */ static struct option options[] = { - {"elf", required_argument, 0, 'e'}, - {"entry", required_argument, 0, 'n'}, - {"image", required_argument, 0, 'i'}, {"binary", required_argument, 0, 'b'}, {"cyclelimit", required_argument, 0, 'l'}, {"config", required_argument, 0, 'C'}, + {"elf", required_argument, 0, 'e'}, + {"entry", required_argument, 0, 'n'}, + {"image", required_argument, 0, 'i'}, + {"verbosity", required_argument, 0, 'v'}, {0, 0, 0, 0} }; @@ -517,6 +525,13 @@ int process_arguments(int argc, char *argv[]) } break; + case 'v': + if (!sscanf(optarg, "0x%" PRIx64, &g_verbosity)) { + fprintf(stderr, "Could not parse verbosity flags %s\n", optarg); + return -1; + } + break; + default: fprintf(stderr, "Unrecognized option %s\n", optarg); return -1; @@ -21,6 +21,14 @@ unit sail_assert(bool b, sail_string msg); unit sail_exit(unit); /* + * sail_get_verbosity reads a 64-bit value that the C runtime allows you to set + * on the command line. + * The intention is that you can use individual bits to turn on/off different + * pieces of debugging output. + */ +mach_bits sail_get_verbosity(const unit u); + +/* * Put processor to sleep until an external device calls wakeup_request(). */ unit sleep_request(const unit u); |
