summaryrefslogtreecommitdiffstats
path: root/jvmfwk
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-02-24 17:00:28 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-02-24 17:00:28 +0100
commitf21994e7a240563283b7a17dcb435ce7c5156b60 (patch)
treeea57c7a772d49bad0baf07c8e687604e0c52bba3 /jvmfwk
parentvcl: add initial CppunitTest_vcl_pdfexport (diff)
downloadcore-f21994e7a240563283b7a17dcb435ce7c5156b60.tar.gz
core-f21994e7a240563283b7a17dcb435ce7c5156b60.zip
Make JVM -Xrunjdwp option work on macOS
I hope loading the jvm library as SAL_LOADMODULE_GLOBAL has no negative consequences (at least, there is prior art in the LINUX case already). Change-Id: If18b65bd96f7205fdf9fd41389e64e786c15af16
Diffstat (limited to 'jvmfwk')
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 5053fdacc0af..63791bceac16 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -670,6 +670,16 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
osl::Module moduleRt;
#if defined(LINUX)
if (!moduleRt.load(sRuntimeLib, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_NOW))
+#elif defined MACOSX
+ // Must be SAL_LOADMODULE_GLOBAL when e.g. specifying a
+ // -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 option to
+ // JDK 1.8.0_121 at least, as JNI_CreateJavaVM -> Threads::create_vm ->
+ // JvmtiExport::post_vm_initialized -> cbEarlyVMInit -> initialize ->
+ // util_initialize -> sun.misc.VMSupport.getAgentProperties ->
+ // Java_sun_misc_VMSupport_initAgentProperties ->
+ // JDK_FindJvmEntry("JVM_INitAgentProperties") ->
+ // dlsym(RTLD_DEFAULT, "JVM_INitAgentProperties"):
+ if (!moduleRt.load(sRuntimeLib, SAL_LOADMODULE_GLOBAL))
#else
#if defined(_WIN32)
do_msvcr_magic(sRuntimeLib.pData);