----- "John Wright (ALPS, Fort Collins)" <john.wright(a)hp.com> wrote:
 On Wed, Sep 16, 2009 at 04:44:32PM -0600, Bob Montgomery wrote:
 > John and I think that this code in gdb searches things too many times,
 > particularly with this patch, but it's a start since it seems to fix the
 > problem.
 
 I'm attaching a new version of the patch, that performs way better when
 disassembling functions that live in the kernel.  (Bob found that the
 original patch made crash disassemble in-kernel functions at least 3
 times slower, but that number will be larger depending on how close the
 symbol table the function lives in is to the head of the psymtabs list.
 Module disassembly speed wasn't changed much at all.)  With this updated
 patch, we found the performance penalty of "dis -l" to be marginal.
 
 The problem with the original patch is that once the address we want is
 found in a symbol table, it then looks through the rest of the symbol
 tables in that objfile for a better match.  The original code would then
 return the best pst out of that objfile (and never get the next pst 
 from ALL_PSYMTABS), but we want to go through the rest of the objfiles
 just in case, so I moved the return statement outside of the 
 ALL_PSYMTABS loop.  But the next pst from ALL_PSYMTABS will not be from
 a new objfile - so we would wind up traversing the list (minus one
 element) again, and again, and again...
 
 The new patch removes the inner list traversal, and just takes advantage
 of the fact that we already iterate through every pst via ALL_PSYMTABS. 
I thought I saw a bit of a hitch at times with the last patch.
I'll pull it and give this one a go...
Thanks,
  Dave