Changes in kernel/generic/src/proc/thread.c [ae0300b5:96b02eb9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/thread.c
rae0300b5 r96b02eb9 239 239 * Switch thread to the ready state. 240 240 * 241 * @param t hreadThread to make ready.241 * @param t Thread to make ready. 242 242 * 243 243 */ … … 246 246 irq_spinlock_lock(&thread->lock, true); 247 247 248 ASSERT( thread->state != Ready);248 ASSERT(!(thread->state == Ready)); 249 249 250 250 int i = (thread->priority < RQ_COUNT - 1) … … 350 350 351 351 #ifdef CONFIG_UDEBUG 352 /* Initialize debugging stuff */ 353 thread->btrace = false; 352 /* Init debugging stuff */ 354 353 udebug_thread_initialize(&thread->udebug); 355 354 #endif … … 536 535 /** Detach thread. 537 536 * 538 * Mark the thread as detached . If the thread is already539 * in the Lingeringstate, deallocate its resources.537 * Mark the thread as detached, if the thread is already in the Lingering 538 * state, deallocate its resources. 540 539 * 541 540 * @param thread Thread to be detached. … … 591 590 order_suffix(thread->kcycles, &kcycles, &ksuffix); 592 591 593 char *name;594 if (str_cmp(thread->name, "uinit") == 0)595 name = thread->task->name;596 else597 name = thread->name;598 599 592 #ifdef __32_BITS__ 600 593 if (*additional) 601 printf("%-8" PRIu64 " %10p%10p %9" PRIu64 "%c %9" PRIu64 "%c ",602 thread->tid, thread-> thread_code, thread->kstack,603 ucycles, usuffix,kcycles, ksuffix);594 printf("%-8" PRIu64" %10p %9" PRIu64 "%c %9" PRIu64 "%c ", 595 thread->tid, thread->kstack, ucycles, usuffix, 596 kcycles, ksuffix); 604 597 else 605 printf("%-8" PRIu64 " %-14s %10p %-8s %10p %-5" PRIu32 "\n",606 thread->tid, name, thread, thread_states[thread->state],607 thread->task, thread->task->context );598 printf("%-8" PRIu64" %-14s %10p %-8s %10p %-5" PRIu32 " %10p\n", 599 thread->tid, thread->name, thread, thread_states[thread->state], 600 thread->task, thread->task->context, thread->thread_code); 608 601 #endif 609 602 610 603 #ifdef __64_BITS__ 611 604 if (*additional) 612 printf("%-8" PRIu64 605 printf("%-8" PRIu64" %18p %18p\n" 613 606 " %9" PRIu64 "%c %9" PRIu64 "%c ", 614 607 thread->tid, thread->thread_code, thread->kstack, 615 608 ucycles, usuffix, kcycles, ksuffix); 616 609 else 617 printf("%-8" PRIu64 618 thread->tid, name, thread, thread_states[thread->state],610 printf("%-8" PRIu64" %-14s %18p %-8s %18p %-5" PRIu32 "\n", 611 thread->tid, thread->name, thread, thread_states[thread->state], 619 612 thread->task, thread->task->context); 620 613 #endif … … 654 647 #ifdef __32_BITS__ 655 648 if (additional) 656 printf("[id ] [ code ] [stack ] [ucycles ] [kcycles]"657 " [ cpu] [waitqueue]\n");649 printf("[id ] [stack ] [ucycles ] [kcycles ] [cpu]" 650 " [waitqueue]\n"); 658 651 else 659 652 printf("[id ] [name ] [address ] [state ] [task ]" 660 " [ctx] \n");653 " [ctx] [code ]\n"); 661 654 #endif 662 655 … … 747 740 ASSERT(interrupts_disabled()); 748 741 ASSERT(irq_spinlock_locked(&threads_lock)); 749 742 750 743 thread_iterator_t iterator; 751 744 … … 758 751 } 759 752 760 #ifdef CONFIG_UDEBUG761 762 void thread_stack_trace(thread_id_t thread_id)763 {764 irq_spinlock_lock(&threads_lock, true);765 766 thread_t *thread = thread_find_by_id(thread_id);767 if (thread == NULL) {768 printf("No such thread.\n");769 irq_spinlock_unlock(&threads_lock, true);770 return;771 }772 773 irq_spinlock_lock(&thread->lock, false);774 775 /*776 * Schedule a stack trace to be printed777 * just before the thread is scheduled next.778 *779 * If the thread is sleeping then try to interrupt780 * the sleep. Any request for printing an uspace stack781 * trace from within the kernel should be always782 * considered a last resort debugging means, therefore783 * forcing the thread's sleep to be interrupted784 * is probably justifiable.785 */786 787 bool sleeping = false;788 istate_t *istate = thread->udebug.uspace_state;789 if (istate != NULL) {790 printf("Scheduling thread stack trace.\n");791 thread->btrace = true;792 if (thread->state == Sleeping)793 sleeping = true;794 } else795 printf("Thread interrupt state not available.\n");796 797 irq_spinlock_unlock(&thread->lock, false);798 799 if (sleeping)800 waitq_interrupt_sleep(thread);801 802 irq_spinlock_unlock(&threads_lock, true);803 }804 805 #endif /* CONFIG_UDEBUG */806 753 807 754 /** Process syscall to create new thread. … … 846 793 * has already been created. We need to undo its 847 794 * creation now. 795 * 848 796 */ 849 797 … … 867 815 * THREAD_B events for threads that already existed 868 816 * and could be detected with THREAD_READ before. 817 * 869 818 */ 870 819 udebug_thread_b_event_attach(thread, TASK);
Note:
See TracChangeset
for help on using the changeset viewer.