Example #1
0
static void
check (ElfParser *elf, gulong addr)
{
    const ElfSym *sym = elf_parser_lookup_symbol (elf, addr);

    if (!sym)
    {
	g_print ("not found\n");
	return;
    }
    
    n = elf_parser_get_sym_name (elf, sym);
    
    g_print ("%p  =>    ", (void *)addr);

    if (sym)
    {
	g_print ("found: %s (%p)\n",
		 elf_parser_get_sym_name (elf, sym),
		 (void *)elf_parser_get_sym_address (elf, sym));
    }
    else
    {
 	g_print ("not found\n");
    }
}
Example #2
0
const bin_symbol_t *
bin_file_lookup_symbol (bin_file_t    *bin_file,
                        gulong      address)
{
    GList *list;

#if 0
    g_print ("-=-=-=- \n");

    g_print ("bin file lookup lookup %d\n", address);
#endif

    address -= bin_file->text_offset;

#if 0
    g_print ("lookup %d in %s\n", address, bin_file->filename);
#endif

    for (list = bin_file->elf_files; list != NULL; list = list->next)
    {
        ElfParser *elf = list->data;
        const ElfSym *sym = elf_parser_lookup_symbol (elf, address);

        if (sym)
        {
#if 0
            g_print ("found  %lx => %s\n", address,
                     bin_symbol_get_name (bin_file, sym));
#endif
            return (const bin_symbol_t *)sym;
        }
    }

#if 0
    g_print ("%lx undefined in %s (textoffset %x)\n",
             address + bin_file->text_offset,
             bin_file->filename,
             bin_file->text_offset);
#endif

    return (const bin_symbol_t *)bin_file->undefined_name;
}