Re: Debugging mingw applications using wine

2005-01-07 Thread Eric Pouech
Bryce McKinlay a écrit :
Eric Pouech wrote:
Bryce McKinlay a écrit :
I'm trying to debug a windows .exe built with mingw using wine, but 
winedbg seems to have problems reading stabs from the mingw-built 
binary. My goal is to be able to debug a cross-compiled, native Java 
(GCJ) application, but even a simple C hello world seems to cause 
problems.

winedbg using the gdb won't work here because (likely on unix) gdb 
isn't compiled with proper 'stabs in PE' support

you can either:
- use bare winedbg (without gdb support)
- recompile gdb with 'stabs in PE' support (ie the settings used when 
compiling gdb under windows)

Could you give any hints as to how to configure GDB with 'stabs in PE' 
support? The only reference I could find in the GDB documentation is:

6.4.5 PE
Windows 95 and NT use the PE (/Portable Executable/) format for their 
executables. PE is basically COFF with additional headers.

While BFD includes special PE support, GDB needs only the basic COFF 
reader.

Is there a configure option to enable this support in the standard 
BFD/GDB code? (I'm using GDB from CVS head) - or are special patches 
required? How did you get/build the GDB you use?
There's no such things (and it's definitively not an easy task, which still 
remains to be done, and that Wine decided not to implement some years ago).

A+
--
Eric Pouech



Re: Debugging mingw applications using wine

2005-01-07 Thread Bryce McKinlay
Eric Pouech wrote:
Could you give any hints as to how to configure GDB with 'stabs in 
PE' support? The only reference I could find in the GDB documentation 
is:

6.4.5 PE
Windows 95 and NT use the PE (/Portable Executable/) format for their 
executables. PE is basically COFF with additional headers.

While BFD includes special PE support, GDB needs only the basic COFF 
reader.

Is there a configure option to enable this support in the standard 
BFD/GDB code? (I'm using GDB from CVS head) - or are special patches 
required? How did you get/build the GDB you use?
There's no such things (and it's definitively not an easy task, which 
still remains to be done, and that Wine decided not to implement some 
years ago).

In that case, what is winedbg --gdb for? Why have this option if no 
GDB supports it?

Bryce



Re: Debugging mingw applications using wine

2005-01-04 Thread Bryce McKinlay
Eric Pouech wrote:
Bryce McKinlay a écrit :
I'm trying to debug a windows .exe built with mingw using wine, but 
winedbg seems to have problems reading stabs from the mingw-built 
binary. My goal is to be able to debug a cross-compiled, native Java 
(GCJ) application, but even a simple C hello world seems to cause 
problems.
winedbg using the gdb won't work here because (likely on unix) gdb 
isn't compiled with proper 'stabs in PE' support

you can either:
- use bare winedbg (without gdb support)
- recompile gdb with 'stabs in PE' support (ie the settings used when 
compiling gdb under windows)

Could you give any hints as to how to configure GDB with 'stabs in PE' 
support? The only reference I could find in the GDB documentation is:

6.4.5 PE
Windows 95 and NT use the PE (/Portable Executable/) format for their 
executables. PE is basically COFF with additional headers.

While BFD includes special PE support, GDB needs only the basic COFF 
reader.

Is there a configure option to enable this support in the standard 
BFD/GDB code? (I'm using GDB from CVS head) - or are special patches 
required? How did you get/build the GDB you use?

Thanks!
Bryce



Re: Debugging mingw applications using wine

2005-01-02 Thread Eric Pouech
Bryce McKinlay a écrit :
I'm trying to debug a windows .exe built with mingw using wine, but 
winedbg seems to have problems reading stabs from the mingw-built 
binary. My goal is to be able to debug a cross-compiled, native Java 
(GCJ) application, but even a simple C hello world seems to cause 
problems.
winedbg using the gdb won't work here because (likely on unix) gdb isn't 
compiled with proper 'stabs in PE' support

you can either:
- use bare winedbg (without gdb support)
- recompile gdb with 'stabs in PE' support (ie the settings used when compiling 
gdb under windows)

I tried your exe with latest cvs and it load just fine in winedbg (with and 
without gdb support)

I don't know what the unknown stabs type are for. They aren't defined in latest 
gdb (6.3), the only trace I found was for the MacOS/X but I doubt it concerns 
your case.

A+



Re: Debugging mingw applications using wine

2005-01-02 Thread Dimitrie O. Paun
On Sun, Jan 02, 2005 at 11:35:07AM +0100, Eric Pouech wrote:
 winedbg using the gdb won't work here because (likely on unix) gdb isn't 
 compiled with proper 'stabs in PE' support

Maybe we should lobby people (like Fedora) to enable it by default.
 
-- 
Dimi.



Re: Debugging mingw applications using wine

2005-01-02 Thread Eric Pouech
Dimitrie O. Paun a écrit :
On Sun, Jan 02, 2005 at 11:35:07AM +0100, Eric Pouech wrote:
winedbg using the gdb won't work here because (likely on unix) gdb isn't 
compiled with proper 'stabs in PE' support

Maybe we should lobby people (like Fedora) to enable it by default.
 
but this would require teaching gdb to use winelib too
A+



Re: Debugging mingw applications using wine

2005-01-01 Thread Scott Ritchie

On Sat, 2005-01-01 at 17:53 -0500, Bryce McKinlay wrote:

 WINE is wine-0.20040914-1.rhfc2.nr from newrpms.sunsite.dk

Did you try the newer rpms on Wine's download page?  One was probably
built for the same setup you're using.

 I've attached the mingw-compiled C binary. Is it worth trying again with 
 a newwer WINE? Thanks!
 

Always!

-Scott Ritchie




Re: Debugging mingw applications using wine

2005-01-01 Thread Scott Ritchie
On Sat, 2005-01-01 at 18:04 -0800, Scott Ritchie wrote:
 On Sat, 2005-01-01 at 17:53 -0500, Bryce McKinlay wrote:
  I've attached the mingw-compiled C binary. Is it worth trying again with 
  a newwer WINE? Thanks!
  
 
 Always!
 
 -Scott Ritchie


Wait, I need to correct myself:

NOT ALWAYS.

There was a horrible bug in winelib that prevents compiling anything in
the last release.  Heh, sorry.  For now I recommend either CVS or
waiting for a week or two for the next release.

And, uh, I also recommend we go to a stable release system sooner rather
than later :)


-Scott




Re: Debugging mingw applications using wine

2005-01-01 Thread Bryce McKinlay
Scott Ritchie wrote:
On Sat, 2005-01-01 at 18:04 -0800, Scott Ritchie wrote:
 

On Sat, 2005-01-01 at 17:53 -0500, Bryce McKinlay wrote:
   

I've attached the mingw-compiled C binary. Is it worth trying again with 
a newwer WINE? Thanks!
 

Wait, I need to correct myself:
NOT ALWAYS.
There was a horrible bug in winelib that prevents compiling anything in
the last release.  Heh, sorry.  For now I recommend either CVS or
waiting for a week or two for the next release.
 

Hi Scott.
I'm not actually using winelib (I think), but rather using a 
mingw-targeted cross-gcc to build real windows .exe's, and run those 
under wine. Now that you mention it, it might be worth giving winelib a 
try, however, as it might solve some of my testing/debugging issues. 
But, in this case, I'm attempting to test and debug a non-ELF binary - 
ie set up a debugging enviroment for actual windows exe's without 
actually having to run windows :)

In any case, I tried updating to wine-20041201-1fc2winehq.i686.rpm as 
you suggested. winedbg doesn't crash any more, at least on my small C 
test application, but it does show some stabs errors:

$ winedbg ./hello-mingw.exe
WineDbg starting on pid 0xa
In 32 bit mode.
0x0021647e: jmp 0x0021646d
Wine-dbgb main
err:dbghelp_stabs:stabs_parse Unknown stab type 0x2e
err:dbghelp_stabs:stabs_parse Unknown stab type 0x4e
Many symbols with name 'main', choose the one you want (cr to abort):
[1]: 0x004012a5 main+0x25 [/home/mckinlay/tests/hello.c:4] in hello-mingw
[2]: 0x77f01130 main in wine-loader
...
On my much larger Java applications (larger because it is statically 
linked to the rather large libgcj runtime), I get thousands of those 
errors, followed (after a few minutes) by an Exception:

...
err:dbghelp_stabs:stabs_parse Unknown stab type 0x2e
err:dbghelp_stabs:stabs_parse Unknown stab type 0x4e
Exception c005
Wine-dbg
Also, the --gdb mode doesn't seem to work as I'd expect in either 
case. I get a lot of no debugging symbols found errors from gdb in 
addition to the Unknown stab type errors as above.

$ winedbg --gdb ./hello-mingw.exe
000a:000b: create process 'D:\tests\hello-mingw.exe'/0x77bd003c 
@00401220 (00)
err:dbghelp_stabs:stabs_parse Unknown stab type 0x2e
err:dbghelp_stabs:stabs_parse Unknown stab type 0x4e
000a:000b: create thread I @00401220
GNU gdb 6.3.50_2004-11-04-cvs
...
(no debugging symbols found)
trace: 98 = 80
Wine-gdb b main
Breakpoint 1 at 0x77f01148
Wine-gdb c
Continuing.

Program exited normally.
ie: gdb doesn't seem to be seeing the symbols from the windows .exe file.
Thanks for the help.
Bryce