提交 8692ed33 编写于 作者: J JerryH

fix: backtrace代码段判断函数定义成弱函数,如果有多个代码段,那么可根据实际情况重定义

close #I420SD
Signed-off-by: NJerryH <huangjieliang@huawei.com>
Change-Id: Id2e89e11df8aeb906cdd36b2c40c51c2e140a569
上级 ff7da435
...@@ -33,8 +33,19 @@ ...@@ -33,8 +33,19 @@
#include "los_task.h" #include "los_task.h"
#include "los_debug.h" #include "los_debug.h"
#if (LOSCFG_BACKTRACE_TYPE != 0) #if (LOSCFG_BACKTRACE_TYPE != 0)
/* This function is used to judge whether the data in the stack is a code section address.
The default code section is only one, but there may be more than one. Modify the
judgment condition to support multiple code sections. */
WEAK BOOL OsStackDataIsCodeAddr(UINTPTR value)
{
if ((value >= CODE_START_ADDR) && (value < CODE_END_ADDR)) {
return TRUE;
}
return FALSE;
}
#if (LOSCFG_BACKTRACE_TYPE == 1) #if (LOSCFG_BACKTRACE_TYPE == 1)
#define OS_BACKTRACE_START 2 #define OS_BACKTRACE_START 2
/* Thumb instruction, so the pc must be an odd number */ /* Thumb instruction, so the pc must be an odd number */
......
...@@ -56,7 +56,7 @@ extern "C" { ...@@ -56,7 +56,7 @@ extern "C" {
#pragma section=CSTACK_SECTION_NAME #pragma section=CSTACK_SECTION_NAME
/* Default only one code section. In fact, there may be more than one. /* Default only one code section. In fact, there may be more than one.
You can define more than one and modify the OsStackDataIsCodeAddr function You can define more than one and redefine the OsStackDataIsCodeAddr function
to support searching in multiple code sections */ to support searching in multiple code sections */
#define CODE_START_ADDR ((UINTPTR)__section_begin(CODE_SECTION_NAME)) #define CODE_START_ADDR ((UINTPTR)__section_begin(CODE_SECTION_NAME))
#define CODE_END_ADDR ((UINTPTR)__section_end(CODE_SECTION_NAME)) #define CODE_END_ADDR ((UINTPTR)__section_end(CODE_SECTION_NAME))
...@@ -84,7 +84,7 @@ extern CHAR *CODE_SECTION_START(CODE_SECTION_NAME); ...@@ -84,7 +84,7 @@ extern CHAR *CODE_SECTION_START(CODE_SECTION_NAME);
extern CHAR *CODE_SECTION_END(CODE_SECTION_NAME); extern CHAR *CODE_SECTION_END(CODE_SECTION_NAME);
/* Default only one code section. In fact, there may be more than one. /* Default only one code section. In fact, there may be more than one.
You can define more than one and modify the OsStackDataIsCodeAddr function You can define more than one and redefine the OsStackDataIsCodeAddr function
to support searching in multiple code sections */ to support searching in multiple code sections */
#define CODE_START_ADDR ((UINTPTR)&CODE_SECTION_START(CODE_SECTION_NAME)) #define CODE_START_ADDR ((UINTPTR)&CODE_SECTION_START(CODE_SECTION_NAME))
#define CODE_END_ADDR ((UINTPTR)&CODE_SECTION_END(CODE_SECTION_NAME)) #define CODE_END_ADDR ((UINTPTR)&CODE_SECTION_END(CODE_SECTION_NAME))
...@@ -106,7 +106,7 @@ extern CHAR *CSTACK_SECTION_START; ...@@ -106,7 +106,7 @@ extern CHAR *CSTACK_SECTION_START;
extern CHAR *CSTACK_SECTION_END; extern CHAR *CSTACK_SECTION_END;
/* Default only one code section. In fact, there may be more than one. /* Default only one code section. In fact, there may be more than one.
You can define more than one and modify the OsStackDataIsCodeAddr function You can define more than one and redefine the OsStackDataIsCodeAddr function
to support searching in multiple code sections */ to support searching in multiple code sections */
#define CODE_START_ADDR ((UINTPTR)&CODE_SECTION_START) #define CODE_START_ADDR ((UINTPTR)&CODE_SECTION_START)
#define CODE_END_ADDR ((UINTPTR)&CODE_SECTION_END) #define CODE_END_ADDR ((UINTPTR)&CODE_SECTION_END)
...@@ -140,17 +140,6 @@ extern CHAR *CSTACK_SECTION_END; ...@@ -140,17 +140,6 @@ extern CHAR *CSTACK_SECTION_END;
#endif #endif
#endif #endif
/* This function is used to judge whether the data in the stack is a code section address.
The default code section is only one, but there may be more than one. Modify the
judgment condition to support multiple code sections. */
STATIC INLINE BOOL OsStackDataIsCodeAddr(UINTPTR value)
{
if ((value >= CODE_START_ADDR) && (value < CODE_END_ADDR)) {
return TRUE;
}
return FALSE;
}
/* This function is currently used to register the memory leak check hook, /* This function is currently used to register the memory leak check hook,
other uses do not need to be called temporarily. */ other uses do not need to be called temporarily. */
VOID OSBackTraceInit(VOID); VOID OSBackTraceInit(VOID);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册