On Tue, 20 Apr 2021 07:31:43 GMT, Yasumasa Suenaga <ysuen...@openjdk.org> wrote:
> We can see following error when we run `findsym` on CLHSDB which connects to > remote debug server. > > > hsdb> verbose true > hsdb> findsym gHotSpotVMTypes > 0x00007f913d4a45b0Error: java.lang.NullPointerException: Cannot invoke > "sun.jvm.hotspot.debugger.cdbg.CDebugger.loadObjectContainingPC(sun.jvm.hotspot.debugger.Address)" > because "cdbg" is null > java.lang.NullPointerException: Cannot invoke > "sun.jvm.hotspot.debugger.cdbg.CDebugger.loadObjectContainingPC(sun.jvm.hotspot.debugger.Address)" > because "cdbg" is null > at > jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor$7.doit(CommandProcessor.java:618) > at > jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2116) > at > jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2086) > at > jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.run(CommandProcessor.java:1957) > at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:112) > at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:44) > at > jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runCLHSDB(SALauncher.java:282) > at > jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:493) > > > The cause of this NPE is that CDebugger is null. It happens when the > debugger is running on debugd server. > Command line debugger like CLHSDB can delegate the command to debugd, like > `pmap` and `pstack`. `findsym` can also use this scheme. > > This PR has passed serviceability/sa tests on Linux x64. src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java line 603: > 601: } else { > 602: String result = > VM.getVM().getDebugger().findSymbol(t.nextToken()); > 603: out.println(result == null ? "Symbol not found" : > result); The import of sun.jvm.hotspot.debugger.cdbg.CDebugger is no longer needed in this file. I think the more traditional approach would be to add remote support for LoadObject. That provides the building blocks needed here. It's harder to do, but might have some benefit down the road, although it's hard to say if there would ever be other users of it. ------------- PR: https://git.openjdk.java.net/jdk/pull/3582