Thread: [Jamvm-general] jamvm + classpath CVS
Brought to you by:
rlougher
From: Michael K. <kon...@gm...> - 2004-12-08 08:56:23
|
Hi Robert, I just try to write a patch to make jamvm work with latest classpath CVS. It's based on jamvm 1.2.1. My problem is now that I get a NullPointerException when java.lang.Runtime gets used during startup. When starting jamvm with a simple HelloWorld app I get the following: Cannot create system class loader Exception occured while printing exception (java/lang/NoClassDefFoundError)... Original exception was java/lang/ExceptionInInitializerError With "jamvm -verbose HelloWorld" I saw that the last class access before the lang.lang.NullPointerException was loaded is java.lang.Runtime. How can I find out in which method in java.lang.Runtime this occurs ? I know this class gets used before and was already initialized. Any tipps for debugging ? Michael P.S.: To get this far I did already some changes to jamvm. I will send a patch to you soon. -- Homepage: http://www.worldforge.org/ |
From: Robert L. <rob...@gm...> - 2004-12-08 12:16:56
|
Hi Michael, It should be quite easy, but you'll have to use gdb :( 1) When debugging a C program it's always better to compile it with no optimisation. Reconfigure jamvm (CFLAGS=-g ./configure) and rebuild... 2) Do gdb jamvm 3) In gdb enter : handle SIGUSR1 nostop noprint pass (this stops gdb interfering with jamvm's thread suspension mechanism) 4) Assuming the NullPointer is thrown by the VM due to a null pointer access (as opposed to a throw in Java). Put a breakpoint on signalException : break signalException 5) type "run HelloWorld" 6) Hopefully you'll hit the breakpoint. From the parameters (excep_name) you should be able to see what exception is being signalled. 7) To find out where you are, do "bt". This will print a backtrace of the C functions on the call stack. Assuming signalException has been called from the interpreter, the previous function should be "executeJava". 8) Do "up" to move to the previous call frame (i.e. the interpreter). In here type: print mb->name This will print out the name of the currently executing method. To find the class, do: print ((ClassBlock*)(mb->class+1))->name If you want, you can follow the Java call stack : frame points to the last frame on the thread's Java stack. frame->prev->mb->name Shows the name of the method which called this one. There are a couple of special frames to handle linkage between native code and Java, etc. so this trick won't work for all frames... Hope this helps, Rob. On Wed, 8 Dec 2004 09:56:46 +0100, Michael Koch <kon...@gm...> wrote: > Hi Robert, > > I just try to write a patch to make jamvm work with latest classpath > CVS. It's based on jamvm 1.2.1. > > My problem is now that I get a NullPointerException when > java.lang.Runtime gets used during startup. > > When starting jamvm with a simple HelloWorld app I get the following: > > Cannot create system class loader > Exception occured while printing exception > (java/lang/NoClassDefFoundError)... > Original exception was java/lang/ExceptionInInitializerError > > With "jamvm -verbose HelloWorld" I saw that the last class access > before the lang.lang.NullPointerException was loaded is > java.lang.Runtime. > > How can I find out in which method in java.lang.Runtime this occurs ? > I know this class gets used before and was already initialized. > Any tipps for debugging ? > > Michael > > P.S.: To get this far I did already some changes to jamvm. I will send > a patch to you soon. > -- > Homepage: http://www.worldforge.org/ > |
From: Robert L. <rob...@gm...> - 2004-12-08 12:23:44
|
Hi Michael, As a matter of interest, when did jamvm + classpath CVS break? Any idea what the change could have been? Thanks, Rob. On Wed, 8 Dec 2004 09:56:46 +0100, Michael Koch <kon...@gm...> wrote: > Hi Robert, > > I just try to write a patch to make jamvm work with latest classpath > CVS. It's based on jamvm 1.2.1. > > My problem is now that I get a NullPointerException when > java.lang.Runtime gets used during startup. > > When starting jamvm with a simple HelloWorld app I get the following: > > Cannot create system class loader > Exception occured while printing exception > (java/lang/NoClassDefFoundError)... > Original exception was java/lang/ExceptionInInitializerError > > With "jamvm -verbose HelloWorld" I saw that the last class access > before the lang.lang.NullPointerException was loaded is > java.lang.Runtime. > > How can I find out in which method in java.lang.Runtime this occurs ? > I know this class gets used before and was already initialized. > Any tipps for debugging ? > > Michael > > P.S.: To get this far I did already some changes to jamvm. I will send > a patch to you soon. > -- > Homepage: http://www.worldforge.org/ > |
From: Michael K. <kon...@gm...> - 2004-12-08 20:51:46
|
Am Mittwoch, 8. Dezember 2004 14:41 schrieb Robert Lougher: > The problem is I don't have access to CVS during the week... From > looking at the patch, it needs > > 1) Update to JamVM's ClassLoader class (or remove it, and use > Classpath's one) > > 2) Implement VMSystemProperties init() and isWordsBigEndian(). > From the looks of it, you can use the existing > insertSystemProperties for init(). > > Is this what you've done? yes, and some stuff more. Michael -- Homepage: http://www.worldforge.org/ |
From: Robert L. <rob...@gm...> - 2004-12-08 14:01:16
|
There's also changes to the reference VMClassLoader, but I don't think these affect JamVM as it uses it's own native implementation of getResources. From the looks of it, it should be possible to get a patch so that the same version will run with Classpath-0.12 and CVS. Thanks, Rob. On Wed, 8 Dec 2004 14:53:38 +0100, Michael Koch <kon...@gm...> wrote: > Am Mittwoch, 8. Dezember 2004 14:41 schrieb Robert Lougher: > > > > The problem is I don't have access to CVS during the week... From > > looking at the patch, it needs > > > > 1) Update to JamVM's ClassLoader class (or remove it, and use > > Classpath's one) > > > > 2) Implement VMSystemProperties init() and isWordsBigEndian(). > > From the looks of it, you can use the existing > > insertSystemProperties for init(). > > > > Is this what you've done? > > yes, and some stuff more. > > > > > Michael > -- > Homepage: http://www.worldforge.org/ > |
From: Michael K. <kon...@gm...> - 2004-12-09 06:29:59
|
Am Mittwoch, 8. Dezember 2004 15:01 schrieb Robert Lougher: > There's also changes to the reference VMClassLoader, but I don't > think these affect JamVM as it uses it's own native implementation > of getResources. > > From the looks of it, it should be possible to get a patch so that > the same version will run with Classpath-0.12 and CVS. I think the solution I worked is somehow bad. And it will definitely not work with CP 0.12. Can you try to provide a patch ? Michael -- Homepage: http://www.worldforge.org/ |
From: Robert L. <rob...@gm...> - 2004-12-08 22:01:14
|
Hi Michael, OK, I'll work on it now. I don't have classpath CVS, so I'll to get it... Thanks, Rob. P.S. I expect your patch was fine. I only _think_ it's possible to get one that'll work with both. It could be wishful thinking :) On Wed, 8 Dec 2004 21:39:39 +0100, Michael Koch <kon...@gm...> wrote: > Am Mittwoch, 8. Dezember 2004 15:01 schrieb Robert Lougher: > > There's also changes to the reference VMClassLoader, but I don't > > think these affect JamVM as it uses it's own native implementation > > of getResources. > > > > From the looks of it, it should be possible to get a patch so that > > the same version will run with Classpath-0.12 and CVS. > > I think the solution I worked is somehow bad. And it will definitely > not work with CP 0.12. Can you try to provide a patch ? > > > > > Michael > -- > Homepage: http://www.worldforge.org/ > |
From: Robert L. <rob...@gm...> - 2004-12-09 13:32:44
|
Hi Michael, By the time I downloaded classpath cvs and builit it, I didn't have long to work on this. I put in the native methods, and modified the VM classes. I'm now getting stuck in a recursive class initialisation dependency. I've not investigated it very far, but it appears that SystemProperties.<clinit> forces Runtime.<clinit>, which uses SystemProperties -- as it's being initialised, we return (step 3 of initialisation process), accessing properties, which is null (hence the NullPointerException). BTW, it ends up as a NoClassDefError because Runtime gets marked as bad. I'll have a look at it again tonight. Did you manage to get past this stage? I may post something onto the classpath list but I want to make sure I've not done anything stupid first :) Thanks, Rob. On Wed, 8 Dec 2004 22:00:59 +0000, Robert Lougher <rob...@gm...> wrote: > Hi Michael, > > OK, I'll work on it now. I don't have classpath CVS, so I'll to get it... > > Thanks, > > Rob. > > P.S. I expect your patch was fine. I only _think_ it's possible to > get one that'll work with both. It could be wishful thinking :) > > > > On Wed, 8 Dec 2004 21:39:39 +0100, Michael Koch <kon...@gm...> wrote: > > Am Mittwoch, 8. Dezember 2004 15:01 schrieb Robert Lougher: > > > There's also changes to the reference VMClassLoader, but I don't > > > think these affect JamVM as it uses it's own native implementation > > > of getResources. > > > > > > From the looks of it, it should be possible to get a patch so that > > > the same version will run with Classpath-0.12 and CVS. > > > > I think the solution I worked is somehow bad. And it will definitely > > not work with CP 0.12. Can you try to provide a patch ? > > > > > > > > > > Michael > > -- > > Homepage: http://www.worldforge.org/ > > > |
From: Michael K. <kon...@gm...> - 2004-12-09 05:02:12
|
Am Mittwoch, 8. Dezember 2004 13:23 schrieb Robert Lougher: > Hi Michael, > > As a matter of interest, when did jamvm + classpath CVS break? Any > idea what the change could have been? Two days ago when Jeroen commited his SystemProperties patch. Michael -- Homepage: http://www.worldforge.org/ |
From: Robert L. <rob...@gm...> - 2004-12-08 12:59:15
|
On Wed, 8 Dec 2004 13:28:50 +0100, Michael Koch <kon...@gm...> wrote: > Am Mittwoch, 8. Dezember 2004 13:23 schrieb Robert Lougher: > > Hi Michael, > > > > As a matter of interest, when did jamvm + classpath CVS break? Any > > idea what the change could have been? > > Two days ago when Jeroen commited his SystemProperties patch. > Wonderful. I'll look back at the proposed patch and see what it does. I haven't been taking much notice, but I didn't think it required VM changes. I would have expected some warnings and a FULL description of the changes needed if it did -- not just drop it in, and bugger everybody else. Rob. > Michael > -- > > > Homepage: http://www.worldforge.org/ > |
From: Michael K. <kon...@gm...> - 2004-12-09 05:02:13
|
Am Mittwoch, 8. Dezember 2004 13:59 schrieb Robert Lougher: > On Wed, 8 Dec 2004 13:28:50 +0100, Michael Koch <kon...@gm...> wrote: > > Am Mittwoch, 8. Dezember 2004 13:23 schrieb Robert Lougher: > > > Hi Michael, > > > > > > As a matter of interest, when did jamvm + classpath CVS break? > > > Any idea what the change could have been? > > > > Two days ago when Jeroen commited his SystemProperties patch. > > Wonderful. I'll look back at the proposed patch and see what it > does. I haven't been taking much notice, but I didn't think it > required VM changes. I would have expected some warnings and a > FULL description of the changes needed if it did -- not just drop > it in, and bugger everybody else. Well, it was there. on classpath-patches and inside the NEWS file. I have jamvm running again, thanks to your help. I need to cleanup the patch and will post it here. Michael -- Homepage: http://www.worldforge.org/ |
From: Robert L. <rob...@gm...> - 2004-12-08 13:41:53
|
The problem is I don't have access to CVS during the week... From looking at the patch, it needs 1) Update to JamVM's ClassLoader class (or remove it, and use Classpath's one) 2) Implement VMSystemProperties init() and isWordsBigEndian(). From the looks of it, you can use the existing insertSystemProperties for init(). Is this what you've done? Rob. On Wed, 8 Dec 2004 14:02:08 +0100, Michael Koch <kon...@gm...> wrote: > Am Mittwoch, 8. Dezember 2004 13:59 schrieb Robert Lougher: > > > > On Wed, 8 Dec 2004 13:28:50 +0100, Michael Koch <kon...@gm...> > wrote: > > > Am Mittwoch, 8. Dezember 2004 13:23 schrieb Robert Lougher: > > > > Hi Michael, > > > > > > > > As a matter of interest, when did jamvm + classpath CVS break? > > > > Any idea what the change could have been? > > > > > > Two days ago when Jeroen commited his SystemProperties patch. > > > > Wonderful. I'll look back at the proposed patch and see what it > > does. I haven't been taking much notice, but I didn't think it > > required VM changes. I would have expected some warnings and a > > FULL description of the changes needed if it did -- not just drop > > it in, and bugger everybody else. > > Well, it was there. on classpath-patches and inside the NEWS file. > I have jamvm running again, thanks to your help. I need to cleanup the > patch and will post it here. > > > > > Michael > -- > Homepage: http://www.worldforge.org/ > |
From: Michael K. <kon...@gm...> - 2004-12-09 14:24:49
|
Am Donnerstag, 9. Dezember 2004 14:32 schrieb Robert Lougher: > Hi Michael, > > By the time I downloaded classpath cvs and builit it, I didn't have > long to work on this. I put in the native methods, and modified > the VM classes. I'm now getting stuck in a recursive class > initialisation dependency. I've not investigated it very far, but > it appears that SystemProperties.<clinit> forces Runtime.<clinit>, > which uses SystemProperties -- as it's being initialised, we return > (step 3 of initialisation process), accessing properties, which is > null (hence the NullPointerException). BTW, it ends up as a > NoClassDefError because Runtime gets marked as bad. > > I'll have a look at it again tonight. Did you manage to get past > this stage? I may post something onto the classpath list but I > want to make sure I've not done anything stupid first :) I hit the same problem. I thought it was me doing something stupd with the native methods. I think I concluded wrong. I CC'ed Jeroen now as he wrote the patch. Perhaps he can say something about this. Jeroen: I think we have a problem with initialization in GNU classpath. Can you tell us something about the above ? Michael -- Homepage: http://www.worldforge.org/ |
From: Robert L. <rob...@gm...> - 2004-12-09 14:28:01
|
Thanks Michael. On Thu, 9 Dec 2004 15:24:20 +0100, Michael Koch <kon...@gm...> wrote: > Am Donnerstag, 9. Dezember 2004 14:32 schrieb Robert Lougher: > > > > Hi Michael, > > > > By the time I downloaded classpath cvs and builit it, I didn't have > > long to work on this. I put in the native methods, and modified > > the VM classes. I'm now getting stuck in a recursive class > > initialisation dependency. I've not investigated it very far, but > > it appears that SystemProperties.<clinit> forces Runtime.<clinit>, > > which uses SystemProperties -- as it's being initialised, we return > > (step 3 of initialisation process), accessing properties, which is > > null (hence the NullPointerException). BTW, it ends up as a > > NoClassDefError because Runtime gets marked as bad. > > > > I'll have a look at it again tonight. Did you manage to get past > > this stage? I may post something onto the classpath list but I > > want to make sure I've not done anything stupid first :) > > I hit the same problem. I thought it was me doing something stupd with > the native methods. I think I concluded wrong. > > I CC'ed Jeroen now as he wrote the patch. Perhaps he can say something > about this. > > Jeroen: I think we have a problem with initialization in GNU > classpath. Can you tell us something about the above ? > > > > > Michael > -- > Homepage: http://www.worldforge.org/ > |