提交 d573786d 编写于 作者: R rogerz.zhang@gmail.com

fix memory access error in list_tc() under bsp/simulator

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2550 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 50d95287
...@@ -75,6 +75,9 @@ if GetDepend('RT_USING_RTGUI'): ...@@ -75,6 +75,9 @@ if GetDepend('RT_USING_RTGUI'):
objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript',
variant_dir='build/examples/gui', duplicate=0) variant_dir='build/examples/gui', duplicate=0)
if GetDepend('RT_USING_TC'):
objs = objs + SConscript(RTT_ROOT + '/examples/kernel/SConscript', variant_dir = 'build/tc/kernel', duplicate=0)
# build program # build program
program = env.Program(TARGET, objs) program = env.Program(TARGET, objs)
......
...@@ -32,21 +32,6 @@ ...@@ -32,21 +32,6 @@
#include <rtthread.h> #include <rtthread.h>
#include "finsh.h" #include "finsh.h"
#if defined(_MSC_VER)
static struct finsh_syscall* _next_syscall(struct finsh_syscall* call)
{
unsigned int *ptr;
ptr = (unsigned int*) (call + 1);
while ((*ptr == 0) && ((unsigned int*)ptr < (unsigned int*) _syscall_table_end))
ptr ++;
return (struct finsh_syscall*)ptr;
}
#define _NEXT_SYSCALl(index) index=_next_syscall(index)
#else
#define _NEXT_SYSCALl(index) index++
#endif
rt_inline unsigned int rt_list_len(const rt_list_t *l) rt_inline unsigned int rt_list_len(const rt_list_t *l)
{ {
...@@ -564,7 +549,7 @@ long list(void) ...@@ -564,7 +549,7 @@ long list(void)
rt_kprintf("--Function List:\n"); rt_kprintf("--Function List:\n");
{ {
struct finsh_syscall *index; struct finsh_syscall *index;
for (index = _syscall_table_begin; index < _syscall_table_end; _NEXT_SYSCALl(index)) for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index))
{ {
#ifdef FINSH_USING_DESCRIPTION #ifdef FINSH_USING_DESCRIPTION
rt_kprintf("%-16s -- %s\n", index->name, index->desc); rt_kprintf("%-16s -- %s\n", index->name, index->desc);
...@@ -649,7 +634,7 @@ void list_prefix(char *prefix) ...@@ -649,7 +634,7 @@ void list_prefix(char *prefix)
/* checks in system function call */ /* checks in system function call */
{ {
struct finsh_syscall* index; struct finsh_syscall* index;
for (index = _syscall_table_begin; index < _syscall_table_end; _NEXT_SYSCALl(index)) for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index))
{ {
if (str_is_prefix(prefix, index->name) == 0) if (str_is_prefix(prefix, index->name) == 0)
{ {
......
...@@ -148,6 +148,13 @@ struct finsh_sysvar ...@@ -148,6 +148,13 @@ struct finsh_sysvar
void* var ; /* the address of variable */ void* var ; /* the address of variable */
}; };
#if defined(_MSC_VER)
struct finsh_syscall* finsh_syscall_next(struct finsh_syscall* call);
#define FINSH_NEXT_SYSCALL(index) index=finsh_syscall_next(index)
#else
#define FINSH_NEXT_SYSCALL(index) index++
#endif
/* system variable item */ /* system variable item */
struct finsh_sysvar_item struct finsh_sysvar_item
{ {
......
...@@ -83,8 +83,8 @@ void finsh_syscall_append(const char* name, syscall_func func) ...@@ -83,8 +83,8 @@ void finsh_syscall_append(const char* name, syscall_func func)
} }
#endif #endif
#if defined(_MSC_VER) #ifdef _MSC_VER
static struct finsh_syscall* _next_syscall(struct finsh_syscall* call) struct finsh_syscall* finsh_syscall_next(struct finsh_syscall* call)
{ {
unsigned int *ptr; unsigned int *ptr;
ptr = (unsigned int*) (call + 1); ptr = (unsigned int*) (call + 1);
...@@ -93,9 +93,6 @@ static struct finsh_syscall* _next_syscall(struct finsh_syscall* call) ...@@ -93,9 +93,6 @@ static struct finsh_syscall* _next_syscall(struct finsh_syscall* call)
return (struct finsh_syscall*)ptr; return (struct finsh_syscall*)ptr;
} }
#define _NEXT_SYSCALL(index) index=_next_syscall(index)
#else
#define _NEXT_SYSCALL(index) index++
#endif #endif
struct finsh_syscall* finsh_syscall_lookup(const char* name) struct finsh_syscall* finsh_syscall_lookup(const char* name)
...@@ -103,7 +100,7 @@ struct finsh_syscall* finsh_syscall_lookup(const char* name) ...@@ -103,7 +100,7 @@ struct finsh_syscall* finsh_syscall_lookup(const char* name)
struct finsh_syscall* index; struct finsh_syscall* index;
struct finsh_syscall_item* item; struct finsh_syscall_item* item;
for (index = _syscall_table_begin; index < _syscall_table_end; _NEXT_SYSCALL(index)) for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index))
{ {
if (strcmp(index->name, name) == 0) if (strcmp(index->name, name) == 0)
return index; return index;
......
...@@ -27,7 +27,7 @@ void tc_thread_entry(void* parameter) ...@@ -27,7 +27,7 @@ void tc_thread_entry(void* parameter)
while (_tc_stat & TC_STAT_RUNNING) while (_tc_stat & TC_STAT_RUNNING)
{ {
for (index = _syscall_table_begin; index < _syscall_table_end; index ++) for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index))
{ {
/* search testcase */ /* search testcase */
if (rt_strstr(index->name, _tc_prefix) == index->name) if (rt_strstr(index->name, _tc_prefix) == index->name)
...@@ -158,7 +158,7 @@ void list_tc() ...@@ -158,7 +158,7 @@ void list_tc()
struct finsh_syscall* index; struct finsh_syscall* index;
rt_kprintf("TestCases List:\n"); rt_kprintf("TestCases List:\n");
for (index = _syscall_table_begin; index < _syscall_table_end; index ++) for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index))
{ {
/* search testcase */ /* search testcase */
if (rt_strstr(index->name, "_tc_") == index->name) if (rt_strstr(index->name, "_tc_") == index->name)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册