📄 kernel_debug.c
字号:
/* LEON2/3 LIBIO low-level routines Written by Jiri Gaisler. Copyright (C) 2004 Gaisler Research AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#include <sys/fsu_pthread_queue.h>#include <asm-leon/contextswitch.h>#include <asm-leon/leonbare_kernel.h>#include <asm-leon/leonbare_debug.h>#include <asm-leon/stack.h>#include <asm-leon/leonstack.h>#include <stdarg.h>void leonbare_sched_printqueue();int leonbare_sched_verify() {#ifdef LBDEBUG_DO_ASSERT int i,j; leonbare_thread_t c,d; for (i = 0;i< LEONBARE_RUNQ_NR;i++){ TAILQ_FOREACH(c, LEONBARE_KR_RUNQ(i), th_runq[i]) { LBPASSERT(c->th_runq_idx == i,"thread %s has wrong runq[%i] index (%i) ",LEONBARE_TH_NAME_DBG(c),i,c->th_runq_idx); if (TAILQ_NEXT(c,th_runq[i])) { LBPASSERT(c->th_account <= TAILQ_NEXT(c,th_runq[i])->th_account ,"thread %s account is not sorted (%i<=%i)",LEONBARE_TH_NAME_DBG(c),c->th_account,TAILQ_NEXT(c,th_runq[i])->th_account); } } } TAILQ_FOREACH(c, LEONBARE_KR_ALLQ, th_allq) { if ((j = c->th_runq_idx) != -1) { LBPASSERT(j >= 0 && j < LEONBARE_RUNQ_NR,"thread %s has wrong runq index (%i) ",LEONBARE_TH_NAME_DBG(c),c->th_runq_idx); TAILQ_FOREACH(d, LEONBARE_KR_RUNQ(j), th_runq[j]) { if (d == c) { break; } } /*LBPASSERT(d,"thread %s is not in runq[%i] ",LEONBARE_TH_NAME_DBG(c),j);*/ } }#endif } int leonbare_debug = 0;int leonbare_debug_printf(const char *fmt, ...) { va_list ap; va_start (ap, fmt); vprintf(fmt,ap); va_end (ap); return 0;} void leonbare_sched_printqueue() { int i,j; leonbare_thread_t c; for (i = 0;i< LEONBARE_RUNQ_NR;i++){ LBDEBUG_HEADER_PRINTF(LBDEBUG_QUEUE_NR,"runq[%i]:[",i); TAILQ_FOREACH(c, LEONBARE_KR_RUNQ(i), th_runq[i]) { LBDEBUG(LBDEBUG_QUEUE_NR,"%s[0x%x](%i),",LEONBARE_TH_NAME_DBG(c),c,c->th_account); } LBDEBUG(LBDEBUG_QUEUE_NR,"]\n",0); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -