mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
* Use function pointers for symbol lookup (currently for elf32 and elf64,
could be expanded). This also fixes the bug with mips elf64 symbols in current Qemu trunk. * Use quicksort and binary search for symbol lookup. * Remove unneeded entries from symbol table. This reduced a typical table size (linux mips kernel) from 1764487 to 11656 entries. Signed-off-by: Stefan Weil <weil@mail.berlios.de> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5510 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
f16a0db323
commit
49918a752b
4 changed files with 184 additions and 95 deletions
30
disas.c
30
disas.c
|
@ -303,33 +303,17 @@ void disas(FILE *out, void *code, unsigned long size)
|
|||
/* Look up symbol for debugging purpose. Returns "" if unknown. */
|
||||
const char *lookup_symbol(target_ulong orig_addr)
|
||||
{
|
||||
unsigned int i;
|
||||
/* Hack, because we know this is x86. */
|
||||
Elf32_Sym *sym;
|
||||
const char *symbol = "";
|
||||
struct syminfo *s;
|
||||
target_ulong addr;
|
||||
|
||||
for (s = syminfos; s; s = s->next) {
|
||||
sym = s->disas_symtab;
|
||||
for (i = 0; i < s->disas_num_syms; i++) {
|
||||
if (sym[i].st_shndx == SHN_UNDEF
|
||||
|| sym[i].st_shndx >= SHN_LORESERVE)
|
||||
continue;
|
||||
|
||||
if (ELF_ST_TYPE(sym[i].st_info) != STT_FUNC)
|
||||
continue;
|
||||
|
||||
addr = sym[i].st_value;
|
||||
#if defined(TARGET_ARM) || defined (TARGET_MIPS)
|
||||
/* The bottom address bit marks a Thumb or MIPS16 symbol. */
|
||||
addr &= ~(target_ulong)1;
|
||||
#endif
|
||||
if (orig_addr >= addr
|
||||
&& orig_addr < addr + sym[i].st_size)
|
||||
return s->disas_strtab + sym[i].st_name;
|
||||
}
|
||||
symbol = s->lookup_symbol(s, orig_addr);
|
||||
if (symbol[0] != '\0') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
||||
return symbol;
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue