title: Debugging A Java Agent
body: <p>I'm currently developing a <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/instrument/ClassFileTransformer.html" rel="noreferrer">Java Agent</a> in order to facilitate the dynamic instrumentation of new and legacy Java Applications. </p>
  
  <p>It occurred to me that, as far as IDE debugging is concerned, Java Agents could be perhaps considered a special case as they are required to be injected into a target JVM process in order to be ran. Which thus naturally gives rise to the question of how one would go about debugging, testing and profiling an Agent-type application.</p>
  
  <p>A cursory search for existing solutions turned up a few command line based options (i.e YourKit, JIP, etc) however many of them are ALSO Java Agents under the hood. Which if utilized would lead to, at least in my view, the rather odd scenario of an Agent debugging/profiling another Agent. I am aware that Agents can be stacked in a hierarchical arrangement, however i'm unsure if Agent Applications can be debugged by stacking Agents in this manor.  </p>