January 8, 2005

Skulldebuggery: Adventures in MinGW Mozilla, Part Two

Anytime I build Mozilla for my purposes, I'm going to insist on doing a debug build. There's no particular reason why, I just think being able to track down where a crash is happening is useful. That said, I feel somewhat dumb for having my machine dedicated to a long, lumbering build without first ensuring that I actually had a debugger on my system.

Oops. 8-)

Fortunately, I do have cygwin, which can get gdb if necessary, I believe. I'm also, very painfully and slowly under timeless's wing, starting to learn a little about IDE's.

This inadvertent discovery of mine, however, leads me to ask a few questions:

* Why is there no mention of a debugger for MinGW builds of Mozilla anywhere I can find? (As MinGW builds are "tier 3", mozilla.org is excused from any responsibility in answering this one.) I am assuming, prematurely, that gdb from cygwin will work.

* If --enable-debug is set, why do we not have some sort of basic checks in ./configure that the user has a debugger? :) I honestly don't know. Maybe --enable-debug is used for something else as well.

* What happens when you run "mozilla -g" and you don't have a debugger?

* What good, free IDE's exist for MinGW / CygWin? I spotted Visual MinGW in a brief hunt earlier...

* Coincidentally, what good, inexpensive IDE tutorials or books exist? Those things are even more intimidating than C++ to this JSer.

Feedback welcomed. Just be gentle, please.

Posted by WeirdAl at January 8, 2005 2:34 AM
Comments

I heard that Bloodshed Dev-C++ is a good MinGW IDE. And imo there's a GDB somewhere in MinGWs sourceforge download page?

Posted by: Nico at January 8, 2005 3:38 AM

>* Why is there no mention of a debugger for MinGW builds of Mozilla anywhere I can find?

there's no mention of a debugger for msvc builds either, I suppose ;) that's not really a build question...

I would assume that cygwin's gdb works, given that mingw == gcc...

you should also have ntsd installed, if you have windows xp. don't know if that supports gcc's symbol format though.

>* If --enable-debug is set, why do we not have some sort of basic checks in ./configure that the user has a debugger? :) I honestly don't know.
>Maybe --enable-debug is used for something else as well.

Yes it is. it triggers all the #ifdef DEBUG stuff. if on linux, you also get a stack trace if you crash even with no debugger installed. (no line numbers though).

>* What happens when you run "mozilla -g" and you don't have a debugger?

you get a message "Could not find a debugger on your system." :-)

>* What good, free IDE's exist for MinGW / CygWin?

I know of http://www.bloodshed.net/ (http://www.bloodshed.net/dev/devcpp.html) - don't know how good it is though.


(From Alex: I'm on Win98SE. This will change when I get a new box.)

Posted by: christian biesinger at January 8, 2005 4:51 AM

I don't have any answers for your questions - but I must say I'm completely surprised that it's even possible to debug without installing MS Visual C++... I build Mozilla with MinGW, too, but never thought I was actually able to debug with cygwin tools. That the documentation lacks even a hint of this is a real pity. Can you provide any details how to setup/use gdb?

Posted by: jens.b at January 8, 2005 5:36 AM

Bying a VC++ standard edition for roughly 90$ seems to me a pretty good investment in your hobby. At least you get a first class debugger for it. MingW is some sort of asking for trouble.

(Noted. I've been on a zero budget for years, and only in the most immediate times has that started to change.)

Posted by: Bernd at January 8, 2005 5:43 AM

I'm not a Mozilla hacker, but maybe I can answer two questions anyway:

- If --enable-debug is set, why do we not have some sort of basic checks in ./configure that the user has a debugger?

Often you don't debug programs on the build machine. In these cases the test would be useless.

- What good, free IDE's exist for MinGW / CygWin? I spotted Visual MinGW in a brief hunt earlier...

I never used MingW so far. And I'm not familiar with Eclipse CDT either. But I'm using Eclipse JDT on a daily base and it eases working so much:

-- Intelligent code completion
-- Incremental building while programming --> compile errors are underlined while you type
-- easy and powerful refactoring
-- comfortable CVS access
-- powerful code search and navigation
-- it's free and open source

You can get eclipse at http://www.eclipse.org. You will need to download the eclipse platform and then from inside eclipse the CDT (C/C++ Development tools)

Posted by: daniel. at January 8, 2005 6:18 AM

eclipse CDT seems to be confused quite a bit about the macros used in the mozilla source code, especially stuff like NS_DECL_NSICHANNEL...

Posted by: christian biesinger at January 8, 2005 11:29 AM