提交 9547133e 编写于 作者: H Haryslee

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

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

close #I40TQS
Signed-off-by: NHaryslee <lihao189@huawei.com>

Change-Id: If2a7b7a286d91e78dcff2bdeb136fda71e656a79
上级 d9ed4b4b
...@@ -1215,7 +1215,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou ...@@ -1215,7 +1215,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou
framePtr = Get_Fp(); framePtr = Get_Fp();
while ((framePtr > stackStart) && (framePtr < stackEnd) && IS_ALIGNED(framePtr, sizeof(CHAR *))) { while ((framePtr > stackStart) && (framePtr < stackEnd) && IS_ALIGNED(framePtr, sizeof(CHAR *))) {
tmpFramePtr = framePtr; tmpFramePtr = framePtr;
#ifdef LOSCFG_COMPILER_CLANG_LLVM
linkReg = *(UINTPTR *)(tmpFramePtr + sizeof(UINTPTR));
#else
linkReg = *(UINTPTR *)framePtr; linkReg = *(UINTPTR *)framePtr;
#endif
if (index >= jumpCount) { if (index >= jumpCount) {
LR[count++] = linkReg; LR[count++] = linkReg;
if (count == recordCount) { if (count == recordCount) {
...@@ -1223,7 +1227,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou ...@@ -1223,7 +1227,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou
} }
} }
index++; index++;
#ifdef LOSCFG_COMPILER_CLANG_LLVM
framePtr = *(UINTPTR *)framePtr;
#else
framePtr = *(UINTPTR *)(tmpFramePtr - sizeof(UINTPTR)); framePtr = *(UINTPTR *)(tmpFramePtr - sizeof(UINTPTR));
#endif
} }
/* if linkReg is not enough,clean up the last of the effective LR as the end. */ /* if linkReg is not enough,clean up the last of the effective LR as the end. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册