Merge "Don't assume size of functions." into main am: 8a2f0358ed am: 41c6ed2eed

Original change: https://android-review.googlesource.com/c/platform/bionic/+/2681595

Change-Id: I3e88243b150bf4f0c804fd4bcdcf3f41cd3764c4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Florian Mayer 2023-07-29 03:02:04 +00:00 committed by Automerger Merge Worker
commit ff078f0096

View file

@ -79,9 +79,13 @@ static std::string DumpFrames(std::vector<void*>& frames) {
}
static size_t FindFunction(std::vector<void*>& frames, uintptr_t func_addr) {
Dl_info func_info;
if (!dladdr(reinterpret_cast<void*>(func_addr), &func_info)) {
return 0;
}
for (size_t i = 0; i < frames.size(); i++) {
uintptr_t frame_addr = reinterpret_cast<uintptr_t>(frames[i]);
if (frame_addr >= func_addr && frame_addr <= func_addr + 0x100) {
Dl_info frame_info;
if (dladdr(frames[i], &frame_info) && func_info.dli_saddr == frame_info.dli_saddr) {
return i + 1;
}
}