From cf734f6128cad588c9d3d6dabf56d5f2ed1785e3 Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Sun, 19 May 2024 22:00:47 +0800 Subject: [PATCH 1/2] Propagate the exit code of debugee to exit event Fixes https://github.com/microsoft/java-debug/issues/475 --- .../core/adapter/handler/ConfigurationDoneRequestHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/ConfigurationDoneRequestHandler.java b/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/ConfigurationDoneRequestHandler.java index 1c543bce4..c841261de 100644 --- a/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/ConfigurationDoneRequestHandler.java +++ b/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/ConfigurationDoneRequestHandler.java @@ -82,7 +82,7 @@ private void handleDebugEvent(DebugEvent debugEvent, IDebugSession debugSession, } else if (event instanceof VMDeathEvent) { vmHandler.disconnectVirtualMachine(event.virtualMachine()); context.setVmTerminated(); - context.getProtocolServer().sendEvent(new Events.ExitedEvent(0)); + context.getProtocolServer().sendEvent(new Events.ExitedEvent(event.virtualMachine().process().exitValue())); } else if (event instanceof VMDisconnectEvent) { vmHandler.disconnectVirtualMachine(event.virtualMachine()); if (context.isAttached()) { From 2027863d4c075677c6000fcb7c08a114ec077e7c Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Wed, 6 Nov 2024 16:13:26 +0800 Subject: [PATCH 2/2] Update ConfigurationDoneRequestHandler.java --- .../core/adapter/handler/ConfigurationDoneRequestHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/ConfigurationDoneRequestHandler.java b/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/ConfigurationDoneRequestHandler.java index c841261de..5331479d3 100644 --- a/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/ConfigurationDoneRequestHandler.java +++ b/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/ConfigurationDoneRequestHandler.java @@ -82,7 +82,8 @@ private void handleDebugEvent(DebugEvent debugEvent, IDebugSession debugSession, } else if (event instanceof VMDeathEvent) { vmHandler.disconnectVirtualMachine(event.virtualMachine()); context.setVmTerminated(); - context.getProtocolServer().sendEvent(new Events.ExitedEvent(event.virtualMachine().process().exitValue())); + int exitValue = event.virtualMachine().process() != null ? event.virtualMachine().process().exitValue() : 0; + context.getProtocolServer().sendEvent(new Events.ExitedEvent(exitValue)); } else if (event instanceof VMDisconnectEvent) { vmHandler.disconnectVirtualMachine(event.virtualMachine()); if (context.isAttached()) {