Re: Looking for directions about compiling and tracing OpenJDK

2012-10-09 Thread Ira Abramov
Quoting Amos Shapira, from the post of Tue, 09 Oct:
 Hi,
 
 I have an idea which involves going somewhat deep into the bowls of the
 Java Jar class loader when using the official Oracle JDK 6 (and soon 7).
 To verify this I started looking at the JDK source code but it's not small
 and I'd like to try to trace through it while it executes Java programs.
 
 Does anyone here have experience in doing something like this and can give
 me some useful pointers on how to do this?
 
 I'd like to be able to do gdb java -jar HelloWorld.jar and single-step
 through the class loader while it loads HelloWorld.jar.

My humble opinion - gdb will catch way too much crap. Is it so low in
the stack that you can't provision it with JMX and trace it through
that?


-- 
Ben and Jerry's love child
Ira Abramov
http://ira.abramov.org/email/

___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Looking for directions about compiling and tracing OpenJDK

2012-10-09 Thread Jonathan Ben Avraham

Hi Amos,
I did something like this with the JarSigner code in order to reverse 
engineer it in C, which in the end I was able to do. IMHO, gdb is too high 
a granularity to get anything usable out of the JVM execution. I suspect 
that there is no alternative to sowing System.out.print's throughout the 
code.

Regards,

 - yba


On Tue, 9 Oct 2012, Amos Shapira wrote:


Date: Tue, 9 Oct 2012 10:57:29 +1100
From: Amos Shapira amos.shap...@gmail.com
To: linux-il linux-il@cs.huji.ac.il
Subject: Looking for directions about compiling and tracing OpenJDK

Hi,

I have an idea which involves going somewhat deep into the bowls of the Java 
Jar class loader when using the official Oracle JDK 6 (and soon 7).
To verify this I started looking at the JDK source code but it's not small and 
I'd like to try to trace through it while it executes Java programs.

Does anyone here have experience in doing something like this and can give me 
some useful pointers on how to do this?

I'd like to be able to do gdb java -jar HelloWorld.jar and single-step 
through the class loader while it loads HelloWorld.jar.

Thanks,

--Amos





--
 EE 77 7F 30 4A 64 2E C5  83 5F E7 49 A6 82 29 BA~. .~   Tk Open Systems
=}ooO--U--Ooo{=
 - y...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Looking for directions about compiling and tracing OpenJDK

2012-10-09 Thread Amos Shapira
Thanks to both of you.

To give more details of what I'm after - I want to know whether the class
bytecode address points into the mmap(2)'ed jar file or into malloc(3)'ed
memory. I think I found part of the code path inside the jdk source which
does this and now I'm trying to determine what are the situations in which
each option is taken.
Can JMX do that? The code I'm looking at is written in pure C.

Amos
On Oct 9, 2012 10:00 PM, Jonathan Ben Avraham y...@tkos.co.il wrote:

 Hi Amos,
 I did something like this with the JarSigner code in order to reverse
 engineer it in C, which in the end I was able to do. IMHO, gdb is too high
 a granularity to get anything usable out of the JVM execution. I suspect
 that there is no alternative to sowing System.out.print's throughout the
 code.
 Regards,

  - yba


 On Tue, 9 Oct 2012, Amos Shapira wrote:

  Date: Tue, 9 Oct 2012 10:57:29 +1100
 From: Amos Shapira amos.shap...@gmail.com
 To: linux-il linux-il@cs.huji.ac.il
 Subject: Looking for directions about compiling and tracing OpenJDK

 Hi,

 I have an idea which involves going somewhat deep into the bowls of the
 Java Jar class loader when using the official Oracle JDK 6 (and soon 7).
 To verify this I started looking at the JDK source code but it's not
 small and I'd like to try to trace through it while it executes Java
 programs.

 Does anyone here have experience in doing something like this and can
 give me some useful pointers on how to do this?

 I'd like to be able to do gdb java -jar HelloWorld.jar and single-step
 through the class loader while it loads HelloWorld.jar.

 Thanks,

 --Amos




 --
  EE 77 7F 30 4A 64 2E C5  83 5F E7 49 A6 82 29 BA~. .~   Tk Open
 Systems
 =}**ooO--U--**
 Ooo{=
  - y...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Looking for directions about compiling and tracing OpenJDK

2012-10-09 Thread Jonathan Ben Avraham

Hi Amos,
Pardon me, what does the class loader have to do with JMX?

 - yba


On Tue, 9 Oct 2012, Amos Shapira wrote:


Date: Tue, 9 Oct 2012 22:06:16 +1100
From: Amos Shapira amos.shap...@gmail.com
To: Jonathan Ben Avraham y...@tkos.co.il
Cc: linux-il linux-il@cs.huji.ac.il
Subject: Re: Looking for directions about compiling and tracing OpenJDK


Thanks to both of you.

To give more details of what I'm after - I want to know whether the class 
bytecode address points into the mmap(2)'ed jar file or into malloc(3)'ed 
memory. I think I
found part of the code path inside the jdk source which does this and now I'm 
trying to determine what are the situations in which each option is taken.
Can JMX do that? The code I'm looking at is written in pure C.

Amos

On Oct 9, 2012 10:00 PM, Jonathan Ben Avraham y...@tkos.co.il wrote:
  Hi Amos,
  I did something like this with the JarSigner code in order to reverse 
engineer it in C, which in the end I was able to do. IMHO, gdb is too high a
  granularity to get anything usable out of the JVM execution. I suspect 
that there is no alternative to sowing System.out.print's throughout the code.
  Regards,

   - yba


  On Tue, 9 Oct 2012, Amos Shapira wrote:

Date: Tue, 9 Oct 2012 10:57:29 +1100
From: Amos Shapira amos.shap...@gmail.com
To: linux-il linux-il@cs.huji.ac.il
Subject: Looking for directions about compiling and tracing OpenJDK

Hi,

I have an idea which involves going somewhat deep into the bowls of 
the Java Jar class loader when using the official Oracle JDK 6 (and soon
7).
To verify this I started looking at the JDK source code but it's 
not small and I'd like to try to trace through it while it executes Java
programs.

Does anyone here have experience in doing something like this and 
can give me some useful pointers on how to do this?

I'd like to be able to do gdb java -jar HelloWorld.jar and 
single-step through the class loader while it loads HelloWorld.jar.

Thanks,

--Amos




  --
   EE 77 7F 30 4A 64 2E C5  83 5F E7 49 A6 82 29 BA    ~. .~   Tk Open 
Systems
  
=}ooO--U--Ooo{=
       - y...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -





--
 EE 77 7F 30 4A 64 2E C5  83 5F E7 49 A6 82 29 BA~. .~   Tk Open Systems
=}ooO--U--Ooo{=
 - y...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Looking for directions about compiling and tracing OpenJDK

2012-10-09 Thread Elazar Leibovich
Why do you need the Java source for that? Can't you use gdb, find out the
the address of the mmap'ed area, and add a watchpoint there (scripted to
log access and continue).

On Tue, Oct 9, 2012 at 1:06 PM, Amos Shapira amos.shap...@gmail.com wrote:

 Thanks to both of you.

 To give more details of what I'm after - I want to know whether the class
 bytecode address points into the mmap(2)'ed jar file or into malloc(3)'ed
 memory. I think I found part of the code path inside the jdk source which
 does this and now I'm trying to determine what are the situations in which
 each option is taken.
 Can JMX do that? The code I'm looking at is written in pure C.

 Amos
 On Oct 9, 2012 10:00 PM, Jonathan Ben Avraham y...@tkos.co.il wrote:

 Hi Amos,
 I did something like this with the JarSigner code in order to reverse
 engineer it in C, which in the end I was able to do. IMHO, gdb is too high
 a granularity to get anything usable out of the JVM execution. I suspect
 that there is no alternative to sowing System.out.print's throughout the
 code.
 Regards,

  - yba


 On Tue, 9 Oct 2012, Amos Shapira wrote:

  Date: Tue, 9 Oct 2012 10:57:29 +1100
 From: Amos Shapira amos.shap...@gmail.com
 To: linux-il linux-il@cs.huji.ac.il
 Subject: Looking for directions about compiling and tracing OpenJDK

 Hi,

 I have an idea which involves going somewhat deep into the bowls of the
 Java Jar class loader when using the official Oracle JDK 6 (and soon 7).
 To verify this I started looking at the JDK source code but it's not
 small and I'd like to try to trace through it while it executes Java
 programs.

 Does anyone here have experience in doing something like this and can
 give me some useful pointers on how to do this?

 I'd like to be able to do gdb java -jar HelloWorld.jar and single-step
 through the class loader while it loads HelloWorld.jar.

 Thanks,

 --Amos




 --
  EE 77 7F 30 4A 64 2E C5  83 5F E7 49 A6 82 29 BA~. .~   Tk Open
 Systems
 =}**ooO--U--**
 Ooo{=
  - y...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -


 ___
 Linux-il mailing list
 Linux-il@cs.huji.ac.il
 http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Looking for directions about compiling and tracing OpenJDK

2012-10-09 Thread Ira Abramov
Quoting Amos Shapira, from the post of Tue, 09 Oct:
 To give more details of what I'm after - I want to know whether the class
 bytecode address points into the mmap(2)'ed jar file or into malloc(3)'ed
 memory. I think I found part of the code path inside the jdk source which
 does this and now I'm trying to determine what are the situations in which
 each option is taken.
 Can JMX do that? The code I'm looking at is written in pure C.

if that information is exposed to the java objects in the VM, then
maybe. otherwise, I guess it's a case of getting your fingers dirty with
GDB...


-- 
The secret to happiness
Ira Abramov
http://ira.abramov.org/email/

___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Looking for directions about compiling and tracing OpenJDK

2012-10-09 Thread Amos Shapira
I was responding to Ira's suggestion to try to use JMX for that.
On Oct 9, 2012 10:22 PM, Jonathan Ben Avraham y...@tkos.co.il wrote:

 Hi Amos,
 Pardon me, what does the class loader have to do with JMX?

  - yba


 On Tue, 9 Oct 2012, Amos Shapira wrote:

  Date: Tue, 9 Oct 2012 22:06:16 +1100
 From: Amos Shapira amos.shap...@gmail.com
 To: Jonathan Ben Avraham y...@tkos.co.il
 Cc: linux-il linux-il@cs.huji.ac.il
 Subject: Re: Looking for directions about compiling and tracing OpenJDK


 Thanks to both of you.

 To give more details of what I'm after - I want to know whether the class
 bytecode address points into the mmap(2)'ed jar file or into malloc(3)'ed
 memory. I think I
 found part of the code path inside the jdk source which does this and now
 I'm trying to determine what are the situations in which each option is
 taken.
 Can JMX do that? The code I'm looking at is written in pure C.

 Amos

 On Oct 9, 2012 10:00 PM, Jonathan Ben Avraham y...@tkos.co.il wrote:
   Hi Amos,
   I did something like this with the JarSigner code in order to
 reverse engineer it in C, which in the end I was able to do. IMHO, gdb is
 too high a
   granularity to get anything usable out of the JVM execution. I
 suspect that there is no alternative to sowing System.out.print's
 throughout the code.
   Regards,

- yba


   On Tue, 9 Oct 2012, Amos Shapira wrote:

 Date: Tue, 9 Oct 2012 10:57:29 +1100
 From: Amos Shapira amos.shap...@gmail.com
 To: linux-il linux-il@cs.huji.ac.il
 Subject: Looking for directions about compiling and tracing
 OpenJDK

 Hi,

 I have an idea which involves going somewhat deep into the
 bowls of the Java Jar class loader when using the official Oracle JDK 6
 (and soon
 7).
 To verify this I started looking at the JDK source code but
 it's not small and I'd like to try to trace through it while it executes
 Java
 programs.

 Does anyone here have experience in doing something like this
 and can give me some useful pointers on how to do this?

 I'd like to be able to do gdb java -jar HelloWorld.jar and
 single-step through the class loader while it loads HelloWorld.jar.

 Thanks,

 --Amos




   --
EE 77 7F 30 4A 64 2E C5  83 5F E7 49 A6 82 29 BA~. .~   Tk
 Open Systems
   =}**ooO--U--**
 Ooo{=
- y...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il-




 --
  EE 77 7F 30 4A 64 2E C5  83 5F E7 49 A6 82 29 BA~. .~   Tk Open
 Systems
 =}**ooO--U--**
 Ooo{=
  - y...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
 ___
 Linux-il mailing list
 Linux-il@cs.huji.ac.il
 http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Looking for directions about compiling and tracing OpenJDK

2012-10-09 Thread Amos Shapira
I'd expect to need the source code to make sense from the gdb output, and
maybe also to get the debug symbols.

I thunk I already found at least part of the code path in the source, why
shouldn't I take advantage of this info?

What I wanted to know in my original question is whether anyone in this
forum have been through the process of downloading and compiling this
source code - which file should I download (I found multiple repositories
on the official source web site) and where are useful practical steps to
compile it with debug symbols?

Thanks!

Amos
On Oct 9, 2012 10:41 PM, Elazar Leibovich elaz...@gmail.com wrote:

 Why do you need the Java source for that? Can't you use gdb, find out the
 the address of the mmap'ed area, and add a watchpoint there (scripted to
 log access and continue).

 On Tue, Oct 9, 2012 at 1:06 PM, Amos Shapira amos.shap...@gmail.comwrote:

 Thanks to both of you.

 To give more details of what I'm after - I want to know whether the class
 bytecode address points into the mmap(2)'ed jar file or into malloc(3)'ed
 memory. I think I found part of the code path inside the jdk source which
 does this and now I'm trying to determine what are the situations in which
 each option is taken.
 Can JMX do that? The code I'm looking at is written in pure C.

 Amos
 On Oct 9, 2012 10:00 PM, Jonathan Ben Avraham y...@tkos.co.il wrote:

 Hi Amos,
 I did something like this with the JarSigner code in order to reverse
 engineer it in C, which in the end I was able to do. IMHO, gdb is too high
 a granularity to get anything usable out of the JVM execution. I suspect
 that there is no alternative to sowing System.out.print's throughout the
 code.
 Regards,

  - yba


 On Tue, 9 Oct 2012, Amos Shapira wrote:

  Date: Tue, 9 Oct 2012 10:57:29 +1100
 From: Amos Shapira amos.shap...@gmail.com
 To: linux-il linux-il@cs.huji.ac.il
 Subject: Looking for directions about compiling and tracing OpenJDK

 Hi,

 I have an idea which involves going somewhat deep into the bowls of the
 Java Jar class loader when using the official Oracle JDK 6 (and soon 7).
 To verify this I started looking at the JDK source code but it's not
 small and I'd like to try to trace through it while it executes Java
 programs.

 Does anyone here have experience in doing something like this and can
 give me some useful pointers on how to do this?

 I'd like to be able to do gdb java -jar HelloWorld.jar and
 single-step through the class loader while it loads HelloWorld.jar.

 Thanks,

 --Amos




 --
  EE 77 7F 30 4A 64 2E C5  83 5F E7 49 A6 82 29 BA~. .~   Tk Open
 Systems
 =}**ooO--U--**
 Ooo{=
  - y...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -


 ___
 Linux-il mailing list
 Linux-il@cs.huji.ac.il
 http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il



___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Looking for directions about compiling and tracing OpenJDK

2012-10-08 Thread Amos Shapira
Hi,

I have an idea which involves going somewhat deep into the bowls of the
Java Jar class loader when using the official Oracle JDK 6 (and soon 7).
To verify this I started looking at the JDK source code but it's not small
and I'd like to try to trace through it while it executes Java programs.

Does anyone here have experience in doing something like this and can give
me some useful pointers on how to do this?

I'd like to be able to do gdb java -jar HelloWorld.jar and single-step
through the class loader while it loads HelloWorld.jar.

Thanks,

--Amos
___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il