From 8692ed33a3b975bac7aa5b6ce3c40a84e281f6c5 Mon Sep 17 00:00:00 2001 From: JerryH Date: Mon, 2 Aug 2021 15:43:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20backtrace=E4=BB=A3=E7=A0=81=E6=AE=B5?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=87=BD=E6=95=B0=E5=AE=9A=E4=B9=89=E6=88=90?= =?UTF-8?q?=E5=BC=B1=E5=87=BD=E6=95=B0=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=9C=89?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E4=BB=A3=E7=A0=81=E6=AE=B5=EF=BC=8C=E9=82=A3?= =?UTF-8?q?=E4=B9=88=E5=8F=AF=E6=A0=B9=E6=8D=AE=E5=AE=9E=E9=99=85=E6=83=85?= =?UTF-8?q?=E5=86=B5=E9=87=8D=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #I420SD Signed-off-by: JerryH Change-Id: Id2e89e11df8aeb906cdd36b2c40c51c2e140a569 --- components/backtrace/los_backtrace.c | 13 ++++++++++++- components/backtrace/los_backtrace.h | 17 +++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/components/backtrace/los_backtrace.c b/components/backtrace/los_backtrace.c index 41d0d81d..05538f13 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 a38c1899..8cdde9d5 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); -- GitLab