mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof: elf: do not generate fallback names
Fallback names are only used in `SysprofElfSymbolizer` at the moment, but it also has code to generate fallback symbols.
This commit is contained in:
committed by
Christian Hergert
parent
aef623cf15
commit
1c4c266a05
@ -42,8 +42,7 @@ const char *sysprof_elf_get_debug_link (SysprofElf *self);
|
|||||||
char *sysprof_elf_get_symbol_at_address (SysprofElf *self,
|
char *sysprof_elf_get_symbol_at_address (SysprofElf *self,
|
||||||
guint64 address,
|
guint64 address,
|
||||||
guint64 *begin_address,
|
guint64 *begin_address,
|
||||||
guint64 *end_address,
|
guint64 *end_address);
|
||||||
gboolean *is_fallback);
|
|
||||||
SysprofElf *sysprof_elf_get_debug_link_elf (SysprofElf *self);
|
SysprofElf *sysprof_elf_get_debug_link_elf (SysprofElf *self);
|
||||||
void sysprof_elf_set_debug_link_elf (SysprofElf *self,
|
void sysprof_elf_set_debug_link_elf (SysprofElf *self,
|
||||||
SysprofElf *debug_link_elf);
|
SysprofElf *debug_link_elf);
|
||||||
|
|||||||
@ -61,9 +61,9 @@ sysprof_elf_symbolizer_symbolize (SysprofSymbolizer *symbolizer,
|
|||||||
g_autoptr(SysprofElf) elf = NULL;
|
g_autoptr(SysprofElf) elf = NULL;
|
||||||
SysprofDocumentMmap *map;
|
SysprofDocumentMmap *map;
|
||||||
g_autofree char *name = NULL;
|
g_autofree char *name = NULL;
|
||||||
|
const char *nick = NULL;
|
||||||
const char *path;
|
const char *path;
|
||||||
const char *build_id;
|
const char *build_id;
|
||||||
gboolean is_fallback = FALSE;
|
|
||||||
guint64 map_begin;
|
guint64 map_begin;
|
||||||
guint64 map_end;
|
guint64 map_end;
|
||||||
guint64 relative_address;
|
guint64 relative_address;
|
||||||
@ -115,14 +115,15 @@ sysprof_elf_symbolizer_symbolize (SysprofSymbolizer *symbolizer,
|
|||||||
NULL)))
|
NULL)))
|
||||||
goto fallback;
|
goto fallback;
|
||||||
|
|
||||||
|
nick = sysprof_elf_get_nick (elf);
|
||||||
|
|
||||||
/* Try to get the symbol name at the address and the begin/end address
|
/* Try to get the symbol name at the address and the begin/end address
|
||||||
* so that it can be inserted into our symbol cache.
|
* so that it can be inserted into our symbol cache.
|
||||||
*/
|
*/
|
||||||
if (!(name = sysprof_elf_get_symbol_at_address (elf,
|
if (!(name = sysprof_elf_get_symbol_at_address (elf,
|
||||||
relative_address,
|
relative_address,
|
||||||
&begin_address,
|
&begin_address,
|
||||||
&end_address,
|
&end_address)))
|
||||||
&is_fallback)))
|
|
||||||
goto fallback;
|
goto fallback;
|
||||||
|
|
||||||
/* Sanitize address ranges if we have to. Sometimes that can happen
|
/* Sanitize address ranges if we have to. Sometimes that can happen
|
||||||
@ -135,11 +136,10 @@ sysprof_elf_symbolizer_symbolize (SysprofSymbolizer *symbolizer,
|
|||||||
|
|
||||||
ret = _sysprof_symbol_new (sysprof_strings_get (strings, name),
|
ret = _sysprof_symbol_new (sysprof_strings_get (strings, name),
|
||||||
sysprof_strings_get (strings, path),
|
sysprof_strings_get (strings, path),
|
||||||
sysprof_strings_get (strings, sysprof_elf_get_nick (elf)),
|
sysprof_strings_get (strings, nick),
|
||||||
map_begin + (begin_address - file_offset),
|
map_begin + (begin_address - file_offset),
|
||||||
map_begin + (end_address - file_offset),
|
map_begin + (end_address - file_offset),
|
||||||
SYSPROF_SYMBOL_KIND_USER);
|
SYSPROF_SYMBOL_KIND_USER);
|
||||||
ret->is_fallback = is_fallback;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ fallback:
|
|||||||
|
|
||||||
ret = _sysprof_symbol_new (sysprof_strings_get (strings, name),
|
ret = _sysprof_symbol_new (sysprof_strings_get (strings, name),
|
||||||
sysprof_strings_get (strings, path),
|
sysprof_strings_get (strings, path),
|
||||||
NULL,
|
sysprof_strings_get (strings, nick),
|
||||||
begin_address, end_address,
|
begin_address, end_address,
|
||||||
SYSPROF_SYMBOL_KIND_USER);
|
SYSPROF_SYMBOL_KIND_USER);
|
||||||
ret->is_fallback = TRUE;
|
ret->is_fallback = TRUE;
|
||||||
|
|||||||
@ -409,8 +409,7 @@ sysprof_elf_get_symbol_at_address_internal (SysprofElf *self,
|
|||||||
guint64 address,
|
guint64 address,
|
||||||
guint64 *begin_address,
|
guint64 *begin_address,
|
||||||
guint64 *end_address,
|
guint64 *end_address,
|
||||||
guint64 text_offset,
|
guint64 text_offset)
|
||||||
gboolean *is_fallback)
|
|
||||||
{
|
{
|
||||||
const ElfSym *symbol;
|
const ElfSym *symbol;
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
@ -421,7 +420,7 @@ sysprof_elf_get_symbol_at_address_internal (SysprofElf *self,
|
|||||||
|
|
||||||
if (self->debug_link_elf != NULL)
|
if (self->debug_link_elf != NULL)
|
||||||
{
|
{
|
||||||
ret = sysprof_elf_get_symbol_at_address_internal (self->debug_link_elf, filename, address, begin_address, end_address, text_offset, is_fallback);
|
ret = sysprof_elf_get_symbol_at_address_internal (self->debug_link_elf, filename, address, begin_address, end_address, text_offset);
|
||||||
|
|
||||||
if (ret != NULL)
|
if (ret != NULL)
|
||||||
return ret;
|
return ret;
|
||||||
@ -447,11 +446,7 @@ sysprof_elf_get_symbol_at_address_internal (SysprofElf *self,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
begin = address;
|
return NULL;
|
||||||
end = address + 1;
|
|
||||||
ret = g_strdup_printf ("In File %s+0x%"G_GINT64_MODIFIER"x", filename, address);
|
|
||||||
if (is_fallback)
|
|
||||||
*is_fallback = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (begin_address)
|
if (begin_address)
|
||||||
@ -467,16 +462,14 @@ char *
|
|||||||
sysprof_elf_get_symbol_at_address (SysprofElf *self,
|
sysprof_elf_get_symbol_at_address (SysprofElf *self,
|
||||||
guint64 address,
|
guint64 address,
|
||||||
guint64 *begin_address,
|
guint64 *begin_address,
|
||||||
guint64 *end_address,
|
guint64 *end_address)
|
||||||
gboolean *is_fallback)
|
|
||||||
{
|
{
|
||||||
return sysprof_elf_get_symbol_at_address_internal (self,
|
return sysprof_elf_get_symbol_at_address_internal (self,
|
||||||
self->file,
|
self->file,
|
||||||
address,
|
address,
|
||||||
begin_address,
|
begin_address,
|
||||||
end_address,
|
end_address,
|
||||||
self->text_offset,
|
self->text_offset);
|
||||||
is_fallback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user