[rtems-schedsim commit] main_dump_all_cpus.c: Stop at end of args or CPUs

Joel Sherrill joel at rtems.org
Thu May 22 21:09:41 UTC 2014


Module:    rtems-schedsim
Branch:    master
Commit:    9372906a093ed962e8b924dca65fbf5c77fc6a16
Changeset: http://git.rtems.org/rtems-schedsim/commit/?id=9372906a093ed962e8b924dca65fbf5c77fc6a16

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Thu May 22 16:17:48 2014 -0500

main_dump_all_cpus.c: Stop at end of args or CPUs

---

 schedsim/shell/shared/main_dump_all_cpus.c |   38 +++++++++++++++++++++------
 1 files 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 ) {




More information about the vc mailing list