update list_module
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1098 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
5a8d5a56cb
commit
384adb585d
|
@ -365,6 +365,8 @@ FINSH_FUNCTION_EXPORT(list_device, list device in system)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RT_USING_MODULE
|
#ifdef RT_USING_MODULE
|
||||||
|
#include <rtm.h>
|
||||||
|
|
||||||
int list_module(void)
|
int list_module(void)
|
||||||
{
|
{
|
||||||
struct rt_module *module;
|
struct rt_module *module;
|
||||||
|
@ -372,86 +374,113 @@ int list_module(void)
|
||||||
|
|
||||||
list = &rt_object_container[RT_Object_Class_Module].object_list;
|
list = &rt_object_container[RT_Object_Class_Module].object_list;
|
||||||
|
|
||||||
|
rt_kprintf("module name ref\n");
|
||||||
|
rt_kprintf("------------ --------\n");
|
||||||
for (node = list->next; node != list; node = node->next)
|
for (node = list->next; node != list; node = node->next)
|
||||||
{
|
{
|
||||||
struct rt_list_node *tlist;
|
|
||||||
struct rt_thread *thread;
|
|
||||||
rt_uint8_t* ptr;
|
|
||||||
|
|
||||||
module = (struct rt_module*)(rt_list_entry(node, struct rt_object, list));
|
module = (struct rt_module*)(rt_list_entry(node, struct rt_object, list));
|
||||||
rt_kprintf("______________________________________________________________________\n");
|
rt_kprintf("%-16s ", module->parent.name);
|
||||||
rt_kprintf("[module]%-8s \n", module->parent.name);
|
rt_kprintf("%-04d \n", module->nref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* list main thread in module */
|
FINSH_FUNCTION_EXPORT(list_module, list module in system)
|
||||||
if(module->module_thread != RT_NULL)
|
|
||||||
|
int list_module_obj(const char* name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct rt_module *module;
|
||||||
|
struct rt_list_node *list, *node;
|
||||||
|
|
||||||
|
/* find module */
|
||||||
|
if((module = rt_module_find(name)) != RT_NULL)
|
||||||
|
{
|
||||||
|
/* module has entry point */
|
||||||
|
if(!(module->parent.flag & RT_MODULE_FLAG_WITHOUTENTRY))
|
||||||
{
|
{
|
||||||
rt_kprintf("main thread pri status sp stack size max used left tick error\n");
|
struct rt_thread *thread;
|
||||||
rt_kprintf("------------- ---- ------- ---------- ---------- ---------- ---------- ---\n");
|
struct rt_list_node *tlist;
|
||||||
thread = module->module_thread;
|
rt_uint8_t* ptr;
|
||||||
rt_kprintf("%-8s 0x%02x", thread->name, thread->current_priority);
|
|
||||||
|
|
||||||
if (thread->stat == RT_THREAD_READY) rt_kprintf(" ready ");
|
/* list main thread in module */
|
||||||
else if (thread->stat == RT_THREAD_SUSPEND) rt_kprintf(" suspend");
|
if(module->module_thread != RT_NULL)
|
||||||
else if (thread->stat == RT_THREAD_INIT) rt_kprintf(" init ");
|
{
|
||||||
|
rt_kprintf("main thread pri status sp stack size max used left tick error\n");
|
||||||
|
rt_kprintf("------------- ---- ------- ---------- ---------- ---------- ---------- ---\n");
|
||||||
|
thread = module->module_thread;
|
||||||
|
rt_kprintf("%-8s 0x%02x", thread->name, thread->current_priority);
|
||||||
|
|
||||||
ptr = (rt_uint8_t*)thread->stack_addr;
|
if (thread->stat == RT_THREAD_READY) rt_kprintf(" ready ");
|
||||||
while (*ptr == '#')ptr ++;
|
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",
|
ptr = (rt_uint8_t*)thread->stack_addr;
|
||||||
thread->stack_size + ((rt_uint32_t)thread->stack_addr - (rt_uint32_t)thread->sp),
|
while (*ptr == '#')ptr ++;
|
||||||
thread->stack_size,
|
|
||||||
thread->stack_size - ((rt_uint32_t) ptr - (rt_uint32_t)thread->stack_addr),
|
|
||||||
thread->remaining_tick,
|
|
||||||
thread->error);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* list sub thread in module */
|
rt_kprintf(" 0x%08x 0x%08x 0x%08x 0x%08x %03d\n",
|
||||||
tlist = &module->module_object[RT_Object_Class_Thread].object_list;
|
thread->stack_size + ((rt_uint32_t)thread->stack_addr - (rt_uint32_t)thread->sp),
|
||||||
if(!rt_list_isempty(tlist)) _list_thread(tlist);
|
thread->stack_size,
|
||||||
|
thread->stack_size - ((rt_uint32_t) ptr - (rt_uint32_t)thread->stack_addr),
|
||||||
|
thread->remaining_tick,
|
||||||
|
thread->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* list sub thread in module */
|
||||||
|
tlist = &module->module_object[RT_Object_Class_Thread].object_list;
|
||||||
|
if(!rt_list_isempty(tlist)) _list_thread(tlist);
|
||||||
#ifdef RT_USING_SEMAPHORE
|
#ifdef RT_USING_SEMAPHORE
|
||||||
/* list semaphored in module */
|
/* list semaphored in module */
|
||||||
tlist = &module->module_object[RT_Object_Class_Semaphore].object_list;
|
tlist = &module->module_object[RT_Object_Class_Semaphore].object_list;
|
||||||
if(!rt_list_isempty(tlist)) _list_sem(tlist);
|
if(!rt_list_isempty(tlist)) _list_sem(tlist);
|
||||||
#endif
|
#endif
|
||||||
#ifdef RT_USING_MUTEX
|
#ifdef RT_USING_MUTEX
|
||||||
/* list mutex in module */
|
/* list mutex in module */
|
||||||
tlist = &module->module_object[RT_Object_Class_Mutex].object_list;
|
tlist = &module->module_object[RT_Object_Class_Mutex].object_list;
|
||||||
if(!rt_list_isempty(tlist)) _list_mutex(tlist);
|
if(!rt_list_isempty(tlist)) _list_mutex(tlist);
|
||||||
#endif
|
#endif
|
||||||
#ifdef RT_USING_EVENT
|
#ifdef RT_USING_EVENT
|
||||||
/* list event in module */
|
/* list event in module */
|
||||||
tlist = &module->module_object[RT_Object_Class_Event].object_list;
|
tlist = &module->module_object[RT_Object_Class_Event].object_list;
|
||||||
if(!rt_list_isempty(tlist)) _list_event(tlist);
|
if(!rt_list_isempty(tlist)) _list_event(tlist);
|
||||||
#endif
|
#endif
|
||||||
#ifdef RT_USING_MAILBOX
|
#ifdef RT_USING_MAILBOX
|
||||||
/* list mailbox in module */
|
/* list mailbox in module */
|
||||||
tlist = &module->module_object[RT_Object_Class_MailBox].object_list;
|
tlist = &module->module_object[RT_Object_Class_MailBox].object_list;
|
||||||
if(!rt_list_isempty(tlist)) _list_mailbox(tlist);
|
if(!rt_list_isempty(tlist)) _list_mailbox(tlist);
|
||||||
#endif
|
#endif
|
||||||
#ifdef RT_USING_MESSAGEQUEUE
|
#ifdef RT_USING_MESSAGEQUEUE
|
||||||
/* list message queue in module */
|
/* list message queue in module */
|
||||||
tlist = &module->module_object[RT_Object_Class_MessageQueue].object_list;
|
tlist = &module->module_object[RT_Object_Class_MessageQueue].object_list;
|
||||||
if(!rt_list_isempty(tlist)) _list_msgqueue(tlist);
|
if(!rt_list_isempty(tlist)) _list_msgqueue(tlist);
|
||||||
#endif
|
#endif
|
||||||
#ifdef RT_USING_MEMPOOL
|
#ifdef RT_USING_MEMPOOL
|
||||||
/* list memory pool in module */
|
/* list memory pool in module */
|
||||||
tlist = &module->module_object[RT_Object_Class_MemPool].object_list;
|
tlist = &module->module_object[RT_Object_Class_MemPool].object_list;
|
||||||
if(!rt_list_isempty(tlist)) _list_mempool(tlist);
|
if(!rt_list_isempty(tlist)) _list_mempool(tlist);
|
||||||
#endif
|
#endif
|
||||||
#ifdef RT_USING_DEVICE
|
#ifdef RT_USING_DEVICE
|
||||||
/* list device in module */
|
/* list device in module */
|
||||||
tlist = &module->module_object[RT_Object_Class_Device].object_list;
|
tlist = &module->module_object[RT_Object_Class_Device].object_list;
|
||||||
if(!rt_list_isempty(tlist)) _list_device(tlist);
|
if(!rt_list_isempty(tlist)) _list_device(tlist);
|
||||||
#endif
|
#endif
|
||||||
/* list timer in module */
|
/* list timer in module */
|
||||||
tlist = &module->module_object[RT_Object_Class_Timer].object_list;
|
tlist = &module->module_object[RT_Object_Class_Timer].object_list;
|
||||||
if(!rt_list_isempty(tlist)) _list_timer(tlist);
|
if(!rt_list_isempty(tlist)) _list_timer(tlist);
|
||||||
|
}
|
||||||
|
|
||||||
|
rt_kprintf("symbol address \n");
|
||||||
|
rt_kprintf("-------- ----------\n");
|
||||||
|
|
||||||
|
/* list module export symbols */
|
||||||
|
for(i=0; i<module->nsym; i++)
|
||||||
|
{
|
||||||
|
rt_kprintf("%s 0x%x\n", module->symtab[i].name, module->symtab[i].addr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rt_kprintf("______________________________________________________________________\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
FINSH_FUNCTION_EXPORT(list_module, list module in system)
|
FINSH_FUNCTION_EXPORT(list_module_obj, list module objects in system)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int list()
|
int list()
|
||||||
|
|
Loading…
Reference in New Issue