[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Upgrading wx: ellipsis buttons, and wxUSE_STACKWALKER
From: |
Greg Chicares |
Subject: |
Re: [lmi] Upgrading wx: ellipsis buttons, and wxUSE_STACKWALKER |
Date: |
Tue, 12 Jul 2016 00:25:33 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.8.0 |
On 2016-06-09 15:22, Vadim Zeitlin wrote:
> On Thu, 9 Jun 2016 14:57:01 +0000 Greg Chicares <address@hidden> wrote:
[...]
> GC> So we'd get a stack trace if lmi crashes?
>
> Well, almost.
Let me ask for a little more detail here. I understand that
wxAppConsole::OnAssertFailure() can give a stack trace if a wxASSERT()
condition is false. But does wx have a way of trapping a segfault in
lmi and displaying a stack trace before lmi terminates? That's what
I'd be interested in achieving, if the wx stack walker already gives
us an easy way to do it.
> I actually tested this wxWidgets change with lmi, after
> disabling the overridden OnAssertFailure(), so I know that it does work,
The old lmi code that blocked the wx stack walker has been removed.
The reason why lmi overrides OnAssertFailure() is to prevent users from
seeing the yes-no-cancel messagebox. As the comment in common/appbase.cpp
says, that message "is for developers only".
I've tried copying and pasting from wxAppTraitsBase::ShowAssertDialog()
into 'skeleton.cpp':
@@ -594,6 +596,13 @@ void Skeleton::OnAssertFailure
<< "\n[file " << wxString(file)
<< ", line " << line << "]\n"
;
+#if defined(wxDEBUG_LEVEL) && wxDEBUG_LEVEL && defined(wxUSE_STACKWALKER) &&
wxUSE_STACKWALKER
+ wxString const stack_trace =
wxApp::GetTraits()->wxAppTraitsBase::GetAssertStackTrace();
+ if(!stack_trace.empty())
+ {
+ oss << wxT("\n\nCall stack:\n") << stack_trace;
+ }
+#endif // defined(wxDEBUG_LEVEL) && wxDEBUG_LEVEL &&
defined(wxUSE_STACKWALKER) && wxUSE_STACKWALKER
safely_show_message(oss.str().c_str());
}
but GetAssertStackTrace() is 'protected'. And DoShowAssertDialog() in
common/appbase.cpp is a static function, so it looks like I can't
override it. I suppose I could derive a class from wxAppTraitsBase,
but is there a simpler way to get the stack trace without the
yes-no-cancel dialog?
BTW, I've copied a specimen stack trace below (obtained by suppressing
lmi's Skeleton::OnAssertFailure() override). This could be useful if
we could persuade end users to send it to us (we can run it through
the gcc demangler ourselves; end users wouldn't understand the
demangled version anyway).
---------------------------
wxWidgets Debug Alert
---------------------------
/lmi/src/lmi/skeleton.cpp(1026): assert "false" failed in
UponTestWxAssertFailure().
Call stack:
[01] ZN15wxAppTraitsBase19GetAssertStackTraceEv
[02] ZN15wxAppTraitsBase16ShowAssertDialogERK8wxString
[03] ZN16wxAppConsoleBaseC2Ev
[04] ZN16wxAppConsoleBase15OnAssertFailureEPKwiS1_S1_S1_
[05] ZN16wxAppConsoleBase15OnAssertFailureEPKwiS1_S1_S1_
[06] Z10wxOnAssertPKciS0_S0_S0_
[07] ZN8Skeleton23UponTestWxAssertFailureER14wxCommandEvent
[08] ZNK16wxAppConsoleBase11HandleEventEP12wxEvtHandlerMS0_FvR7wxEventES3_
[09]
ZNK16wxAppConsoleBase16CallEventHandlerEP12wxEvtHandlerR14wxEventFunctorR7wxEvent
[10]
ZN12wxEvtHandler23ProcessEventIfMatchesIdERK21wxEventTableEntryBasePS_R7wxEvent
[11] ZN16wxEventHashTable11HandleEventER7wxEventP12wxEvtHandler
[12] ZN12wxEvtHandler11TryHereOnlyER7wxEvent
[13] ZN12wxEvtHandler19ProcessEventLocallyER7wxEvent
[14] ZN12wxEvtHandler12ProcessEventER7wxEvent
[15] ZN12wxWindowBase8TryAfterER7wxEvent
[16] ZN12wxWindowBase8TryAfterER7wxEvent
[17] ZN12wxEvtHandler18SafelyProcessEventER7wxEvent
[18] ZN10wxMenuBase14DoProcessEventEPS_R7wxEventP8wxWindow
[19] ZN10wxMenuBase9SendEventEii
[20] ZN11wxFrameBase14ProcessCommandEP10wxMenuItem
[21] ZN7wxFrame13HandleCommandEttP6HWND__
Do you want to stop the program?
You can also choose [Cancel] to suppress further warnings.
---------------------------
Yes No Cancel
---------------------------
- Re: [lmi] Upgrading wx: ellipsis buttons, and wxUSE_STACKWALKER,
Greg Chicares <=