mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 07:30:54 +00:00
libsysprof-analyze: resolve symbols in ELF in non-symbol areas
If we get an address that doesn't fall within a symbol, we still want to generate a valid string/address range for it here so that we can get nick annotations correct. If we hit the fallback path, we won't get that.
This commit is contained in:
@ -280,11 +280,12 @@ sysprof_elf_get_debug_link (SysprofElf *self)
|
|||||||
return elf_parser_get_debug_link (self->parser, &crc32);
|
return elf_parser_get_debug_link (self->parser, &crc32);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
sysprof_elf_get_symbol_at_address (SysprofElf *self,
|
sysprof_elf_get_symbol_at_address_internal (SysprofElf *self,
|
||||||
guint64 address,
|
const char *filename,
|
||||||
guint64 *begin_address,
|
guint64 address,
|
||||||
guint64 *end_address)
|
guint64 *begin_address,
|
||||||
|
guint64 *end_address)
|
||||||
{
|
{
|
||||||
const ElfSym *symbol;
|
const ElfSym *symbol;
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
@ -295,7 +296,7 @@ sysprof_elf_get_symbol_at_address (SysprofElf *self,
|
|||||||
|
|
||||||
if (self->debug_link_elf != NULL)
|
if (self->debug_link_elf != NULL)
|
||||||
{
|
{
|
||||||
ret = sysprof_elf_get_symbol_at_address (self->debug_link_elf, address, begin_address, end_address);
|
ret = sysprof_elf_get_symbol_at_address_internal (self->debug_link_elf, filename, address, begin_address, end_address);
|
||||||
|
|
||||||
if (ret != NULL)
|
if (ret != NULL)
|
||||||
return ret;
|
return ret;
|
||||||
@ -315,6 +316,12 @@ sysprof_elf_get_symbol_at_address (SysprofElf *self,
|
|||||||
else
|
else
|
||||||
ret = g_strdup (name);
|
ret = g_strdup (name);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
begin = address;
|
||||||
|
end = address + 1;
|
||||||
|
ret = g_strdup_printf ("In File %s+0x%"G_GINT64_MODIFIER"x", filename, address);
|
||||||
|
}
|
||||||
|
|
||||||
if (begin_address)
|
if (begin_address)
|
||||||
*begin_address = begin;
|
*begin_address = begin;
|
||||||
@ -325,6 +332,19 @@ sysprof_elf_get_symbol_at_address (SysprofElf *self,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
sysprof_elf_get_symbol_at_address (SysprofElf *self,
|
||||||
|
guint64 address,
|
||||||
|
guint64 *begin_address,
|
||||||
|
guint64 *end_address)
|
||||||
|
{
|
||||||
|
return sysprof_elf_get_symbol_at_address_internal (self,
|
||||||
|
self->file,
|
||||||
|
address,
|
||||||
|
begin_address,
|
||||||
|
end_address);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sysprof_elf_get_debug_link_elf:
|
* sysprof_elf_get_debug_link_elf:
|
||||||
* @self: a #SysprofElf
|
* @self: a #SysprofElf
|
||||||
|
|||||||
Reference in New Issue
Block a user