mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-analyze: do not symbolize fallback symbols
These just waste a bunch of space in the capture file and we can instead generate them on the fly when loading the document.
This commit is contained in:
@ -42,7 +42,8 @@ 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);
|
||||||
|
|||||||
@ -63,6 +63,7 @@ sysprof_elf_symbolizer_symbolize (SysprofSymbolizer *symbolizer,
|
|||||||
g_autofree char *name = NULL;
|
g_autofree char *name = 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;
|
||||||
@ -70,6 +71,7 @@ sysprof_elf_symbolizer_symbolize (SysprofSymbolizer *symbolizer,
|
|||||||
guint64 end_address;
|
guint64 end_address;
|
||||||
guint64 file_inode;
|
guint64 file_inode;
|
||||||
guint64 file_offset;
|
guint64 file_offset;
|
||||||
|
SysprofSymbol *ret;
|
||||||
|
|
||||||
if (process_info == NULL ||
|
if (process_info == NULL ||
|
||||||
process_info->address_layout == NULL ||
|
process_info->address_layout == NULL ||
|
||||||
@ -119,7 +121,8 @@ sysprof_elf_symbolizer_symbolize (SysprofSymbolizer *symbolizer,
|
|||||||
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
|
||||||
@ -130,12 +133,15 @@ sysprof_elf_symbolizer_symbolize (SysprofSymbolizer *symbolizer,
|
|||||||
if (end_address == begin_address)
|
if (end_address == begin_address)
|
||||||
end_address++;
|
end_address++;
|
||||||
|
|
||||||
return _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, sysprof_elf_get_nick (elf)),
|
||||||
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;
|
||||||
|
|
||||||
fallback:
|
fallback:
|
||||||
/* Fallback, we failed to locate the symbol within a file we can
|
/* Fallback, we failed to locate the symbol within a file we can
|
||||||
@ -148,9 +154,12 @@ fallback:
|
|||||||
begin_address = address;
|
begin_address = address;
|
||||||
end_address = address + 1;
|
end_address = address + 1;
|
||||||
|
|
||||||
return _sysprof_symbol_new (sysprof_strings_get (strings, name),
|
ret = _sysprof_symbol_new (sysprof_strings_get (strings, name),
|
||||||
NULL, NULL, begin_address, end_address,
|
NULL, NULL, begin_address, end_address,
|
||||||
SYSPROF_SYMBOL_KIND_USER);
|
SYSPROF_SYMBOL_KIND_USER);
|
||||||
|
ret->is_fallback = TRUE;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -369,7 +369,8 @@ 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;
|
||||||
@ -380,7 +381,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);
|
ret = sysprof_elf_get_symbol_at_address_internal (self->debug_link_elf, filename, address, begin_address, end_address, text_offset, is_fallback);
|
||||||
|
|
||||||
if (ret != NULL)
|
if (ret != NULL)
|
||||||
return ret;
|
return ret;
|
||||||
@ -409,6 +410,8 @@ sysprof_elf_get_symbol_at_address_internal (SysprofElf *self,
|
|||||||
begin = address;
|
begin = address;
|
||||||
end = address + 1;
|
end = address + 1;
|
||||||
ret = g_strdup_printf ("In File %s+0x%"G_GINT64_MODIFIER"x", filename, address);
|
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)
|
||||||
@ -424,14 +427,16 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -291,15 +291,19 @@ sysprof_kallsyms_symbolizer_symbolize (SysprofSymbolizer *symbolizer,
|
|||||||
|
|
||||||
failure:
|
failure:
|
||||||
{
|
{
|
||||||
|
SysprofSymbol *ret;
|
||||||
char name[64];
|
char name[64];
|
||||||
|
|
||||||
g_snprintf (name, sizeof name, "In Kernel+0x%"G_GINT64_MODIFIER"x", address);
|
g_snprintf (name, sizeof name, "In Kernel+0x%"G_GINT64_MODIFIER"x", address);
|
||||||
return _sysprof_symbol_new (sysprof_strings_get (strings, name),
|
ret = _sysprof_symbol_new (sysprof_strings_get (strings, name),
|
||||||
NULL,
|
NULL,
|
||||||
g_ref_string_acquire (linux_string),
|
g_ref_string_acquire (linux_string),
|
||||||
address,
|
address,
|
||||||
address + 1,
|
address + 1,
|
||||||
SYSPROF_SYMBOL_KIND_KERNEL);
|
SYSPROF_SYMBOL_KIND_KERNEL);
|
||||||
|
ret->is_fallback = TRUE;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -251,6 +251,9 @@ sysprof_symbol_cache_populate_packed (SysprofSymbolCache *self,
|
|||||||
SysprofPackedSymbol packed;
|
SysprofPackedSymbol packed;
|
||||||
SysprofSymbol *symbol = node->symbol;
|
SysprofSymbol *symbol = node->symbol;
|
||||||
|
|
||||||
|
if (symbol->is_fallback)
|
||||||
|
continue;
|
||||||
|
|
||||||
packed.addr_begin = symbol->begin_address;
|
packed.addr_begin = symbol->begin_address;
|
||||||
packed.addr_end = symbol->end_address;
|
packed.addr_end = symbol->end_address;
|
||||||
packed.pid = pid;
|
packed.pid = pid;
|
||||||
|
|||||||
@ -39,6 +39,7 @@ struct _SysprofSymbol
|
|||||||
SysprofAddress end_address;
|
SysprofAddress end_address;
|
||||||
|
|
||||||
guint kind : 3;
|
guint kind : 3;
|
||||||
|
guint is_fallback : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
SysprofSymbol *_sysprof_symbol_new (GRefString *name,
|
SysprofSymbol *_sysprof_symbol_new (GRefString *name,
|
||||||
|
|||||||
Reference in New Issue
Block a user