update list_module

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1098 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
qiuyiuestc 2010-11-23 01:20:53 +00:00
parent 5a8d5a56cb
commit 384adb585d
1 changed files with 82 additions and 53 deletions

View File

@ -365,6 +365,8 @@ FINSH_FUNCTION_EXPORT(list_device, list device in system)
#endif
#ifdef RT_USING_MODULE
#include <rtm.h>
int list_module(void)
{
struct rt_module *module;
@ -372,15 +374,33 @@ int list_module(void)
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)
{
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));
rt_kprintf("______________________________________________________________________\n");
rt_kprintf("[module]%-8s \n", module->parent.name);
rt_kprintf("%-16s ", module->parent.name);
rt_kprintf("%-04d \n", module->nref);
}
}
FINSH_FUNCTION_EXPORT(list_module, list module in system)
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))
{
struct rt_thread *thread;
struct rt_list_node *tlist;
rt_uint8_t* ptr;
/* list main thread in module */
if(module->module_thread != RT_NULL)
@ -447,11 +467,20 @@ int list_module(void)
tlist = &module->module_object[RT_Object_Class_Timer].object_list;
if(!rt_list_isempty(tlist)) _list_timer(tlist);
}
rt_kprintf("______________________________________________________________________\n");
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);
}
}
return 0;
}
FINSH_FUNCTION_EXPORT(list_module, list module in system)
FINSH_FUNCTION_EXPORT(list_module_obj, list module objects in system)
#endif
int list()