In `HotSpotAgent.setupVM()`, if there is an underlying exception in the vm setup, the exception is consumed and a `DebuggerException` is thrown, hiding the root cause. When throwing the `DebuggerException`, the "cause" exception should be included. This provides a more detailed exception stack trace, such as the following:
Doesn't appear to be a HotSpot VM (could not find symbol "gHotSpotVMTypes" in remote process) sun.jvm.hotspot.debugger.DebuggerException: Doesn't appear to be a HotSpot VM (could not find symbol "gHotSpotVMTypes" in remote process) at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:428) at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:338) at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:158) at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.attachDebugger(CLHSDB.java:210) at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:69) at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:44) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runCLHSDB(SALauncher.java:281) at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:500) Caused by: sun.jvm.hotspot.debugger.NoSuchSymbolException: Could not find symbol "gHotSpotVMTypes" in any of the known library names (jvm.dll) at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotTypeDataBase.lookupInProcess(HotSpotTypeDataBase.java:622) at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotTypeDataBase.readVMTypes(HotSpotTypeDataBase.java:154) at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotTypeDataBase.<init>(HotSpotTypeDataBase.java:89) at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:407) ... 7 more I'd like to push this as a trivial change. ------------- Commit messages: - Include cause exception Changes: https://git.openjdk.org/jdk/pull/10474/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10474&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8294547 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/10474.diff Fetch: git fetch https://git.openjdk.org/jdk pull/10474/head:pull/10474 PR: https://git.openjdk.org/jdk/pull/10474