mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
Deal with address offsets. Address lookup is now:
2006-10-07 Soren Sandmann <sandmann@daimi.au.dk> Deal with address offsets. Address lookup is now: - First convert the address to an offset into the file - Then convert to an offset into the text segment - Then add the load address of the text segment (found in the debug binary) - Then finally lookup the result in the symbol table. * elfparser.c (elf_parser_get_text_offset): New function * elfparser.c (elf_parser_lookup_symbol): Treat addresses as offsets into the text segment. * binfile.c (bin_file_new): Store the offset of the text section of the actual binary (not the debug one) (bin_file_lookup_symbol): Subtract text_offset before passing address to elf parser. * module/sysprof-module.c: Remove include of linux/config.h
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
6a7178f612
commit
52274fadd6
13
process.c
13
process.c
@ -555,7 +555,7 @@ process_lookup_symbol (Process *process, gulong address)
|
||||
Map *map = process_locate_map (process, address);
|
||||
|
||||
/* g_print ("addr: %x\n", address); */
|
||||
|
||||
|
||||
if (address == 0x1)
|
||||
{
|
||||
get_kernel_symbols ();
|
||||
@ -580,15 +580,22 @@ process_lookup_symbol (Process *process, gulong address)
|
||||
|
||||
g_print ("map address: %lx\n", map->start);
|
||||
g_print ("map offset: %lx\n", map->offset);
|
||||
g_print ("address before: %lx\n", address);
|
||||
#endif
|
||||
g_print ("address before: %lx (%s)\n", address, map->filename);
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
g_print ("address before: \n");
|
||||
g_print ("address before: \n");
|
||||
#endif
|
||||
|
||||
address -= map->start;
|
||||
address += map->offset;
|
||||
|
||||
#if 0
|
||||
address -= map->start;
|
||||
address += map->offset;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (strcmp (map->filename, "/home/ssp/sysprof/sysprof") == 0)
|
||||
|
||||
Reference in New Issue
Block a user