|
29 | 29 | import com.microsoft.java.debug.core.adapter.IDebugRequestHandler; |
30 | 30 | import com.microsoft.java.debug.core.adapter.ISourceLookUpProvider; |
31 | 31 | import com.microsoft.java.debug.core.adapter.IVirtualMachineManagerProvider; |
| 32 | +import com.microsoft.java.debug.core.protocol.Events; |
32 | 33 | import com.microsoft.java.debug.core.protocol.Messages.Response; |
33 | 34 | import com.microsoft.java.debug.core.protocol.Requests.Arguments; |
34 | 35 | import com.microsoft.java.debug.core.protocol.Requests.AttachArguments; |
@@ -58,6 +59,20 @@ public void handle(Command command, Arguments arguments, Response response, IDeb |
58 | 59 | attachArguments.timeout); |
59 | 60 | context.setDebugSession(debugSession); |
60 | 61 | logger.info("Attaching to debuggee VM succeeded."); |
| 62 | + |
| 63 | + // If the debugger and debuggee run at the different JVM platforms, show a warning message. |
| 64 | + if (debugSession != null) { |
| 65 | + String debuggeeVersion = debugSession.getVM().version(); |
| 66 | + String debuggerVersion = System.getProperty("java.version"); |
| 67 | + if (!debuggerVersion.equals(debuggeeVersion)) { |
| 68 | + String warnMessage = String.format("[Warn] The debugger and the debuggee are running in different versions of JVMs. " |
| 69 | + + "You could see wrong source mapping results.\n" |
| 70 | + + "Debugger JVM version: %s\n" |
| 71 | + + "Debuggee JVM version: %s", debuggerVersion, debuggeeVersion); |
| 72 | + logger.warning(warnMessage); |
| 73 | + context.sendEvent(Events.OutputEvent.createConsoleOutput(warnMessage)); |
| 74 | + } |
| 75 | + } |
61 | 76 | } catch (IOException | IllegalConnectorArgumentsException e) { |
62 | 77 | AdapterUtils.setErrorResponse(response, ErrorCode.ATTACH_FAILURE, |
63 | 78 | String.format("Failed to attach to remote debuggee VM. Reason: %s", e.toString())); |
|
0 commit comments