mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 23:20:54 +00:00
Remove now unused load-address heuristic
2006-10-08 Soren Sandmann <sandmann@redhat.com> * elfparser.c: Remove now unused load-address heuristic * comment out debug spew
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
a91a19887a
commit
86810e63a5
@ -1,3 +1,9 @@
|
|||||||
|
2006-10-08 Soren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
|
* elfparser.c: Remove now unused load-address heuristic
|
||||||
|
|
||||||
|
* comment out debug spew
|
||||||
|
|
||||||
2006-10-08 Soren Sandmann <sandmann@redhat.com>
|
2006-10-08 Soren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* elfparser.c (read_symbols): Use "SHT_DYNSYM" for ".dynsym".
|
* elfparser.c (read_symbols): Use "SHT_DYNSYM" for ".dynsym".
|
||||||
|
|||||||
@ -231,8 +231,9 @@ bin_file_lookup_symbol (BinFile *bin_file,
|
|||||||
|
|
||||||
const ElfSym *sym = elf_parser_lookup_symbol (bin_file->elf, address);
|
const ElfSym *sym = elf_parser_lookup_symbol (bin_file->elf, address);
|
||||||
|
|
||||||
|
#if 0
|
||||||
g_print ("lookup in %s\n", bin_file->filename);
|
g_print ("lookup in %s\n", bin_file->filename);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (sym)
|
if (sym)
|
||||||
{
|
{
|
||||||
|
|||||||
70
elfparser.c
70
elfparser.c
@ -215,8 +215,10 @@ elf_parser_new (const char *filename,
|
|||||||
|
|
||||||
parser->file = file;
|
parser->file = file;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (!parser->symbols)
|
if (!parser->symbols)
|
||||||
g_print ("at this point %s has no symbols\n", filename);
|
g_print ("at this point %s has no symbols\n", filename);
|
||||||
|
#endif
|
||||||
|
|
||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
@ -462,57 +464,33 @@ read_symbols (ElfParser *parser)
|
|||||||
|
|
||||||
if (symtab && strtab)
|
if (symtab && strtab)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
g_print ("found symtab\n");
|
g_print ("found symtab\n");
|
||||||
|
#endif
|
||||||
read_table (parser, symtab, strtab);
|
read_table (parser, symtab, strtab);
|
||||||
}
|
}
|
||||||
|
else if (dynsym && dynstr)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
g_print ("reading from dynstr at offset %d\n", dynstr->offset);
|
||||||
|
#endif
|
||||||
|
read_table (parser, dynsym, dynstr);
|
||||||
|
#if 0
|
||||||
|
g_print ("read %d symbols\n", parser->n_symbols);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_print ("no symtab\n");
|
|
||||||
if (dynsym && dynstr)
|
|
||||||
{
|
|
||||||
g_print ("reading from dynstr at offset %d\n", dynstr->offset);
|
|
||||||
read_table (parser, dynsym, dynstr);
|
|
||||||
g_print ("read %d symbols\n", parser->n_symbols);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!dynsym)
|
|
||||||
g_print ("no dynsym\n");
|
|
||||||
if (!dynstr)
|
|
||||||
g_print ("no dynstr\n");
|
|
||||||
/* To make sure parser->symbols is non-NULL */
|
|
||||||
parser->n_symbols = 0;
|
|
||||||
parser->symbols = g_new (ElfSym, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns the address that the start of the file would be loaded
|
|
||||||
* at if the whole file was mapped
|
|
||||||
*/
|
|
||||||
static gulong
|
|
||||||
elf_parser_get_load_address (ElfParser *parser)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
gulong load_address = (gulong)-1;
|
|
||||||
|
|
||||||
for (i = 0; i < parser->n_sections; ++i)
|
|
||||||
{
|
|
||||||
Section *section = parser->sections[i];
|
|
||||||
|
|
||||||
if (section->allocated)
|
|
||||||
{
|
|
||||||
gulong addr = section->load_address - section->offset;
|
|
||||||
load_address = MIN (load_address, addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
g_print ("load address: %8p\n", (void *)load_address);
|
if (!dynsym)
|
||||||
|
g_print ("no dynsym\n");
|
||||||
|
if (!dynstr)
|
||||||
|
g_print ("no dynstr\n");
|
||||||
#endif
|
#endif
|
||||||
|
/* To make sure parser->symbols is non-NULL */
|
||||||
return load_address;
|
parser->n_symbols = 0;
|
||||||
|
parser->symbols = g_new (ElfSym, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ElfSym *
|
static ElfSym *
|
||||||
@ -553,14 +531,12 @@ const ElfSym *
|
|||||||
elf_parser_lookup_symbol (ElfParser *parser,
|
elf_parser_lookup_symbol (ElfParser *parser,
|
||||||
gulong address)
|
gulong address)
|
||||||
{
|
{
|
||||||
Section *text;
|
const Section *text;
|
||||||
const ElfSym *result;
|
const ElfSym *result;
|
||||||
gsize size;
|
gsize size;
|
||||||
|
|
||||||
if (!parser->symbols)
|
if (!parser->symbols)
|
||||||
read_symbols (parser);
|
read_symbols (parser);
|
||||||
else
|
|
||||||
g_print ("has symbols already\n");
|
|
||||||
|
|
||||||
if (parser->n_symbols == 0)
|
if (parser->n_symbols == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user