fix:修复llvm编译环境下内核态内存调测调用栈信息解析有误的问题

背景:内核态内存调测调用栈信息在gcc编译环境下是准确的,但是llvm
编译环境下是错误的,分析知,gcc和llvm编译环境下fp和lr的对应关系
是有区别的。
修复:增加llvm编译环境下对lr解析的逻辑,并用编译宏控制。

close #I40TQS

Signed-off-by: Haryslee <lihao189@huawei.com>

Change-Id: If2a7b7a286d91e78dcff2bdeb136fda71e656a79
This commit is contained in:
Haryslee 2021-07-15 19:19:56 +08:00
parent d9ed4b4bf6
commit 9547133e64
1 changed files with 9 additions and 1 deletions

View File

@ -1215,7 +1215,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou
framePtr = Get_Fp();
while ((framePtr > stackStart) && (framePtr < stackEnd) && IS_ALIGNED(framePtr, sizeof(CHAR *))) {
tmpFramePtr = framePtr;
#ifdef LOSCFG_COMPILER_CLANG_LLVM
linkReg = *(UINTPTR *)(tmpFramePtr + sizeof(UINTPTR));
#else
linkReg = *(UINTPTR *)framePtr;
#endif
if (index >= jumpCount) {
LR[count++] = linkReg;
if (count == recordCount) {
@ -1223,7 +1227,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou
}
}
index++;
#ifdef LOSCFG_COMPILER_CLANG_LLVM
framePtr = *(UINTPTR *)framePtr;
#else
framePtr = *(UINTPTR *)(tmpFramePtr - sizeof(UINTPTR));
#endif
}
/* if linkReg is not enough,clean up the last of the effective LR as the end. */