Debuginfo packages for Java

Andrew Haley aph at redhat.com
Mon Nov 26 17:27:21 UTC 2007


Jason L Tibbitts III writes:
 > I'm having problems reviewing a package for some software written in
 > Java.  The problem is that the debuginfo package is generated without
 > any source.  find-debuginfo.sh prints out the following:
 > 
 > extracting debug info from /var/tmp/writer2latex-0.5-buildroot/usr/lib64/gcj/writer2latex/writer2latex-0.5.jar.so
 > cpio: writer2latex05/aot-compile-rpm/usr/lib64/gcj/writer2latex/writer2latex-0.5.jar.1.jar: Cannot stat: No such file or directory
 > cpio: writer2latex05/aot-compile-rpm/usr/lib64/gcj/writer2latex/writer2latex/Application.java: Cannot stat: No such file or directory
 > cpio: writer2latex05/aot-compile-rpm/usr/lib64/gcj/writer2latex/writer2latex/api/BatchConverter.java: Cannot stat: No such file or directory
 > 
 > Needless to say, the source isn't actually buried under
 > writer2latex05/aot-compile-rpm/usr/lib64/gcj/writer2latex.

The fix is to change /usr/lib/python2.5/site-packages/aotcompile.py,
which doesn't put the right pathnames into the object files.

I've attached a patch.  gbenson, please look this over.  This is my
first ever Python hack, so You Have Been Warned.  Input about my
(doubtless execrable) Python style welcome.

I have tested this patch on writer2latex, and I can debug it:


(gdb) b 'writer2latex.Application.main(java.lang.String[])void'
Function "writer2latex.Application.main(java.lang.String[])void" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

(gdb) r -jar /usr/share/java/writer2latex.jar
Starting program: /usr/bin/gij -jar /usr/share/java/writer2latex.jar

...

Breakpoint 1, writer2latex.Application.main(java.lang.String[])void (
    args=@2aaaaaafcf40)
    at /usr/src/debug/writer2latex05/source/writer2latex/Application.java:110
110                 Application app = new Application();
(gdb) n
111                 app.parseCommandLine(args);
(gdb) s
writer2latex.Application.parseCommandLine(java.lang.String[])void (
    this=@2aaaaf891e60, sArgs=@2aaaaaafcf40)
    at /usr/src/debug/writer2latex05/source/writer2latex/Application.java:466
466                 if (sArg.startsWith("-")) { // found an option
(gdb) 
471                     else if ("-xhtml+mathml+xsl".equals(sArg)) { sTargetMIME = MIMETypes.XHTML_MATHML_XSL; }
(gdb) 
466                 if (sArg.startsWith("-")) { // found an option
(gdb) 
471                     else if ("-xhtml+mathml+xsl".equals(sArg)) { sTargetMIME = MIMETypes.XHTML_MATHML_XSL; }
(gdb) 
464             while (i<sArgs.length) {
(gdb) 
506             if (sSource==null) {
(gdb) 


Andrew.


--- aotcompile.py	2006-09-07 22:59:16.000000000 +0100
+++ aotcompile.py.new	2007-11-26 16:57:28.000000000 +0000
@@ -21,6 +21,7 @@
 import sys
 import cStringIO as StringIO
 import zipfile
+import tempfile
 
 PATHS = {"make":   "/usr/bin/make",
          "gcj":    "/usr/bin/gcj",
@@ -85,6 +86,9 @@
         self.ldflags = copy.copy(LDFLAGS)
         self.makeflags = copy.copy(MAKEFLAGS)
         self.exclusions = []
+        self.filenames = tempfile.mkstemp()
+        self.gcjflags += ["-fsource-filename=" + self.filenames[1]]
+        os.system("/usr/bin/find `pwd` -type f > " + self.filenames[1])
 
     def compile(self):
         """Search srcdir for classes and jarfiles, then generate
@@ -104,6 +108,7 @@
             os.unlink(MAKEFILE)
         finally:
             os.chdir(oldcwd)
+            os.unlink(self.filenames[1])
 
     def getJobList(self):
         """Return all jarfiles and class collections in srcdir."""

-- 
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903




More information about the fedora-devel-list mailing list