comparison packages/infra/current/src/simple.cxx @ 70:c5536bad4c24 ecos-sw-2000-02-11

Merge from eCos master repository on 2000-02-11-15:46:40-GMT
author jlarmour
date Fri, 11 Feb 2000 16:47:32 +0000
parents bf00f99aec69
children 9c122302a886
comparison
equal deleted inserted replaced
69:9a9babddf7e7 70:c5536bad4c24
368 368
369 DIAG_DEVICE_END_SYNC(); 369 DIAG_DEVICE_END_SYNC();
370 HAL_RESTORE_INTERRUPTS(old_ints); 370 HAL_RESTORE_INTERRUPTS(old_ints);
371 }; 371 };
372 372
373 // -------------------------------------------------------------------------
374
375 externC void
376 cyg_trace_dump(void)
377 {
378 #if defined(CYGPKG_KERNEL) && defined(CYG_DIAG_PRINTF)
379
380 {
381 diag_printf("\nScheduler:\n\n");
382
383 Cyg_Scheduler *sched = &Cyg_Scheduler::scheduler;
384
385 diag_printf("Lock: %d\n",sched->get_sched_lock() );
386
387 # ifdef CYGVAR_KERNEL_THREADS_NAME
388
389 diag_printf("Current Thread: %s\n",sched->get_current_thread()->get_name());
390
391 # else
392
393 diag_printf("Current Thread: %d\n",sched->get_current_thread()->get_unique_id());
394
395 # endif
396
397 }
398
399 # ifdef CYGVAR_KERNEL_THREADS_LIST
400
401 {
402 Cyg_Thread *t = Cyg_Thread::get_list_head();
403
404 diag_printf("\nThreads:\n\n");
405
406 while( NULL != t )
407 {
408 cyg_uint32 state = t->get_state();
409 char tstate[7];
410 char *tstate1 = "SCUKX";
411 static char *(reasons[8]) =
412 {
413 "NONE", // No recorded reason
414 "WAIT", // Wait with no timeout
415 "DELAY", // Simple time delay
416 "TIMEOUT", // Wait with timeout/timeout expired
417 "BREAK", // forced break out of sleep
418 "DESTRUCT", // wait object destroyed[note]
419 "EXIT", // forced termination
420 "DONE" // Wait/delay complete
421 };
422
423 if( 0 != state )
424 {
425 // Knock out chars that do not correspond to set bits.
426 for( int i = 0; i < 6 ; i++ )
427 if( 0 == (state & (1<<i)) )
428 tstate[i] = ' ';
429 else tstate[i] = tstate1[i];
430 tstate[6] = 0;
431 }
432 else tstate[0] = 'R', tstate[1] = 0;
433
434 # ifdef CYGVAR_KERNEL_THREADS_NAME
435
436 diag_printf( "%20s pri = %3d state = %6s id = %3d\n",
437 t->get_name(),
438 t->get_priority(),
439 tstate,
440 t->get_unique_id()
441 );
442 # else
443
444 diag_printf( "Thread %3d pri = %3d state = %6s\n",
445 t->get_unique_id(),
446 t->get_priority(),
447 tstate
448 );
449
450 # endif
451 diag_printf( "%20s stack base = %08x ptr = %08x size = %08x\n",
452 "",
453 t->get_stack_base(),
454 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT
455 t->get_saved_context(),
456 #else
457 0,
458 #endif
459 t->get_stack_size()
460 );
461
462 diag_printf( "%20s sleep reason %8s wake reason %8s\n",
463 "",
464 reasons[t->get_sleep_reason()],
465 reasons[t->get_wake_reason()]
466 );
467
468 diag_printf( "%20s queue = %08x wait info = %08x\n",
469 "",
470 t->get_current_queue(),
471 t->get_wait_info()
472 );
473
474 diag_printf("\n");
475 t = t->get_list_next();
476 }
477
478 }
479 # endif // CYGVAR_KERNEL_THREADS_LIST
480
481 #endif // CYG_DIAG_PRINTF
482 }
483
373 #endif // CYGDBG_USE_TRACING 484 #endif // CYGDBG_USE_TRACING
374 485
375 // ------------------------------------------------------------------------- 486 // -------------------------------------------------------------------------
376 // Assert functions: 487 // Assert functions:
377 488