This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi all, Back in July I submitted a patch[1] that improved performance when debugging inferiors that load lots of shared libraries. It hinged on avoiding calling find_pc_partial_function and skip_inline_frames in handle_inferior_event when the event being handled was a stop at the solib event breakpoint. That patch was kind of hacky in that it relied on second-guessing some of the logic that followed. I started working on splitting the patch, and committed a patch to make find_pc_partial_function lazy[2] in July. Attached is a patch to make gdb avoid the call to skip_inline_frames. With a small benchmark I put together (a little program that loads 1000 shared libraries) gdb ran the application in 36s with the patch against 46s without. This patch is superficially similar to the original patch, but much simpler and different in scope. The initial patch worked on the premise that if the stop was specifially a stop for the solib event breakpoint then the calls could be skipped (because I'd walked through the code ahead and seen that their results were not used). The result was a fairly complex conditional that would have needed to be kept updated if other parts of handle_inferior_event changed. This patch works on the simpler premise that the solib event breakpoint is by definition the address of a function, ie not inline, so regardless of why the stop occurred the call to skip_inline_frames can be omitted because there are no inline frames to skip. The heuristic is therefore simpler and very much less fragile. I have tried a two of other approaches to this, but neither worked. My preferred method was to make skip_inline_frames lazy, but this caused problems because the skipping, when it occurred, invalidated the frame cache. handle_inferior_event has several places where local "frame" variables are recreated because some call or another has invalidated the frame cache and left the pointer dangling, and making skip_inline_frames added many more. It was looking like a maintainence nightmaire long before I even got it to work. The other approach I tried was to use bpstat_stop_status to identify the solib event breakpoint, rather than writing my own code to do it. This looked really clean, but failed a huge number of tests. Apparently bpstat_stop_status has side effects! How is this patch do you think? Is it ok to commit? Cheers, Gary [1] http://www.cygwin.com/ml/gdb-patches/2011-07/msg00026.html [2] http://www.cygwin.com/ml/gdb-patches/2011-07/msg00460.html -- http://gbenson.net/
Attachment:
patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |