Assert Call Stack -- Disable or Modify Behavior?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Xangis
Earned some good credits
Earned some good credits
Posts: 122
Joined: Fri Apr 14, 2006 9:49 pm
Location: Beaverton, OR
Contact:

Assert Call Stack -- Disable or Modify Behavior?

Post by Xangis » Sat Mar 09, 2013 7:12 pm

I have a glitch that I'm trying to track down. It's related to the more strict string format specifier requirements of wxWidgets 2.9 and I'm on a Linux box.

In this particular case, rather than helping, the wx assert call stack is getting in the way. Here's what I see on the console:

Code: Select all

[00] ShowAssertDialog(wxString const&, int, wxString const&, wxString const&, wxString const&, wxAppTraits*)	appbase.cpp:0
[01] wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*)
[02] wxApp::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*)
[03] wxDefaultAssertHandler(wxString const&, int, wxString const&, wxString const&, wxString const&)	appbase.cpp:0
[04] wxOnAssert(char const*, int, char const*, char const*, char const*)
[05] wxArgNormalizer<long>::wxArgNormalizer(long, wxFormatString const*, unsigned int)	/usr/local/include/wx-2.9/wx/strvararg.h:453
[06] wxArgNormalizerWchar<long>::wxArgNormalizerWchar(long, wxFormatString const*, unsigned int)	/usr/local/include/wx-2.9/wx/strvararg.h:473
/usr/local/include/wx-2.9/wx/strvararg.h(453): assert "(argtype & (wxFormatStringSpecifier<T>::value)) == argtype" failed in wxArgNormalizer(): format specifier doesn't match argument type [in thread 7fffe5771700]
Is there a way I can do either of:

1) Have the stack print more than the last 6 items. It's nice to see what went wrong, but I don't see where it was triggered from my code. Assuming it's the same thread, it'd probably be item #8 or so.
2) Disable the assert stack trace and just get a break/crash/segfault/anything else that would stop the program in gdb so I can do a backtrace and poke around.
WinVista/7: VC++ .Net 2010 / Ubuntu 11.04: gcc4.4.3 [2.8.12 on all]

DavidHart
Site Admin
Site Admin
Posts: 3943
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Assert Call Stack -- Disable or Modify Behavior?

Post by DavidHart » Sat Mar 09, 2013 10:12 pm

Hi,

I just run the program in gdb and, when the assert dialog appears, interrupt. Then it's easy to skip past the irrelevant frames in the callstack and get to the important stuff.

Regards,

David

Xangis
Earned some good credits
Earned some good credits
Posts: 122
Joined: Fri Apr 14, 2006 9:49 pm
Location: Beaverton, OR
Contact:

Re: Assert Call Stack -- Disable or Modify Behavior?

Post by Xangis » Sat Mar 09, 2013 11:43 pm

I'm not actually getting the dialog, just a bunch of console spam. I'm used to seeing it pop up when something goes wrong on Windows, but don't get the assert dialog on my 64-bit Ubuntu 12.10 box with wx 2.9.4. I normally compile/link with wx-config --cxxflags and wx-config --libs and debug the app by running it from the console. Is there something else needed to turn on the assert dialog on Linux?
WinVista/7: VC++ .Net 2010 / Ubuntu 11.04: gcc4.4.3 [2.8.12 on all]

DavidHart
Site Admin
Site Admin
Posts: 3943
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Assert Call Stack -- Disable or Modify Behavior?

Post by DavidHart » Sun Mar 10, 2013 9:40 am

I'm not actually getting the dialog, just a bunch of console spam.
Oh. Is this a gui or a console program?
Is there something else needed to turn on the assert dialog on Linux?
No, it happens automatically in a gui app. (Though I suppose there could be yet another unity or gnome-shell issue...)

Anyway, the solution is similar: run the app in gdb, putting a breakpoint on e.g. wxAppConsoleBase::OnAssertFailure. Then when it's hit you should get a useful callstack.

Post Reply