From 46876e7b76884fb5134386c0462601644c847927 Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Wed, 14 Apr 2010 18:09:38 +0100 Subject: [PATCH] run_avr: Add a way to trace just interruots vectors Calling run_avr with -ti will trace the scheduling of that pacticular vector. You can have up to 8 traces. Signed-off-by: Michel Pollet --- simavr/sim/run_avr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/simavr/sim/run_avr.c b/simavr/sim/run_avr.c index 79879b9..ebc8b93 100644 --- a/simavr/sim/run_avr.c +++ b/simavr/sim/run_avr.c @@ -56,6 +56,8 @@ int main(int argc, char *argv[]) int gdb = 0; char name[16] = ""; uint32_t loadBase = AVR_SEGMENT_OFFSET_FLASH; + int trace_vectors[8] = {0}; + int trace_vectors_count = 0; if (argc == 1) display_usage(basename(argv[0])); @@ -75,6 +77,9 @@ int main(int argc, char *argv[]) display_usage(basename(argv[0])); } else if (!strcmp(argv[pi], "-t") || !strcmp(argv[pi], "-trace")) { trace++; + } else if (!strcmp(argv[pi], "-ti")) { + if (pi < argc-1) + trace_vectors[trace_vectors_count++] = atoi(argv[++pi]); } else if (!strcmp(argv[pi], "-g") || !strcmp(argv[pi], "-gdb")) { gdb++; } else if (!strcmp(argv[pi], "-ee")) { @@ -134,6 +139,9 @@ int main(int argc, char *argv[]) avr->pc = f.flashbase; } avr->trace = trace; + for (int ti = 0; ti < trace_vectors_count; ti++) + if (avr->vector[trace_vectors[ti]]) + avr->vector[trace_vectors[ti]]->trace++; // even if not setup at startup, activate gdb if crashing avr->gdb_port = 1234; -- 2.39.5