瀏覽代碼

remove thread dump

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@764 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong 15 年之前
父節點
當前提交
f419a1711b
共有 2 個文件被更改,包括 7 次插入56 次删除
  1. 0 55
      components/finsh/cmd.c
  2. 7 1
      components/finsh/shell.c

+ 0 - 55
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;

+ 7 - 1
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);