1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibCoreDump: Make symbolication work when .text isn't the first segment

This can happen with binaries built with Clang or with a custom linker
script.
This commit is contained in:
Gunnar Beutner 2021-07-27 17:01:29 +02:00 committed by Andreas Kling
parent 99d46caa28
commit c9118b84b7
3 changed files with 21 additions and 3 deletions

View file

@ -79,14 +79,18 @@ Backtrace::~Backtrace()
void Backtrace::add_entry(const Reader& coredump, FlatPtr ip)
{
auto* region = coredump.region_containing((FlatPtr)ip);
if (!region) {
auto* ip_region = coredump.region_containing((FlatPtr)ip);
if (!ip_region) {
m_entries.append({ ip, {}, {}, {} });
return;
}
auto object_name = region->object_name();
auto object_name = ip_region->object_name();
if (object_name == "Loader.so")
return;
// We need to find the first region for the object, just in case
// the PT_LOAD header for the .text segment isn't the first one
// in the object file.
auto region = coredump.first_region_for_object(object_name);
auto* object_info = object_info_for_region(*region);
if (!object_info)
return;