From 9372906a093ed962e8b924dca65fbf5c77fc6a16 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 22 May 2014 16:17:48 -0500 Subject: main_dump_all_cpus.c: Stop at end of args or CPUs --- schedsim/shell/shared/main_dump_all_cpus.c | 38 +++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/schedsim/shell/shared/main_dump_all_cpus.c b/schedsim/shell/shared/main_dump_all_cpus.c index 1c141e1..5f55298 100644 --- a/schedsim/shell/shared/main_dump_all_cpus.c +++ b/schedsim/shell/shared/main_dump_all_cpus.c @@ -59,7 +59,7 @@ int main_dump_all_cpus(int argc, char **argv) * Now verify the thread on each processor. */ mismatch = false; - for ( cpu=0 ; cpu < rtems_get_processor_count() ; cpu++ ) { + for ( cpu=0 ; cpu < rtems_get_processor_count() && cpu < argc ; cpu++ ) { e = _Per_CPU_Information[cpu].per_cpu.executing; if ( argv[cpu + 1][ 0 ] == '-' ) @@ -68,14 +68,34 @@ int main_dump_all_cpus(int argc, char **argv) if ( lookup_task( argv[cpu + 1], &id ) ) return -1; - if ( e->Object.id != id ) { - mismatch = true; - printf( - "*** ERROR on CPU %d Expected 0x%08x found 0x%08x executing\n", - cpu, - id, - e->Object.id - ); + if ( !strcmp( argv[cpu + 1], "IDLE" )) { + /* XXX should do something cleaner for the ID mask */ + if ( (e->Object.id & 0xFFFF0000) != 0x09010000 ) { + mismatch = true; + printf( + "*** ERROR on CPU %d Expected an IDLE found 0x%08x executing\n", + cpu, + e->Object.id + ); + } + } else { + if ( lookup_task( argv[cpu + 1], &id ) ) { + printf( + "*** ERROR in scenario -- unknown task %s\n", + argv[cpu + 1] + ); + exit( 1 ); + } + + if ( e->Object.id != id ) { + mismatch = true; + printf( + "*** ERROR on CPU %d Expected 0x%08x found 0x%08x executing\n", + cpu, + id, + e->Object.id + ); + } } } if ( mismatch ) { -- cgit v1.2.3