Thread: [Aegisvm-devel] patch to add debug info to printStackTrace
Status: Pre-Alpha
Brought to you by:
pwlfong
|
From: Gildas B. <gb...@ne...> - 2002-07-23 08:34:10
|
Hi, I discovered aegisvm a few weeks ago and I must say it is a really nice project especially for one who wants to learn about JVM internals :) Here is my first contribution :) A patch that adds debug information to printStackTrace(). Basically it parses the SourceFile attributes and the LineNumberTable attributes of the Code attributes in the class files. Could someone review this before applying to the cvs because I'm not too familiar yet with aegisvm's internals and there might be some mistakes. Hope you'll find this useful, -- Gildas PS: there's a also a big patch to jni.c coming :) |
|
From: Gildas B. <gb...@ne...> - 2002-07-23 08:40:15
Attachments:
stacktrace.diff
|
And as always I forgot to actually include the patch :-O -- Gildas |
|
From: Philip F. <pw...@us...> - 2002-07-24 21:58:42
|
Hi Gildas On Tue, 23 Jul 2002, Gildas Bazin wrote: > Here is my first contribution :) A patch that adds debug information to > printStackTrace(). > Basically it parses the SourceFile attributes and the LineNumberTable > attributes of the Code attributes in the class files. > > Could someone review this before applying to the cvs because I'm not too > familiar yet with aegisvm's internals and there might be some mistakes. > > Hope you'll find this useful, Yes, this is definitely useful. This is going to help debugging a lot. I've just skimmed through the code a bit, and it looks okay. So, out of which version (or CVS tag) is you patch made. I'll need this in order to actually integrate your code into the CVS. I think what I will do is to add a configure switch so that your new feature is on by default, and for those who really want to reduce class size when the VM is deployed, they can choose to turn off the feature. What do you think? > PS: there's a also a big patch to jni.c coming :) I am just curious... what is this big patch going to do? Can't wait to see it. If you are tracking the CVS, you'll notice that I am doing quite a bit of restructuring recently. Would you like to subscribe to the development mailing list so that you can be kept up to date about when it is a good time to synchronize your code with the CVS repository? Again, thanks a lot for your patch. Philip -- Philip W. L. Fong pw...@us... The Aegis VM Project http://aegisvm.sourceforge.net The Aegis VM Project is an on-going effort to implement a lightweight, secure JVM. It will eventually feature a modular architecture, Proof Linking, that supports pluggable verification modules. |
|
From: Gildas B. <gb...@al...> - 2002-07-25 09:41:17
|
On Wednesday 24 July 2002 23:58, Philip Fong wrote: > Hi Gildas > > Yes, this is definitely useful. This is going to help debugging a lot. > I've just skimmed through the code a bit, and it looks okay. So, out of > which version (or CVS tag) is you patch made. I'll need this in order > to actually integrate your code into the CVS. I like to live on the bleeding edge so I'm always using an up to date CVS :) > I think what I will do is to add a configure switch so that your new > feature is on by default, and for those who really want to reduce class > size when the VM is deployed, they can choose to turn off the feature. > What do you think? Humm, I'm not sure I understand you there. The only overhead that this patch adds in terms of memory usage is that it stores an additional ju2 field in AEClass to keep the index of the java source file name in the constant pool. And another additional 2 fields in AEMethod to store an array of line numbers and pc correspondance and the size of this array. Which means that only the additional array will really create an overhead, but this array will be allocated only if the bytecode class file actually contains the line numbers debug info. If the user doesn't want this overhead than it should be up to him to compile the java source code without this debug info. ( that reminds me that "method->lines_count" and "method->lines" are not properly initialised to 0 in the patch I sent you. I'll send you an updated version ) > If you are tracking the CVS, you'll notice that I am doing quite a > bit of restructuring recently. Would you like to subscribe to > the development mailing list so that you can be kept up to date > about when it is a good time to synchronize your code with the CVS > repository? > Sorry for confusing you, I'm already subscribed it's just that I didn't send this email from the mail account which I used to suscribe. Regards, -- Gildas |
|
From: Gildas B. <gb...@al...> - 2002-07-25 21:49:11
Attachments:
stacktrace.diff
|
On Thursday 25 July 2002 11:39, Gildas Bazin wrote: > > ( that reminds me that "method->lines_count" and "method->lines" are not > properly initialised to 0 in the patch I sent you. I'll send you an updated > version ) > Here is the updated version which will apply to the current cvs. It also fixes a stupid but nasty bug from my former patch (I wasn't using the correct local variable in one place). Regards, -- Gildas |
|
From: Philip F. <pw...@us...> - 2002-07-26 19:49:26
|
Hi Gildas, On Thu, 25 Jul 2002, Gildas Bazin wrote: > Here is the updated version which will apply to the current cvs. It also > fixes a stupid but nasty bug from my former patch (I wasn't using the > correct local variable in one place). Thanks for the new patch. I am actually in the process of adding your stuff into the cvs. Most of what I did was really just moving things to the right module etc. One thing that I found out from rereading the relevant part of the JVM spec is that there might be multiple line number table attributes for a single method (if I am interpreting properly). I think most sane compilers will generate a single such attribute for each method, but still the spec allows it. I would propose to ignore the problem for now, add an entry to the BUGS file, and move on to something more productive. Philip -- Philip W. L. Fong pw...@us... The Aegis VM Project http://aegisvm.sourceforge.net The Aegis VM Project is an on-going effort to implement a lightweight, secure JVM. It will eventually feature a modular architecture, Proof Linking, that supports pluggable verification modules. |
|
From: Gildas B. <gb...@al...> - 2002-07-31 17:38:13
|
Hi Philip, On Friday 26 July 2002 21:43, Philip Fong wrote: > > One thing that I found out from rereading the relevant part of the JVM > spec is that there might be multiple line number table attributes > for a single method (if I am interpreting properly). I think most > sane compilers will generate a single such attribute for each method, > but still the spec allows it. I would propose to ignore the problem > for now, add an entry to the BUGS file, and move on to something > more productive. > Oh yeah I think you're right. I missed that one. Thanks for applying the patch. -- Gildas |
|
From: Philip F. <pw...@us...> - 2002-07-26 22:51:16
Attachments:
patch
|
Hi Gildas,
I just committed a modified version of your patch to the cvs, with
the following log entry:
New feature: Implementation of SourceFile and LineNumberTable attributes
as contributed by Gildas Bazin <gb...@al...>.
The modification mainly has to do with placing code at the right
module, nothing really special. Attached is what the resulting
patch looks like.
I also committed your changes to resolve.c into the cvs. I will
commit more of your patches in the next few days. Thanks again
for your help.
Philip
--
Philip W. L. Fong pw...@us...
The Aegis VM Project http://aegisvm.sourceforge.net
The Aegis VM Project is an on-going effort to implement a lightweight,
secure JVM. It will eventually feature a modular architecture, Proof
Linking, that supports pluggable verification modules.
|
|
From: Philip F. <pw...@us...> - 2002-07-26 19:20:42
|
Hi Gildas, On Thu, 25 Jul 2002, Gildas Bazin wrote: > I like to live on the bleeding edge so I'm always using an up to date CVS :) Good. I sometimes move code around just to amuse myself :-) If that starts to annoy you, please let me know, and I'll do that in a more disciplined way. > Humm, I'm not sure I understand you there. > > The only overhead that this patch adds in terms of memory usage is that it > stores an additional ju2 field in AEClass to keep the index of the java > source file name in the constant pool. And another additional 2 fields in > AEMethod to store an array of line numbers and pc correspondance and the > size of this array. > > Which means that only the additional array will really create an overhead, > but this array will be allocated only if the bytecode class file actually > contains the line numbers debug info. > If the user doesn't want this overhead than it should be up to him to > compile the java source code without this debug info. Yes, I agree that the additional memory usage is going to be quite insignificant when you run the VM as a standalone application on a typical desktop environment. However, my "secret" ambition is to target this VM to embedded environment, or simply have it embedded inside other applications as an extension framework (e.g. like Lisp to emacs). For such kind of applications, I am not sure if people actually need the additional memory overhead to track source line number. Therefore, I thought it might be nice to give the user a choice. What I would do is this: I will add an option to the configure script so that people can turn off the processing of line number information if they wish to. However, as I said before, this feature that you implemented is so useful for normal, sane users, the line number tracking mechanism is turned on by default. Does that sound fair? > ( that reminds me that "method->lines_count" and "method->lines" are not > properly initialised to 0 in the patch I sent you. I'll send you an updated > version ) Yes, I spotted that. And sure, an update would be helpful. > Sorry for confusing you, I'm already subscribed it's just that I didn't send > this email from the mail account which I used to suscribe. Welcome aboard. :-) Philip -- Philip W. L. Fong pw...@us... The Aegis VM Project http://aegisvm.sourceforge.net The Aegis VM Project is an on-going effort to implement a lightweight, secure JVM. It will eventually feature a modular architecture, Proof Linking, that supports pluggable verification modules. |