Re: Can I see dynamically modified bytecodes?

Nathan Fiedler <[email protected]> Fri, 16 Jun 2006 00:16:06 -0700
Newsgroups gmane.comp.java.jswat.user
Organization Blue Marsh Softworks
Message-ID <[email protected]>
BTW, I've entered an RFE to track this issue (#1052).

Thanks

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