Re: [rvm-research] using a java agent
Erik Brangs <[email protected]> Mon, 11 Mar 2019 21:51:39 +0100
| Newsgroups | gmane.comp.java.jikes.rvm.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --------------5A3DF8AC7733B2B9B3218E90 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, On 10.03.19 15:23, Johannes Sinsel wrote: > I wanted to add, the same problem (error-message) appears if I execute a class-file, for example: > > ./dist/prototype-opt_x86_64-linux/rvm -javaagent:agent.jar=frames2000 HelloWorld > I've attached another patch that needs to be applied after the previous one. This should fix the remaining problems. Please let me know if it works for you. Kind regards, Erik Brangs --------------5A3DF8AC7733B2B9B3218E90 Content-Type: text/x-patch; name="correctClasspathHandlingForJavaAgent_part2.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="correctClasspathHandlingForJavaAgent_part2.diff" commit d43fc62611699e291e179152ddda79b93dedc98a Author: Erik Brangs <[email protected]> Date: Mon Mar 11 21:25:31 2019 +0100 RVM-1176 : Correct classpath handling for Java agents in conjunction with a class name diff --git a/rvm/src/org/jikesrvm/VM.java b/rvm/src/org/jikesrvm/VM.java index e6dd9c320..73014dd2e 100644 --- a/rvm/src/org/jikesrvm/VM.java +++ b/rvm/src/org/jikesrvm/VM.java @@ -488,6 +488,7 @@ public class VM extends Properties { } if (verboseBoot >= 1) VM.sysWriteln("Initializing Application Class Loader"); + RVMClassLoader.rebuildApplicationRepositoriesWithAgents(); RVMClassLoader.getApplicationClassLoader(); RVMClassLoader.declareApplicationClassLoaderIsReady(); diff --git a/rvm/src/org/jikesrvm/classloader/RVMClassLoader.java b/rvm/src/org/jikesrvm/classloader/RVMClassLoader.java index 62715432d..e7b8270ce 100644 --- a/rvm/src/org/jikesrvm/classloader/RVMClassLoader.java +++ b/rvm/src/org/jikesrvm/classloader/RVMClassLoader.java @@ -139,9 +139,8 @@ public class RVMClassLoader { * @param classpath path specification in standard "classpath" format */ public static void setApplicationRepositories(String classpath) { - String actualClasspath = buildRealClasspath(classpath); - System.setProperty("java.class.path", actualClasspath); - stashApplicationRepositories(actualClasspath); + System.setProperty("java.class.path", classpath); + stashApplicationRepositories(classpath); if (DBG_APP_CL) { VM.sysWriteln("RVMClassLoader.setApplicationRepositories: applicationRepositories = ", applicationRepositories); } @@ -204,6 +203,18 @@ public class RVMClassLoader { } } + /** + * Rebuilds the application repositories to include jars for Java agents. + * Called after command line arg parsing is done. + */ + public static void rebuildApplicationRepositoriesWithAgents() { + if (agentRepositories == null) { + return; + } + String newApplicationRepositories = applicationRepositories + File.pathSeparator + agentRepositories; + setApplicationRepositories(newApplicationRepositories); + } + /** Are we getting the application CL? Access is synchronized via the * Class object. Probably not necessary, but doesn't hurt, or shouldn't. * Used for sanity checks. */ --------------5A3DF8AC7733B2B9B3218E90 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --------------5A3DF8AC7733B2B9B3218E90 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Jikesrvm-researchers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers --------------5A3DF8AC7733B2B9B3218E90--