From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9642 invoked by alias); 29 Dec 2010 08:34:07 -0000 Received: (qmail 9503 invoked by uid 22791); 29 Dec 2010 08:34:05 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_CX,TW_DC,TW_GC X-Spam-Check-By: sourceware.org Received: from mail-fx0-f47.google.com (HELO mail-fx0-f47.google.com) (209.85.161.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Dec 2010 08:34:00 +0000 Received: by fxm17 with SMTP id 17so9480977fxm.20 for ; Wed, 29 Dec 2010 00:33:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.70.193 with SMTP id e1mr2966643faj.91.1293611637458; Wed, 29 Dec 2010 00:33:57 -0800 (PST) Received: by 10.223.102.76 with HTTP; Wed, 29 Dec 2010 00:33:57 -0800 (PST) In-Reply-To: References: <4D1A2017.3060605@caviumnetworks.com> Date: Wed, 29 Dec 2010 08:34:00 -0000 Message-ID: Subject: Re: NullPointerException throwed when running GCJ From: majia gm To: David Daney Cc: gcc-help@gcc.gnu.org, Java List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2010-12/txt/msg00009.txt.bz2 2010/12/29 majia gm : > 2010/12/29 David Daney : >> Adding java@... as this is where java questions are handled. >> >> On 12/28/2010 07:05 AM, majia gm wrote: >>> >>> Hi, everyone. >>> >>> I'm porting GCJ to a non-mainstream platform, which is a RISC machine >>> with some similarity to ARM. >>> The GCC I'm using is version 4.4.2. I start the porting from ARM's code. >>> >> >> There is quite a bit of work involved in getting libgcj running on a new >> target. =A0One thing that is obvious from your stack trace is that the s= tack >> unwinding code is not decoding the instruction pointer properly. That wo= uld >> be one place to start. >> >> Unfortunatly, there isn't really one specific thing we can point you to. >> =A0You will probably have to step through things with GDB and make sure = that >> are the target specific code is doing the right thing. >> >> The boehm-gc may need porting as well. =A0Actually I might start with >> boehm-gc, I think it has its own test suite, so it can be debugged >> separately. >> >> Then look at all the target specific code for a known working target (ar= m, >> mips, x86, etc...) and try to verify that your target code functions >> correctly. >> >> Good Luck, >> David Daney >> >> >> >>> When running the GCJ on the target platform, it mentioned that the ECJ >>> is needed. I don't know whether GCJ can live without ECJ, so I >>> donwload the latest ECJ jar file and recompiled. >>> >>> When running GCJ to compile a JAVA source file, I got the following err= or. >>> >>> [root@localhost pxx]# gcj -C HelloWorld.java -v >>> Using built-in specs. >>> Target: unicore32-linux >>> Configured with: /home/vhome/FengYi/pxx/mydir/gcc-4.4.2/configure >>> --host=3Dunicore32-linux --target=3Dunicore32-linux --prefix=3D/usr >>> --build=3Di686-redhat-linux-gnu --enable-clocale=3Dgnu --enable-shared >>> --enable-threads=3Dposix --enable-__cxa_atexit --enable-languages=3Djava >>> --with-gnu-ld --disable-libstdcxx-pch --disable-multilib >>> --with-pkgversion=3DUC4_1.0_gama_20101228 >>> Thread model: posix >>> gcc version 4.4.2 (UC4_1.0_gama_20101228) >>> COLLECT_GCC_OPTIONS=3D'-fsaw-java-file' '-C' '-v' >>> '-fbootclasspath=3D./:/usr/share/java/libgcj-4.4.2.jar' '-g1' >>> '-fsyntax-only' '-femit-class-files' '-S' '-o' 'NONE' '-shared-libgcc' >>> =A0/usr/libexec/gcc/unicore32-linux/4.4.2/ecj1 HelloWorld.java -g1 >>> -fbootclasspath=3D./:/usr/share/java/libgcj-4.4.2.jar -g1 -fsource=3D1.5 >>> -ftarget=3D1.5 -fzip-dependency /tmp/ccTF9EKh.zip >>> Exception in thread "main" java.lang.ExceptionInInitializerError >>> =A0 =A0at 0x1(Unknown Source) >>> =A0 =A0at 0x3(Unknown Source) >>> =A0 =A0at 0x5(Unknown Source) >>> =A0 =A0at 0x5(Unknown Source) >>> =A0 =A0at 0x5(Unknown Source) >>> =A0 =A0at 0x5(Unknown Source) >>> =A0 =A0at 0x5(Unknown Source) >>> =A0 =A0at 0xffffffffffffffff(Unknown Source) >>> =A0 =A0at 0x2(Unknown Source) >>> =A0 =A0at 0xffffffffffffffff(Unknown Source) >>> =A0 =A0at 0xffffffffffffffff(Unknown Source) >>> Caused by: java.lang.NullPointerException >>> =A0 =A0at 0x1(Unknown Source) >>> =A0 =A0at 0x5(Unknown Source) >>> =A0 =A0at 0x4(Unknown Source) >>> =A0 =A0...9 more >>> >>> >>> Could anyone give me some hints on how could this happen? >>> I really appreciate you patience. >>> >> >> > > Hi, David. > > Thank you for your reply. It's very nice of you. > > When metioned to the stack unwinding code, do you mean the file > backtrace.h in libjava/sysdeps/arch? It seems some archs don't have > this file. And ARM has this file, but seems it takes over little > works. > > Actually, the current status of my porting is as follows. I tried gij > successfully on the target to interpret a simple class file > HelloWorld.class which is compiled through a x86-gcj on a x86 machine. > And the gcj on the target also works well to compile the source file > HelloWorld.java into native executable file. But it fails to compile > HelloWorld.java into HelloWorld.class through gcj on the target. My > GCC version is 4.4.2, and the ecj I used is the latest. > > I found that when compiling Java sources into class file, the x86-gcj > use the jc1 instead of ecj. > The following two questions confusing me. Can gcj live without ecj? > What's the difference between ecj and jc1? I googled and got little. > > If you could give me some hints, I would really appreciate. > > Thank you. > Gmmajia > Sorry, I make a mistake in the last massege. The gcj on the target can compile the class file HelloWorld.class into native executable file, but cannot compile the source file HelloWorld.java.