← Back to team overview

kicad-developers team mailing list archive

Re: winbuilder debug build link fail

 

main is in wx/app.h, because this is where IMPLMENT_APP is defined.


Try the attached patch, after applying, modify printf() to your different output function
if that is appropriate.

Any output text after "end of main" are coming from static destructors.  If you don't see
that output, then the crash is before the end of main().

That first question halves the search space.  Then you will have to delve into one of the
halves.

If the crash is in the static destructor half of the problem space, the linker map for
pcbnew.kiface may be of some help.  Or you can google for how to debug static destructors
when using gcc/mingw.


Dick



On 07/15/2014 04:18 AM, Jason Whiteman wrote:
> I'm having some difficulty locating the entry point for pcbnew ("main()").
> 
> Regards,
> Jason
> 
> 
> 
> On Mon, Jul 14, 2014 at 9:45 AM, Dick Hollenbeck <dick@xxxxxxxxxxx
> <mailto:dick@xxxxxxxxxxx>> wrote:
> 
>     On 07/14/2014 03:14 AM, Jason Whiteman wrote:
>     > Thanks again.  I had already added the suggested OnExit printfs directly after
>     sending my
>     > previous message as I had mentioned the coverage was not full.
>     >
>     > int  OnExit()           // overload wxApp virtual
>     >     {
>     >   int jwdebug; // JW Debug
>     >
>     >   OutputDebugString(TEXT("single_top.cpp: OnExit() - Before wxApp::OnExit()\n"));
>      // JW Debug
>     >   jwdebug = wxApp::OnExit();  // JW Debug
>     >   OutputDebugString(TEXT("single_top.cpp: OnExit() - After wxApp::OnExit()\n"));  //
>     JW Debug
>     >   return (jwdebug);
>     >         // return wxApp::OnExit(); original
>     >     }
>     >
>     > No interesting debug output as I saw printf output before and after wxApp::OnExit
> 
>     Let's rewind just a little.  What I was recommending was to determine if the crash is
>     happening in a static destructor or not.  Again "static destructor or not."  THis is a yes
>     or no question, with only one of two possible answers.
> 
>     If the crash happens after main() then, its in a static destructor, else not.  Again, only
>     two choices.
> 
>     Yes, you can inline expand the macro IMPLEMENT_APP() without recompiling wxWidgets.  Just
>     look at the header where it is defined, and put that code in place of the macro in
>     single_top.cpp
> 
>     And instrument the bottom of main() with a printf that will hopefully get you the answer
>     to this YES/NO question.
> 
> 
> 
> 
>     >
>     > Converting the macro on line 190: "IMPLEMENT_APP( APP_SINGLE_TOP );" will require
>     > compiling wxWidgets from source which is a "blackbox" portion of winbuilder -
>     tipping the
>     > scale to use Linux as a dev. environment so I can compile "proper" in a native dev.
>     > environment.   At least, it is my understanding that this is a pre-built portion of
>     Kicad
>     > using the winbuilder environment.
>     >
>     > Something up with my target OS is not outside of the domain of possibilities.  Thus
>     far I
>     > have a win 2k8 server that bails out in early code - a win 7 machine that bails out in
>     > very late code (possibly not even Kicad as mentioned -- the exception is noted in the
>     > Kicad thread) so digging up a 3rd opinion in my local pool would be a datapoint.
>     >
>     > Regards,
>     > Jason
>     >
>     >
>     >
>     > On Sun, Jul 13, 2014 at 11:41 AM, Dick Hollenbeck <dick@xxxxxxxxxxx
>     <mailto:dick@xxxxxxxxxxx>
>     > <mailto:dick@xxxxxxxxxxx <mailto:dick@xxxxxxxxxxx>>> wrote:
>     >
>          No idea.
>     >
>     >     I don't see the crash in the output.  It would be prudent to have the crash text
>     and the
>     >     debug text in the same stream if possible, that way it might infer "sequence of
>     events".
>     >
>     >     There's not much remaining in program execution before the end.  The only additional
>     >     printf()'s you might add are here in APP_SINGLE_TOP's
>     >
>     >
>     >         int  OnExit()           // overload wxApp virtual
>     >         {
>     >             return wxApp::OnExit();
>     >         }
>     >
>     >
>     >     before and after.  The printf()'s from PGM_BASE::destroy() are expected twice,
>     yet we see
>     >     only one.  The second set of printf()s are expected from the static destructor,
>     which
>     >     would fire way after APP_SINGLE_TOP::OnExit() returns, just before the program
>     is tossed
>     >     from memory.  This static destruction is the the result of line 190 in
>     single_top.cpp.
>     >     Since we don't see that second set of printf()s this tells us that the problem
>     may not be
>     >     the destruction of some other non-KiCad thing, possibily from another library
>     that I have
>     >     no knowledge of.  You might manually expand the macro at line 190 into C++ code.
>      That
>     >     would allow you to place some additional printf()s even closer to the end of the
>     program.
>     >
>     >
>     >     Also, I found this:
>     >
>     >
>     >    
>     http://stackoverflow.com/questions/5162011/what-does-this-windows-2008-debug-output-mean
>     >
>     >
>     >     Maybe a phone call to Microsoft is in order, or a change in OS version or
>     something.  To
>     >     my knowledge you are the only KiCad user having this problem.
>     >
>     >
>     >
>     >
>     >     On 07/13/2014 05:31 AM, Jason Whiteman wrote:
>     >     > I've been busy with other work - but wanted to offer an update.
>     >     >
>     >     > For debugging the crash - the PGM_KICAD entries do not apply since Kicad.exe
>     itself does
>     >     > not crash - just pcbnew.    I do not see that pcbnew uses the PGM_KICAD exit
>     >     routines here
>     >     > - as PGM_KICAD destroyers work fine with kicad.exe.
>     >     >
>     >     > Granted -- not yet fully understanding the structure -- I placed debug outputs in
>     >     the exit
>     >     > routines of pcbnew and also destroyers within the src/kicad/common sources
>     >     (pgm_base.cpp,
>     >     > single_top.cpp, kiway.cpp).
>     >     >
>     >     > Therefore, the results are fairly noisy at this point.  Here is the output at
>     this point
>     >     > (note there is an unhandled win32 exception associated with this shutdown).
>      Although I
>     >     > have not fully studied the output, I believe I may need to add more "printf"
>     output to
>     >     > capture the failure point:
>     >     >
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] pcbframe.cpp: PCB_EDIT_FRAME::OnCloseWindow - Before Destroy()
>     >     > [35836] pcbframe.cpp: PCB_EDIT_FRAME::OnCloseWindow - After Destroy()
>     >     > [35836] pcbframe.cpp: PCB_EDIT_FRAME::~PCB_EDIT_FRAME() - Before destroyTools()
>     >     > [35836] pcbframe.cpp: PCB_EDIT_FRAME::~PCB_EDIT_FRAME() - Before
>     m_RecordingMacros = -1
>     >     > [35836] pcbframe.cpp: PCB_EDIT_FRAME::~PCB_EDIT_FRAME() - Before for loop
>     >     > [35836] pcbframe.cpp: PCB_EDIT_FRAME::~PCB_EDIT_FRAME() - Before delete m_drc
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before w = event.GetWindow()
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - Before for loop
>     >     > [35836] kiway.cpp: KIWAY::player_destroy_handler - After for loop
>     >     > [35836] single_top.cpp: OnPgmExit() - Before Kiway.OnKiwayEnd()
>     >     > [35836] single_top.cpp: OnPgmExit() - Before saveCommonSettings()
>     >     > [35836] single_top.cpp: OnPgmExit() - Before PGM_BASE::destroy()
>     >     > [35836] pgm_base.cpp: PGM_BASE::destroy() - Before delete m_common_settings
>     >     > [35836] pgm_base.cpp: PGM_BASE::destroy() - Before m_common_settings = 0
>     >     > [35836] pgm_base.cpp: PGM_BASE::destroy() - Before delete m_pgm_checker
>     >     > [35836] pgm_base.cpp: PGM_BASE::destroy() - Before m_pgm_checker = 0
>     >     > [35836] pgm_base.cpp: PGM_BASE::destroy() - Before delete m_file_checker
>     >     > [35836] pgm_base.cpp: PGM_BASE::destroy() - Before m_file_checker = 0
>     >     > [35836] pgm_base.cpp: PGM_BASE::destroy() - Before delete m_locale
>     >     > [35836] pgm_base.cpp: PGM_BASE::destroy() - Before m_locale = 0
>     >     > [35836] pgm_base.cpp: PGM_BASE::destroy() - Before delete m_html_ctrl
>     >     > [35836] pgm_base.cpp: PGM_BASE::destroy() - Before m_html_ctrl = 0
>     >     > [35836] pgm_base.cpp: PGM_BASE::destroy() - After m_html_ctrl = 0
>     >     > [35836] single_top.cpp: OnPgmExit() - After PGM_BASE::destroy()
>     >     > [FFFFFA800783F200] WskProIRPGetAddrInfo is called.
>     >     > [bind=FFFFFA8006F43760] Binding reference count++ = 2 (status = 00000000,
>     >     impersonation= 2).
>     >     > [FFFFFA80077D90F0] Request reference count++ = 3.
>     >     > [FFFFFA80077D90F0] RPC method type = 1: rpc-method succeeded, queue to
>     rpc-pending-list.
>     >     > [FFFFFA80077D90F0] Request reference count-- = 2.
>     >     > [FFFFFA80077D90F0] WskKnrRpcComplete: rpc calls back for completion.
>     >     > [FFFFFA80077D90F0] WskKnrCompletePending: complete pending request (rpc=1).
>     >     > [FFFFFA80077D90F0] Request reference count-- = 1.
>     >     > [FFFFFA80077D90F0] Request reference count-- = 0.
>     >     > [FFFFFA80077D90F0] WskKnrCompleteRequest: rpc completion return status = 00000000
>     >     > (reply=c0000272).
>     >     > [FFFFFA80077D90F0] WskProAPIGetAddressInfo returned addrinfo:
>     [addr=0000000000000000].
>     >     > [bind=FFFFFA8006F43760] Binding reference count-- = 1.
>     >     > [FFFFFA80077D90F0] WskKnrCompleteRequest: complete irp with IO status = c0000272.
>     >     > [FFFFFA800783F200] WskProIRPGetAddrInfo is called.
>     >     > [bind=FFFFFA8006F43760] Binding reference count++ = 2 (status = 00000000,
>     >     impersonation= 2).
>     >     > [FFFFFA80077D90F0] Request reference count++ = 3.
>     >     > [FFFFFA80077D90F0] RPC method type = 1: rpc-method succeeded, queue to
>     rpc-pending-list.
>     >     > [FFFFFA80077D90F0] Request reference count-- = 2.
>     >     > [FFFFFA80077D90F0] WskKnrRpcComplete: rpc calls back for completion.
>     >     > [FFFFFA80077D90F0] WskKnrCompletePending: complete pending request (rpc=1).
>     >     > [FFFFFA80077D90F0] Request reference count-- = 1.
>     >     > [FFFFFA80077D90F0] Request reference count-- = 0.
>     >     > [FFFFFA80077D90F0] WskKnrCompleteRequest: rpc completion return status = 00000000
>     >     > (reply=c0000272).
>     >     > [FFFFFA80077D90F0] WskProAPIGetAddressInfo returned addrinfo:
>     [addr=0000000000000000].
>     >     > [bind=FFFFFA8006F43760] Binding reference count-- = 1.
>     >     > [FFFFFA80077D90F0] WskKnrCompleteRequest: complete irp with IO status = c0000272.
>     >     >
>     >     >
>     >     > On Sun, Jul 6, 2014 at 11:54 AM, Dick Hollenbeck <dick@xxxxxxxxxxx
>     <mailto:dick@xxxxxxxxxxx>
>     >     <mailto:dick@xxxxxxxxxxx <mailto:dick@xxxxxxxxxxx>>
>     >     > <mailto:dick@xxxxxxxxxxx <mailto:dick@xxxxxxxxxxx> <mailto:dick@xxxxxxxxxxx
>     <mailto:dick@xxxxxxxxxxx>>>> wrote:
>     >     >
>     >     >     On 07/05/2014 08:23 PM, Jason Whiteman wrote:
>     >     >     > Team,
>     >     >     >
>     >     >     >      I've been using the "printf" method to identify the cause of a windows
>     >     exception on
>     >     >     > close of pcbnew.exe (release) I have seen.  However, all passed for as
>     deep to the
>     >     >     end of
>     >     >     > the program as I could identify.
>     >     >
>     >     >     I maintain about 6 "out of tree" build directories:
>     >     >
>     >     >     Debug using wx3.1x
>     >     >     Debug using wx2.8.11
>     >     >     Release using wx2.8.11
>     >     >     Release using wx3.1x
>     >     >     Debug using SCRIPTING
>     >     >     Release using SCRIPTING
>     >     >
>     >     >     This way the whole tree rarely gets recompiled.
>     >     >
>     >     >     A fast computer helps, especially if your time is worth something.
>     >     >
>     >     >     For this problem, I think printf() may be a sufficient troubleshooting aid.
>     >     >
>     >     >     After the program returns from main(), the static C++ destructors run.  I
>     was seeing
>     >     >     problems with the destruction of the wxSingleInstanceChecker objects.
>      There can
>     >     be out of
>     >     >     sequence issues on static C++ destruction just like there can be for static
>     >     construction.
>     >     >       You know, one object depends on another, and they are destroyed out of
>     sequence.
>     >     >
>     >     >     You might put some printf()'s in PGM_BASE::destroy(), be sure and
>     terminate each
>     >     string
>     >     >     with a newline so it gets flushed.
>     >     >
>     >     >     Probably these printf()'s will show up twice:
>     >     >
>     >     >     1) once during the explicit call to PGM_BASE::destroy() from
>     >     PGM_KICAD::OnPgmExit() thru
>     >     >     PGM_KICAD::destroy(), or PGM_SINGLE_TOP::OnPgmExit().
>     >     >
>     >     >
>     >     >     2) static C++ destruction of the PGM_BASE object.  Everything is already
>     >     destroyed by then
>     >     >     however.
>     >     >
>     >     >     I'm thinking that the last printf() you see, tells that you got at least that
>     >     far before
>     >     >     the segfault.
>     >     >
>     >     >
>     >     >
>     >     >     > Therefore, I wanted to transition to a debug build and
>     >     >     > use debug tools to attempt to identify the source of my windows exception on
>     >     pcbnew
>     >     >     exit.
>     >     >
>     >     >     Are you starting with kicad.exe or pcbnew.exe ?
>     >     >
>     >     >
>     >     >
>     >     >     >
>     >     >     >      What I've run into is a link error that mirrors a similar issue
>     previously
>     >     >     identified
>     >     >     > by another developer on the list -- and this thread is quite dated.
>      Reading the
>     >     >     thread, I
>     >     >     > did not readily see how to resolve the issue.
>     >     >     >
>     >     >     > https://lists.launchpad.net/kicad-developers/msg11097.html
>     >     >     >
>     >     >     >      What I found was the issue was reproduced with recent builds if I had
>     >     >     previously set
>     >     >     > the debug level to "Release", change it to "Debug" and run "make" then I
>     would see
>     >     >     this issue.
>     >     >     >
>     >     >     >       In an attempt to resolve the issue, I went to the ./build
>     directory and
>     >     ran a
>     >     >     > "mingw32-make.exe clean".   This did not help.  The latest attempt used
>     >     SCRIPTING OFF,
>     >     >     > make clean, then the hour-long+ rebuild.
>     >     >     >
>     >     >     >      Some sample error output (without having to look at the link above):
>     >     >     >
>     >     >     > CMakeFiles\_pcbnew.dir/objects.a(pcbnewPYTHON_wrap.cxx.obj): In function
>     >     >     > `SWIG_Python_AddErrorMsg':
>     >     >     >
>     >     >
>     >    
>     C:/kicad_build/kicad-winbuilder-3.4/build/Debug/pcbnew/scripting/pcbnewPYTHON_wrap.cxx:1020:
>     >     >     > undefined reference to `_imp___Py_RefTotal'
>     >     >     >
>     >     >
>     >    
>     C:/kicad_build/kicad-winbuilder-3.4/build/Debug/pcbnew/scripting/pcbnewPYTHON_wrap.cxx:1020:
>     >     >     > undefined reference to `_imp___Py_RefTotal'
>     >     >     >
>     >     >
>     >    
>     C:/kicad_build/kicad-winbuilder-3.4/build/Debug/pcbnew/scripting/pcbnewPYTHON_wrap.cxx:1024:
>     >     >     > undefined reference to `_imp___Py_RefTotal'
>     >     >     >
>     >     >     >      Is there advice on how to get the debug to work w/winbuilder?
>     >     >     >
>     >     >     > Regards,
>     >     >     > Jason
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     > _______________________________________________
>     >     >     > Mailing list: https://launchpad.net/~kicad-developers
>     >     >     > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>>
>     >     >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>>>
>     >     >     > Unsubscribe : https://launchpad.net/~kicad-developers
>     >     >     > More help   : https://help.launchpad.net/ListHelp
>     >     >     >
>     >     >
>     >     >
>     >     >     _______________________________________________
>     >     >     Mailing list: https://launchpad.net/~kicad-developers
>     >     >     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>>
>     >     >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>>>
>     >     >     Unsubscribe : https://launchpad.net/~kicad-developers
>     >     >     More help   : https://help.launchpad.net/ListHelp
>     >     >
>     >     >
>     >     >
>     >     >
>     >     > _______________________________________________
>     >     > Mailing list: https://launchpad.net/~kicad-developers
>     >     > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>>
>     >     > Unsubscribe : https://launchpad.net/~kicad-developers
>     >     > More help   : https://help.launchpad.net/ListHelp
>     >     >
>     >
>     >
>     >     _______________________________________________
>     >     Mailing list: https://launchpad.net/~kicad-developers
>     >     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>>
>     >     Unsubscribe : https://launchpad.net/~kicad-developers
>     >     More help   : https://help.launchpad.net/ListHelp
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > Mailing list: https://launchpad.net/~kicad-developers
>     > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     > Unsubscribe : https://launchpad.net/~kicad-developers
>     > More help   : https://help.launchpad.net/ListHelp
>     >
> 
> 
>     _______________________________________________
>     Mailing list: https://launchpad.net/~kicad-developers
>     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     Unsubscribe : https://launchpad.net/~kicad-developers
>     More help   : https://help.launchpad.net/ListHelp
> 
> 

=== modified file 'common/single_top.cpp'
--- common/single_top.cpp	2014-05-28 04:30:38 +0000
+++ common/single_top.cpp	2014-07-15 12:54:23 +0000
@@ -47,6 +47,19 @@
 #include <kiway_player.h>
 #include <confirm.h>
 
+#undef wxIMPLEMENT_WXWIN_MAIN_CONSOLE
+
+#define wxIMPLEMENT_WXWIN_MAIN_CONSOLE      \
+    int main(int argc, char **argv)         \
+    {                                       \
+        wxDISABLE_DEBUG_SUPPORT();          \
+                                            \
+        int ret = wxEntry(argc, argv);      \
+        printf( "end of main\n" );          \
+        return ret;                         \
+    }
+
+
 
 // The functions we use will cause the program launcher to pull stuff in
 // during linkage, keep the map file in mind to see what's going into it.


Follow ups

References