This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: Add raw address to java stack trace if line number unavailable.

David Daney wrote:
This patch adds a new system property 'gnu.gcj.runtime.NameFinder.show_raw' that when set true will print the IP in the stack trace if the line number is unavailable. When set the trace will look something like this:

[daney@dl2 junk]$ ./Hello
Hello World
   at Hello.f1(./Hello [8048bd5])
   at Hello.main(./Hello [8048c67])
   at [8048d53])
   at Hello.main(./Hello [8048ca8])
   at java.util.Date.parse(
   at Hello.main(./Hello [8048ce9])

You can see that libgcj was compiled with -g so java.util.Date.parse has a line number. My test program (Hello) was compiled without -g so you get the offset printed out along with the object name. This allows you to use addr2line in an off-line mode to find the line numbers if desired.

This can be used in conjunction with the 'gnu.gcj.runtime.NameFinder.use_addr2line' to disable line number generation at runtime (for better performance), but still be able to get the line number information if desired.

Back in 3.3 and 3.4 the addresses used to print out, but that capability was lost with the new stack trace infrastructure. So in someways you could look at this as fixing a regression.

Currently regression testing on i686-pc-linux-gnu.

OK to commit if no regressions?

Testing completed with no failures for make -k check in libjava.

gcc/java: 2006-06-05 David Daney <>

    * gcj.texi (libgcj Runtime Properties): Document
    gnu.gcj.runtime.NameFinder.show_raw and

libjava: 2006-06-05 David Daney <>

    * gnu/gcj/runtime/ (show_raw): New field.
    (showRaw): New method.
    * : Include gnu/gcj/runtime/StringBuffer.h.
    (getLineNumberForFrame): Show IP offset in trace if line number
    not available and show_raw true.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]