can't debug mfc program

Francois Gouget fgouget at
Tue Oct 2 11:48:24 CDT 2001

On Tue, 2 Oct 2001, Guilherme Kunz wrote:

> Hi! 
> I am trying compile a mfc program with winelib. 
> Well, i compiled the part of mfc which i need for use the program
> whitout erros or unresolved functions and compiled the mfc program
> with the without errors or unresolved functions, but when
> i ran the mfc program hapned "Segmentation Fault".
> I tried use gdb and winedbg but i can't run these debuggers, with
> gdb happned "Segmentation Fault" with or without breakpoints in the
> begining of the source and winedbg write only the first line in the
> window and go out.

   Which C++ compiler did you use?
   With too old compiler (or the wrong options) the layout of your COM
virtual tables is probably wrong (though I'm not sure the execution got
that far).
   With a more recent compiler (gcc 2.96+), the C++ ABI is not supported
by either gdb or winedbg so that no debugger is usable to debug. Well,
at least you cannot put breakpoints on methods, view objects and things
many other tihngs like that. You can still put breakpoints at a specific
file line it seems.

   Also, which kernel are you using? >2.4.9+ or <2.4.5? ptrace sometimes
fails for seemingly no reason on 2.4.9, works fine in 2.4.5. But
normally all you get is a "cannot attach" or something like that.

> i tried use strace and "--debugmsg +all". 
> HeapAlloc 
> HeapAlloc 
> *killed* exit_code=0 
> #./program 
> #Segmentation fault (core dump) 
> #gdb program core 
> #Reading symbols /usr/local/lib/ ...... Segmentation fault (core 
> dump) 

   Hmmm, traces are your friends. Lots of traces. Starting with the
application's wrapper. But you will need to put some in the MFC too.
Probably starting with dllmodul.cpp (contains DllMain) and appcore.cpp
(also invoked during init).

Francois Gouget         fgouget at
                         Stolen from an Internet user:
              "f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng !"

More information about the wine-devel mailing list