aboutsummaryrefslogtreecommitdiffstats
path: root/disas.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2008-10-22 15:11:31 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2008-10-22 15:11:31 +0000
commit49918a752b739041c7afb205f7158e61c0874267 (patch)
treed8da8087010dc5f06f02e972e047505d284fefaf /disas.c
parentf16a0db323e1a8c0044696815cceeb98706f2243 (diff)
* 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
Diffstat (limited to 'disas.c')
-rw-r--r--disas.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/disas.c b/disas.c
index a8bc8adf2..408617612 100644
--- a/disas.c
+++ b/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)