[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Tip: use of GDB with Java/gcj (and ant)



I recently started developing with gcj on debian and wanted to use
gdb for debugging, but I've struggled a bit with it.  I had actually
composed a lengthy set of questions to ask here on the list, but in
writing the email, I stumbled across the answer, which I now present.

The problem: I wasn't getting any debugging information (line numbers
or local symbols into the code when I compiled with ant.  My javac
task in build.xml looked like this:

        <javac debug="true" verbose="yes" debuglevel="source" includeJavaRuntime="no" 
	compiler="gcj" destdir="classes">
            <src path="src" />
            <include name="**/*.java" />
            <compilerarg line=" --main=Main -o Coast" />
        </javac>

The solution was to change the javac task to this:

        <javac verbose="yes" includeJavaRuntime="no" 
	compiler="gcj" destdir="classes">
            <src path="src" />
            <include name="**/*.java" />
            <compilerarg line="-g --main=Main -o Coast" />
        </javac>

Note that the 'debug' and 'debuglevel' properties were removed, and
the '-g' option was added to 'compilerarg'

I hope this helps someone else avoid the hand-wringing and
teeth-gnashing I went through.



Reply to: