[Fwd: Re: Can I see dynamically modified bytecodes?]

Nathan Fiedler <[email protected]> Sat, 10 Jun 2006 09:44:41 -0700
Newsgroups gmane.comp.java.jswat.user
Organization Blue Marsh Softworks
Message-ID <[email protected]>
(forgot to cc list)

-------- Original Message --------
Subject: Re: [jswat-user] Can I see dynamically modified bytecodes?
Date: Sat, 10 Jun 2006 09:44:22 -0700
From: Nathan Fiedler <[email protected]>
Organization: Blue Marsh Softworks
To: Cay Horstmann <[email protected]>
References: <[email protected]>

I can't answer the dynamic part at the moment since I don't have the
source in front of me, but you can view the byte codes of a method by
opening the Byte Codes view (Windows menu). I believe that is not
refreshed until the window is closed and reopened. If that is not
sufficient, let me know and I'll see what I can do.

n


Cay Horstmann wrote:
> I am trying to use JSwat to study how JPA modifies byte codes on the 
> fly. For example when I launch the GlassFish implementation as
> 
> java -classpath 
> .:/usr/local/glassfish-persistence/toplink-essentials.jar:/usr/local/glassfish/javadb/lib/derbyclient.jar 
> -javaagent:/usr/local/glassfish-persistence/toplink-essentials-agent.jar 
> elvis/client/Client
> 
> then the following class is modified by the Toplink agent:
> 
> @Entity
> public class Question implements Serializable {
>      . . .
>      private Choice answer;
> 
>      @OneToOne(fetch=FetchType.LAZY)
>      public Choice getAnswer() {
>          return answer;
>      }
>      . . .
>      public String toString() {
>          return getClass().getName() + "[id=" + id
>                  + ",answer=" + answer"]";
>      }
> }
> 
> Fields are added, which I can observe, and the getAnswer method is 
> changed, which I can't observe. Tracing through makes the cursor jump 
> crazily through the source.
> 
> I'd like to step through that method, a byte code at a time, if that is 
> possible. Like assembly mode in gcc. Or, if that's not doable, at least 
> I'd like to see the bytecodes.
> 
> I realize a JVM debugger isn't the same as a C debugger, so this may be 
> asking too much. But I thought I'd ask.
> 
> Thanks,
> 
> Cay