From f419a1711bb5863b9f1ef865131057e1560907f2 Mon Sep 17 00:00:00 2001 From: "bernard.xiong" Date: Wed, 9 Jun 2010 07:54:40 +0000 Subject: [PATCH] remove thread dump git-svn-id: https://rt-thread.googlecode.com/svn/trunk@764 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/finsh/cmd.c | 55 ---------------------------------------- components/finsh/shell.c | 8 +++++- 2 files changed, 7 insertions(+), 56 deletions(-) diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index 8047fbc977..5ed5d42cd7 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -107,61 +107,6 @@ long list_thread(void) } FINSH_FUNCTION_EXPORT(list_thread, list thread); -#if 0 -long dump_thread(rt_thread_t tid) -{ - rt_uint8_t *ptr; - rt_uint32_t sp; - rt_thread_t thread; - - rt_kprintf(" thread pri status sp stack size max used left tick error\n"); - rt_kprintf("-------- ---- ------- ---------- ---------- ---------- ---------- ---\n"); - - thread = rt_thread_self(); - if ((thread == tid) || (tid == RT_NULL)) /* it's current thread */ - { - ptr = (rt_uint8_t*)thread->stack_addr; - while (*ptr == '#')ptr ++; - sp = (rt_uint32_t)__current_sp(); - rt_kprintf("%-8s 0x%02x", thread->name, thread->current_priority); - - if (thread->stat == RT_THREAD_READY) rt_kprintf(" ready "); - else if (thread->stat == RT_THREAD_SUSPEND) rt_kprintf(" suspend"); - else if (thread->stat == RT_THREAD_INIT) rt_kprintf(" init "); - - rt_kprintf(" 0x%08x 0x%08x 0x%08x 0x%08x %03d\n", - thread->stack_size + ((rt_uint32_t)thread->stack_addr - sp), - thread->stack_size, - thread->stack_size - ((rt_uint32_t) ptr - (rt_uint32_t)thread->stack_addr), - thread->remaining_tick, - thread->error); - } - else - { - thread = tid; - sp = (rt_uint32_t)thread->sp; - - ptr = (rt_uint8_t*)thread->stack_addr; - while (*ptr == '#')ptr ++; - - rt_kprintf("%-8s 0x%02x", thread->name, thread->current_priority); - - if (thread->stat == RT_THREAD_READY) rt_kprintf(" ready "); - else if (thread->stat == RT_THREAD_SUSPEND) rt_kprintf(" suspend"); - else if (thread->stat == RT_THREAD_INIT) rt_kprintf(" init "); - - rt_kprintf(" 0x%08x 0x%08x 0x%08x 0x%08x %03d\n", - thread->stack_size + ((rt_uint32_t)thread->stack_addr - sp), - thread->stack_size, - thread->stack_size - ((rt_uint32_t) ptr - (rt_uint32_t)thread->stack_addr), - thread->remaining_tick, - thread->error); - } - - return 0; -} -#endif - static void show_wait_queue(struct rt_list_node* list) { struct rt_thread *thread; diff --git a/components/finsh/shell.c b/components/finsh/shell.c index 854dd61a7b..fc1b9acb38 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -436,7 +436,13 @@ void finsh_system_init(void) shell = (struct finsh_shell*)rt_malloc(sizeof(struct finsh_shell)); #else shell = &_shell; -#endif +#endif + if (shell == RT_NULL) + { + rt_kprintf("no memory for shell\n"); + return; + } + memset(shell, 0, sizeof(struct finsh_shell)); rt_sem_init(&(shell->rx_sem), "shrx", 0, 0);