bool wxAppTraitsBase::ShowAssertDialog(const wxString& msgOriginal)
{
#if wxDEBUG_LEVEL
- wxString msg = msgOriginal;
+ wxString msg;
#if wxUSE_STACKWALKER
-#if !defined(__WXMSW__)
- // on Unix stack frame generation may take some time, depending on the
- // size of the executable mainly... warn the user that we are working
- wxFprintf(stderr, wxT("[Debug] Generating a stack trace... please wait"));
- fflush(stderr);
-#endif
-
const wxString stackTrace = GetAssertStackTrace();
if ( !stackTrace.empty() )
+ {
msg << wxT("\n\nCall stack:\n") << stackTrace;
+
+ wxMessageOutputDebug().Output(msg);
+ }
#endif // wxUSE_STACKWALKER
- return DoShowAssertDialog(msg);
+ return DoShowAssertDialog(msgOriginal + msg);
#else // !wxDEBUG_LEVEL
wxUnusedVar(msgOriginal);
wxString wxAppTraitsBase::GetAssertStackTrace()
{
#if wxDEBUG_LEVEL
+
+#if !defined(__WXMSW__)
+ // on Unix stack frame generation may take some time, depending on the
+ // size of the executable mainly... warn the user that we are working
+ wxFprintf(stderr, "Collecting stack trace information, please wait...");
+ fflush(stderr);
+#endif // !__WXMSW__
+
+
wxString stackTrace;
class StackDump : public wxStackWalker
//case IDNO: nothing to do
}
#else // !__WXMSW__
- wxFprintf(stderr, wxT("%s\n"), msg.c_str());
- fflush(stderr);
-
- // TODO: ask the user to enter "Y" or "N" on the console?
- wxTrap();
+ wxUnusedVar(msg);
#endif // __WXMSW__/!__WXMSW__
- // continue with the asserts
+ // continue with the asserts by default
return false;
}
// since dialogs cannot be displayed
if ( !wxThread::IsMain() )
{
- msg += wxT(" [in child thread]");
-
-#if defined(__WXMSW__) && !defined(__WXMICROWIN__)
- msg << wxT("\r\n");
- OutputDebugString(msg.wx_str());
-#else
- // send to stderr
- wxFprintf(stderr, wxT("%s\n"), msg.c_str());
- fflush(stderr);
-#endif
- // He-e-e-e-elp!! we're asserting in a child thread
- wxTrap();
+ msg += wxString::Format(" [in thread %lx]", wxThread::GetCurrentId());
}
- else
#endif // wxUSE_THREADS
+ // log the assert in any case
+ wxMessageOutputDebug().Output(msg);
+
if ( !s_bNoAsserts )
{
- // send it to the normal log destination
- wxLogDebug(wxT("%s"), msg.c_str());
-
if ( traits )
{
// delegate showing assert dialog (if possible) to that class