update: rename LOS_BackTraceInit

change function name LOS_BackTraceInit and involve it in los_init.c when macro is not set to 0

close https://gitee.com/openharmony/kernel_liteos_m/issues/I3SYQQ

Signed-off-by: kenneth <459864689@qq.com>
This commit is contained in:
kenneth 2021-06-15 14:29:13 +08:00
parent 749bd8a481
commit a0a32188ff
6 changed files with 16 additions and 4 deletions

View File

@ -407,7 +407,7 @@ VOID LOS_BackTrace(VOID)
PRINTK("----- traceback end -----\r\n"); PRINTK("----- traceback end -----\r\n");
} }
VOID LOS_BackTraceInit(VOID) VOID OSBackTraceInit(VOID)
{ {
OsBackTraceHookSet(LOS_RecordLR); OsBackTraceHookSet(LOS_RecordLR);
} }

View File

@ -153,7 +153,7 @@ STATIC INLINE BOOL OsStackDataIsCodeAddr(UINTPTR value)
/* 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 LOS_BackTraceInit(VOID); VOID OSBackTraceInit(VOID);
/* This function is used to print the function call stack. */ /* This function is used to print the function call stack. */
VOID LOS_BackTrace(VOID); VOID LOS_BackTrace(VOID);

View File

@ -48,6 +48,7 @@ static_library("kernel") {
"arch/include", "arch/include",
"../components/cpup", "../components/cpup",
"../components/exchook", "../components/exchook",
"../components/backtrace",
"../utils", "../utils",
"//third_party/bounds_checking_function/include", "//third_party/bounds_checking_function/include",
] ]

View File

@ -459,10 +459,13 @@ extern UINT8 *m_aucSysMem0;
* Configuration memory leak detection * Configuration memory leak detection
* @attention * @attention
* Need to enable backtrace module synchronously by configuration LOSCFG_BACKTRACE_TYPE, * Need to enable backtrace module synchronously by configuration LOSCFG_BACKTRACE_TYPE,
* and call LOS_BackTraceInit to complete initialization before the memory pool is initialized. * and call OSBackTraceInit to complete initialization before the memory pool is initialized.
*/ */
#ifndef LOSCFG_MEM_LEAKCHECK #ifndef LOSCFG_MEM_LEAKCHECK
#define LOSCFG_MEM_LEAKCHECK 0 #define LOSCFG_MEM_LEAKCHECK 0
#if (LOSCFG_BACKTRACE_TYPE == 0)
#error "Backtrace module should be enabled by setting LOSCFG_BACKTRACE_TYPE to not 0 in target_config.h"
#endif
#endif #endif
/** /**

View File

@ -58,6 +58,10 @@
#include "los_exc_info.h" #include "los_exc_info.h"
#endif #endif
#if (LOSCFG_BACKTRACE_TYPE != 0)
#include "los_backtrace.h"
#endif
/***************************************************************************** /*****************************************************************************
Function : LOS_Reboot Function : LOS_Reboot
@ -113,6 +117,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
UINT32 ret; UINT32 ret;
PRINTK("entering kernel init...\n"); PRINTK("entering kernel init...\n");
#if (LOSCFG_BACKTRACE_TYPE != 0)
OSBackTraceInit();
#endif
OsRegister(); OsRegister();
ret = OsMemSystemInit(); ret = OsMemSystemInit();
if (ret != LOS_OK) { if (ret != LOS_OK) {

View File

@ -61,7 +61,7 @@ VOID OsBackTraceHookCall(UINTPTR *LR, UINT32 LRSize, UINT32 jumpCount, UINTPTR S
g_backTraceHook(LR, LRSize, jumpCount, SP); g_backTraceHook(LR, LRSize, jumpCount, SP);
} else { } else {
PRINT_ERR("Record LR failed, because of g_backTraceHook is not registered, " PRINT_ERR("Record LR failed, because of g_backTraceHook is not registered, "
"should call LOS_BackTraceInit firstly\n"); "should call OSBackTraceInit firstly\n");
} }
} }