enhancements to wxStackFrame for Linux
Francesco Montorsi
f18m_cpp217828 at yahoo.it
Wed Nov 1 03:54:07 PST 2006
Hi,
I'm walking through my TODO list and I'm now trying to enhance
wxStackFrame under Linux.
NOTE: the patch which I'll eventually manage to make is not intended for
2.7.2 at all, nor for 2.8 if you'll judge it's too late for that.
It's fine for me if it will be applied in 2.9 branch :D
It currently takes up to 40 seconds on my Athlon 3Ghz to show up the
debug message box. So there's really room for improvements :D
In particular, after studying a bit the code, I've got some notes.
Please let me know if you think something is wrong:
1) wxStackWalker::Walk walks up to 200 frames when in reality the
caller may be interested to much less. I've added a size_t maxDepth =
200 parameter and then made the GetAssertStackTrace() function used in
ShowAssertDialog use maxLines (which is fixed to 20) as maxDepth.
That saved 2-3 seconds.
2) wxGUIAppTraitsBase::ShowAssertDialog uses wxMessageBox under GTK2;
unfortunately even with only 20 lines of stack trace the resulting
message box is too tall because all the stack trace lines are wrapped.
I've asked on gtk-app-devel ML how to avoid that a GtkMessageDialog
wraps all the message lines but I fear that cannot be avoid.
So, I've also hacked the code a bit to make wxGenericMessageDialog
always available under GTK2 and made
wxGUIAppTraitsBase::ShowAssertDialog use a wxGenericMessageDialog
(which btw has mostly the same native appearance of the GTK2 native msg
box).
That *greatly* improved readability of the message box, so maybe we
should really consider to make wxGenericMessageDialog always available.
3) wxStackFrame::OnGetName calls OnGetLocation which generally is able
to set correctly m_name. However OnGetName() then still does all
processing on m_syminfo ignoring all the work done by OnGetLocation.
I made OnGetLocation set m_hasName=true when it manages to the stack name.
That saved other 2-3 seconds.
4) all the time is mostly lost by calling multiple times addr2line
which has to load in memory all the times the ELF (which with debug info
is in my case about 47 MB !!!). This is unacceptable since addr2line
accepts multiple addresses.
I'm going to change the code so that all addresses are passed to
addr2line only once and then wxStackFrames are initialized with the
right name and location info.
However I don't really understand why it wasn't implemented in this way
from the beginning... am I missing something?
Thanks,
Francesco
More information about the wx-dev
mailing list