Description of problem: ssia
Created attachment 121084 [details] stack trace This is what appeared in my terminal after a failed session where I tried to debug but got an error at each debug step. The variables view never populated but the console did show the output of my program as I stepped.
This is with rawhide. gcc 4.0.2-3
Relevant version #s: java-1.4.2-gcj-compat-1.4.2.0-40jpp_51rh.i386 libgcj-4.0.2-3.i386 libgcj-devel-4.0.2-3.i386 java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp_51rh.i386 eclipse-*-3.1.1-1jpp_6fc.i386 eclipse-cdt-3.0*
This is how I *was* reproducing but it appears to not happen every time: File->New Project->C->Managed Make C Project->Next Give a project name (say, "blahblah") Finish "Do you want to switch to ..." -> Yes Expand project blahblah (little arrow on the left-hand side) Right-click on blahblah -> New -> (c) Source File Give a name (say, "main.c"), press enter Enter this program: #include <stdio.h> int main(int argc, char **argv) { int i = 0; for (i = 0; i < 3; ++i) { printf("%d\n", i); } return 0; } File->Save Notice the new entry under project blahblah: Binaries Expand Binaries, right-click on "blahblah - [x86le]" Debug As -> Debug Local C/C++ Application Hit OK "Do you want to switch ..." -> Yes Use Run->Step Over to step over each line in the program and watch the output in the console I was getting errors at each step request
Created attachment 121092 [details] Program to test the cdtparser This is a program I've been using to test the cdtparser when natively compiled. All it does it takes a C++ source file as an argument, then prints out the functions it finds. When it works properly, everything is as it should be, but when I compiled the cdtparser jar with find-and-aot-compile (which uses the options '-findirectdispatch -shared -Wl,-Bsymbolic') it produces very strange output. I will attach a test file I have been using as input shortly
Created attachment 121093 [details] test input file for CDTParserTest This is the sample input file that I have been using for CDTParserTest. When working properly, it should say that function c starts at offset 4 and goes until offset 5 on line 1. When working incorrectly, it says that function c starts at character 4, but ends on an extremely large offset (> 20000) . To get these results I've compiled everything as follows: gcj -shared -fPIC -fjni -o libcdtparser.jar.so cdtparser.jar gcj -fPIC -fjni -classpath ./cdtparser.jar -L. -lcdtparser.jar --main=CDTParserTest CDTParserTest.java LD_LIBRARY_PATH=. ./a.out main.cpp
I was able to reproduce with gcc-4.0.2-3.i386: wget https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=121092 mv attachment.cgi\?id\=121092 CDTParserTest.java wget https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=121093 mv attachment.cgi\?id\=121093 main.cpp (with eclipse-cdt-3.0.1 (rawhide as of 2005-11-16) installed) Correct behaviour (no BC ABI): ============================= gcj -shared -fPIC -fjni -o libcdtparser.jar.so \ /usr/share/eclipse/plugins/org.eclipse.cdt.core_3.0.1/cdtparser.jar gcj -fPIC -fjni -classpath \ /usr/share/eclipse/plugins/org.eclipse.cdt.core_3.0.1/cdtparser.jar \ -L. -lcdtparser.jar --main=CDTParserTest CDTParserTest.java LD_LIBRARY_PATH=. ./a.out main.cpp Function found Name: c Starting at: 0 Ending at: 0 Name starts at: 4 Name ends at: 5 INcorrect behaviour (BC ABI): ============================= gcj -shared -findirect-dispatch -Wl,-Bsymbolic -fPIC -fjni -o \ libcdtparser.jar.so \ /usr/share/eclipse/plugins/org.eclipse.cdt.core_3.0.1/cdtparser.jar gcj -fPIC -fjni -classpath \ /usr/share/eclipse/plugins/org.eclipse.cdt.core_3.0.1/cdtparser.jar \ -L. -lcdtparser.jar --main=CDTParserTest CDTParserTest.java LD_LIBRARY_PATH=. ./a.out main.cpp Function found Name: c Starting at: 17409568 Ending at: 5 Aborted (with eclipse-cdt-3.0.0 (FC4 or older than 2005-11-16's rawhide) installed) Correct behaviour (no BC ABI): ============================= gcj -shared -fPIC -fjni -o libcdtparser.jar.so \ /usr/share/eclipse/plugins/org.eclipse.cdt.core_3.0.0/cdtparser.jar gcj -fPIC -fjni -classpath \ /usr/share/eclipse/plugins/org.eclipse.cdt.core_3.0.0/cdtparser.jar \ -L. -lcdtparser.jar --main=CDTParserTest CDTParserTest.java LD_LIBRARY_PATH=. ./a.out main.cpp Function found Name: c Starting at: 0 Ending at: 0 Name starts at: 4 Name ends at: 5 INcorrect behaviour (BC ABI): ============================= gcj -shared -findirect-dispatch -Wl,-Bsymbolic -fPIC -fjni -o \ libcdtparser.jar.so \ /usr/share/eclipse/plugins/org.eclipse.cdt.core_3.0.0/cdtparser.jar gcj -fPIC -fjni -classpath \ /usr/share/eclipse/plugins/org.eclipse.cdt.core_3.0.0/cdtparser.jar \ -L. -lcdtparser.jar --main=CDTParserTest CDTParserTest.java LD_LIBRARY_PATH=. ./a.out main.cpp Function found Name: c Starting at: 17409568 Ending at: 5 Aborted
I tried this with the 3.0 CDT RPM installed. With my FC4 system gcj (4.0.something), it failed when BC-compiled. With gcc 4.1 and gcc svn head, it worked.
I can confirm this is OK with current rawhide gcc version 4.1.0 20060121 (Red Hat 4.1.0-0.16) Target: x86_64
Works for me with 4.0.0-6. aph@zorro ~]$ gcj -shared -findirect-dispatch -Wl,-Bsymbolic -fPIC -fjni -o \ > libcdtparser.jar.so \ > /usr/share/eclipse/plugins/org.eclipse.cdt.core_3.0.0/cdtparser.jar [aph@zorro ~]$ gcj -fPIC -fjni -classpath \ > /usr/share/eclipse/plugins/org.eclipse.cdt.core_3.0.0/cdtparser.jar \ > -L. -lcdtparser.jar --main=CDTParserTest CDTParserTest.java [aph@zorro ~]$ LD_LIBRARY_PATH=. ./a.out main.cpp Function found Name: c Starting at: 0 Ending at: 0 Name starts at: 4 Name ends at: 5 [aph@zorro ~]$ gcj -v Using built-in specs. Reading specs from /usr/lib/gcc/i386-redhat-linux/4.0.2/libgcj.spec rename spec lib to liborig Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux Thread model: posix gcc version 4.0.2 20051109 (Red Hat 4.0.2-6) But fails with 4.0.0-8: [aph@zorro ~]$ LD_LIBRARY_PATH=. ./a.out main.cpp Function found Name: c Starting at: 18582304 Ending at: 5 Aborted So this is a regression. Ths differences between these two gcj versions are fairly small, so this should be easy to find.
OK, found it. This is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24251. The Red Hat 4.0 package needs to be updated with this patch from gcc-4_0-branch.
It is updated from gcc-4_0-branch, RHEL4 U3 contains 20051130 snapshot in gcc4-java-4.0.2-9.EL4 and above. You just need to use gcj4 and gij4 instead of gcj and gij.
I'm testing on FC4. This patch is not in gcc-4.0.0-8. It is needed.
FC4 has gcc-4.0.2-8.fc4, which is a 20051126 snapshot. sudo yum update
Confirmed. Andrew O, please close.
I have verified that things do indeed work as expected with an updated FC4 system and also with current rawhide. Closing.