From 6d86d55d615e02f1f9a252d15ec6339e5a253cf1 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 16 May 2023 12:43:33 -0700 Subject: [PATCH] libsysprof-analyze: give address in file/function This at least gives more visibility into what location of the file is being executed. That way you can separate different parts of the file rather than one giant "this file" so long as we could unwind successfully. --- src/libsysprof-analyze/sysprof-elf-symbolizer.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/libsysprof-analyze/sysprof-elf-symbolizer.c b/src/libsysprof-analyze/sysprof-elf-symbolizer.c index 121375f3..fd1aa257 100644 --- a/src/libsysprof-analyze/sysprof-elf-symbolizer.c +++ b/src/libsysprof-analyze/sysprof-elf-symbolizer.c @@ -53,6 +53,7 @@ sysprof_elf_symbolizer_symbolize (SysprofSymbolizer *symbolizer, g_autofree char *name = NULL; g_auto(GStrv) translations = NULL; GMappedFile *mapped_file = NULL; + guint64 relative_address; const char *path; if (process_info == NULL || @@ -110,17 +111,19 @@ sysprof_elf_symbolizer_symbolize (SysprofSymbolizer *symbolizer, fallback: /* Fallback, we failed to locate the symbol within a file we can * access, so tell the user about what file contained the symbol - * and the offset of the ELF section mapped. + * and where (relative to that file) the IP was. */ - name = g_strdup_printf ("In file %s <+0x%"G_GINT64_MODIFIER"x>", + relative_address = sysprof_document_mmap_get_file_offset (map) + + (address - sysprof_document_mmap_get_start_address (map)); + name = g_strdup_printf ("In file %s+0x%"G_GINT64_MODIFIER"x", sysprof_document_mmap_get_file (map), - sysprof_document_mmap_get_file_offset (map)); + relative_address); return _sysprof_symbol_new (sysprof_strings_get (strings, name), NULL, NULL, - sysprof_document_mmap_get_start_address (map), - sysprof_document_mmap_get_end_address (map)); + address, + address + 1); } static void