Index: gdb-6.5-prof/gdb/symtab.c =================================================================== --- gdb-6.5-prof.orig/gdb/symtab.c 2006-11-29 03:27:18.000000000 +0100 +++ gdb-6.5-prof/gdb/symtab.c 2006-11-29 03:27:20.000000000 +0100 @@ -2022,8 +2022,8 @@ /* Find the symtab associated with PC and SECTION. Look through the psymtabs and read in another symtab if necessary. */ -struct symtab * -find_pc_sect_symtab (CORE_ADDR pc, asection *section) +static struct symtab * +find_pc_sect_symtab_uncached (CORE_ADDR pc, asection *section) { struct block *b; struct blockvector *bv; @@ -2123,6 +2123,24 @@ return (s); } +struct symtab * +find_pc_sect_symtab (CORE_ADDR pc, asection *section) +{ + static CORE_ADDR cached_pc; + static asection *cached_section; + static struct symtab *cached_symtab; + static int try_cache = 0; + + if (try_cache && (cached_pc == pc) && (cached_section == section)) + return cached_symtab; + + try_cache = 1; + cached_pc = pc; + cached_section = section; + cached_symtab = find_pc_sect_symtab_uncached (pc, section); + return cached_symtab; +} + /* Find the symtab associated with PC. Look through the psymtabs and read in another symtab if necessary. Backward compatibility, no section */