-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
customRequest 'processId' to get the debugging Java process id (#399)
* customRequest 'processId' to get Java process id * send a custom notification when processId/shellProcessId is ready
- Loading branch information
1 parent
f704199
commit 8a1c975
Showing
10 changed files
with
162 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...ug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/ProcessIdHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Microsoft Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Microsoft Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package com.microsoft.java.debug.core.adapter.handler; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
import com.microsoft.java.debug.core.adapter.IDebugAdapterContext; | ||
import com.microsoft.java.debug.core.adapter.IDebugRequestHandler; | ||
import com.microsoft.java.debug.core.protocol.Messages.Response; | ||
import com.microsoft.java.debug.core.protocol.Requests.Arguments; | ||
import com.microsoft.java.debug.core.protocol.Requests.Command; | ||
import com.microsoft.java.debug.core.protocol.Responses.ProcessIdResponseBody; | ||
|
||
public class ProcessIdHandler implements IDebugRequestHandler { | ||
@Override | ||
public List<Command> getTargetCommands() { | ||
return Arrays.asList(Command.PROCESSID); | ||
} | ||
|
||
@Override | ||
public CompletableFuture<Response> handle(Command command, Arguments arguments, Response response, | ||
IDebugAdapterContext context) { | ||
long processId = context.getProcessId(); | ||
long shellProcessId = context.getShellProcessId(); | ||
if (context.getDebuggeeProcess() != null) { | ||
processId = context.getDebuggeeProcess().pid(); | ||
} | ||
|
||
response.body = new ProcessIdResponseBody(processId, shellProcessId); | ||
return CompletableFuture.completedFuture(response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters