diff --git a/components/backtrace/los_backtrace.c b/components/backtrace/los_backtrace.c index 41d0d81df25b076ce10ee92101faf5e92b84299e..05538f138030265b914b40d437de2ad0283ce410 100644 --- a/components/backtrace/los_backtrace.c +++ b/components/backtrace/los_backtrace.c @@ -33,8 +33,19 @@ #include "los_task.h" #include "los_debug.h" - #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) #define OS_BACKTRACE_START 2 /* Thumb instruction, so the pc must be an odd number */ diff --git a/components/backtrace/los_backtrace.h b/components/backtrace/los_backtrace.h index a38c1899462248dd309693944ab73a61da712a3d..8cdde9d53232fb2ca41cb1ed8f3fdd95f8ab7bce 100644 --- a/components/backtrace/los_backtrace.h +++ b/components/backtrace/los_backtrace.h @@ -56,7 +56,7 @@ extern "C" { #pragma section=CSTACK_SECTION_NAME /* 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 */ #define CODE_START_ADDR ((UINTPTR)__section_begin(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); extern CHAR *CODE_SECTION_END(CODE_SECTION_NAME); /* 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 */ #define CODE_START_ADDR ((UINTPTR)&CODE_SECTION_START(CODE_SECTION_NAME)) #define CODE_END_ADDR ((UINTPTR)&CODE_SECTION_END(CODE_SECTION_NAME)) @@ -106,7 +106,7 @@ extern CHAR *CSTACK_SECTION_START; extern CHAR *CSTACK_SECTION_END; /* 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 */ #define CODE_START_ADDR ((UINTPTR)&CODE_SECTION_START) #define CODE_END_ADDR ((UINTPTR)&CODE_SECTION_END) @@ -140,17 +140,6 @@ extern CHAR *CSTACK_SECTION_END; #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, other uses do not need to be called temporarily. */ VOID OSBackTraceInit(VOID);