Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
2f2b2de
make loggers non-static
mzarnowski Jul 19, 2019
4c35a1f
propagate loggers from ProtocolServer
mzarnowski Jul 19, 2019
3536779
create explicit type for logger factory
mzarnowski Jul 22, 2019
0df2ed6
revert to ignoring case when comparing fields' names
Jul 31, 2019
244576a
Merge pull request #1 from marek1840/make-logging-customizable
jvican Jul 31, 2019
651e414
Merge branch 'main' of github.com:microsoft/java-debug into microsoft…
adpi2 Jun 11, 2021
0c44812
Fix logger customization
adpi2 Jun 14, 2021
640ae67
Merge branch 'microsoft-main' into main
adpi2 Jun 14, 2021
4a6c57d
Fix unused imports
adpi2 Jun 14, 2021
e3c40ce
Deploy custom java-debug-core
adpi2 Jun 15, 2021
bf9a6e4
Merge pull request #3 from adpi2/deploy-snapshot
adpi2 Jun 15, 2021
cb56e1b
Bump version to 0.33.0 (#386)
testforstephen Sep 23, 2021
9d88e12
Revert "Bump version to 0.33.0 (#386)"
adpi2 Feb 25, 2022
38a87db
Merge tag '0.34.0' into main
adpi2 Feb 25, 2022
be7fad7
Add IStepFilterProvider
adpi2 Jul 7, 2022
e6560ba
fix style
adpi2 Jul 7, 2022
55b5e69
Fix pom files
adpi2 Jul 8, 2022
8b510c5
Run CI on branch 0.34.0+x
adpi2 Jul 8, 2022
60c4a76
Up version to 0.34.0+2
adpi2 Jul 8, 2022
c41a93e
Merge pull request #7 from adpi2/0.34.0+2
adpi2 Jul 8, 2022
f56bf57
Add filtering for step out
adpi2 Jul 15, 2022
814a43b
fix version of eclipse snapshot
adpi2 Jul 15, 2022
2c17e86
Merge pull request #8 from scalacenter/filter-step-out
adpi2 Jul 18, 2022
06e34c6
Prepare release 0.34.0+3
adpi2 Jul 18, 2022
b880873
fix stepping out filter
adpi2 Jul 18, 2022
b39d1c0
Prepare release 0.34.0+4
adpi2 Jul 18, 2022
6b3160c
Add shouldStepOut in StepFilterProvider
adpi2 Oct 2, 2022
718d782
Release 0.34.0+5
adpi2 Oct 2, 2022
4d19fec
Reorder step filter logic
adpi2 Oct 3, 2022
be72edb
Fix restart frame handler
adpi2 Oct 4, 2022
a67da2e
Bump version to 0.34.0+7-SNAPSHOT
adpi2 Oct 4, 2022
7d92828
Fix step handler when upperFrame is null
adpi2 Oct 4, 2022
36a426d
Release 0.34.0+7
adpi2 Oct 5, 2022
9e23f5b
Always disable pending step request before stopping thread
adpi2 Oct 18, 2022
d289974
Skip breakpoint if shouldSkipOver
adpi2 Oct 18, 2022
11bf651
Release 0.34.0+8
adpi2 Oct 19, 2022
acd27e0
Deactivate evaluate for hovers
adpi2 Oct 20, 2022
d91006d
Release 0.34.0+9
adpi2 Oct 20, 2022
c4af552
Fix Java doc generation
adpi2 Oct 28, 2022
bdf8433
update .project
adpi2 Nov 3, 2022
798d5f7
Add format in IStepFilterProvider
aymanelamyaghri Mar 30, 2023
5c4ff53
rename formatMethodSig
aymanelamyaghri May 11, 2023
bf0ce15
Fix Java 8 compat
aymanelamyaghri May 11, 2023
14854c6
Rename IStepFilterProvider to IStackTraceProvider
adpi2 Jun 16, 2023
23df7eb
Open VariableUtils API (#9)
iusildra Jun 20, 2023
a4018d0
all providers getter
iusildra Aug 9, 2023
57e71e9
getProviders returns a list
adpi2 Aug 15, 2023
d5608e5
catch all throwables from dispatch request
adpi2 Dec 21, 2023
39b44d1
Reinstall all breakpoints in files that changed
adpi2 Feb 9, 2024
901d541
Introduce DecodedMethod
adpi2 Feb 22, 2024
f94ff12
Quick and dirty fix of scala-debug-adapter#664
adpi2 Feb 22, 2024
b87d910
Revert "Quick and dirty fix of scala-debug-adapter#664"
adpi2 Mar 6, 2024
d53200a
Use subtle presentation hint for generated methods
adpi2 Mar 11, 2024
2f1fd9b
decode variable
SaadAissa Jul 9, 2024
a49309b
decode variables and fields basics
SaadAissa Jul 16, 2024
f6b68c7
exceptions when notFound
SaadAissa Jul 23, 2024
9a8cf3b
don't show static fields
SaadAissa Jul 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
propagate loggers from ProtocolServer
  • Loading branch information
mzarnowski committed Jul 22, 2019
commit 4c35a1f6d371342449406772d007bdb1e901a79f
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import com.sun.jdi.ThreadReference;
import com.sun.jdi.VirtualMachine;
Expand All @@ -22,10 +23,11 @@

public class DebugSession implements IDebugSession {
private VirtualMachine vm;
private EventHub eventHub = new EventHub();
private EventHub eventHub;

public DebugSession(VirtualMachine virtualMachine) {
public DebugSession(VirtualMachine virtualMachine, Logger logger) {
vm = virtualMachine;
eventHub = new EventHub(logger);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@

package com.microsoft.java.debug.core;

import java.util.logging.Logger;

import com.google.gson.JsonSyntaxException;
import com.google.gson.annotations.SerializedName;
import com.microsoft.java.debug.core.protocol.JsonUtils;

public final class DebugSettings {
private final Logger logger = Logger.getLogger(Configuration.LOGGER_NAME);
private static DebugSettings current = new DebugSettings();

public int maxStringLength = 0;
Expand All @@ -41,12 +38,8 @@ public static DebugSettings getCurrent() {
* @param jsonSettings
* the new settings represents in json format.
*/
public void updateSettings(String jsonSettings) {
try {
current = JsonUtils.fromJson(jsonSettings, DebugSettings.class);
} catch (JsonSyntaxException ex) {
logger.severe(String.format("Invalid json for debugSettings: %s, %s", jsonSettings, ex.getMessage()));
}
public void updateSettings(String jsonSettings) throws JsonSyntaxException {
current = JsonUtils.fromJson(jsonSettings, DebugSettings.class);
}

private DebugSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.logging.Logger;

import org.apache.commons.lang3.StringUtils;

Expand Down Expand Up @@ -66,7 +67,8 @@ public static IDebugSession launch(VirtualMachineManager vmManager,
List<String> modulePaths,
List<String> classPaths,
String cwd,
String[] envVars)
String[] envVars,
Logger logger)
throws IOException, IllegalConnectorArgumentsException, VMStartException {
return DebugUtility.launch(vmManager,
mainClass,
Expand All @@ -75,7 +77,8 @@ public static IDebugSession launch(VirtualMachineManager vmManager,
String.join(File.pathSeparator, modulePaths),
String.join(File.pathSeparator, classPaths),
cwd,
envVars);
envVars,
logger);
}

/**
Expand Down Expand Up @@ -114,7 +117,8 @@ public static IDebugSession launch(VirtualMachineManager vmManager,
String modulePaths,
String classPaths,
String cwd,
String[] envVars)
String[] envVars,
Logger logger)
throws IOException, IllegalConnectorArgumentsException, VMStartException {
List<LaunchingConnector> connectors = vmManager.launchingConnectors();
LaunchingConnector connector = connectors.get(0);
Expand Down Expand Up @@ -176,7 +180,7 @@ public static IDebugSession launch(VirtualMachineManager vmManager,
// Without this line, it throws ObjectCollectedException in ExceptionRequest.enable().
// See https://github.com/Microsoft/java-debug/issues/23
vm.version();
return new DebugSession(vm);
return new DebugSession(vm, logger);
}

/**
Expand All @@ -195,7 +199,7 @@ public static IDebugSession launch(VirtualMachineManager vmManager,
* @throws IllegalConnectorArgumentsException
* when one of the connector arguments is invalid.
*/
public static IDebugSession attach(VirtualMachineManager vmManager, String hostName, int port, int attachTimeout)
public static IDebugSession attach(VirtualMachineManager vmManager, String hostName, int port, int attachTimeout, Logger logger)
throws IOException, IllegalConnectorArgumentsException {
List<AttachingConnector> connectors = vmManager.attachingConnectors();
AttachingConnector connector = connectors.get(0);
Expand All @@ -211,7 +215,7 @@ public static IDebugSession attach(VirtualMachineManager vmManager, String hostN
arguments.get(HOSTNAME).setValue(hostName);
arguments.get(PORT).setValue(String.valueOf(port));
arguments.get(TIMEOUT).setValue(String.valueOf(attachTimeout));
return new DebugSession(connector.attach(arguments));
return new DebugSession(connector.attach(arguments), logger);
}

/**
Expand Down Expand Up @@ -543,8 +547,7 @@ private static List<String> parseArgumentsNonWindows(String args) {
* This piece of code is mainly copied from
* https://github.com/eclipse/eclipse.platform.debug/blob/master/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java#L1264
*
* @param args
* the command line arguments as a single string.
* @param args the command line arguments as a single string.
* @return the individual arguments
*/
private static List<String> parseArgumentsWindows(String args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@
import io.reactivex.subjects.PublishSubject;

public class EventHub implements IEventHub {
private final Logger logger = Logger.getLogger(Configuration.LOGGER_NAME);
private final Logger logger;
private PublishSubject<DebugEvent> subject = PublishSubject.<DebugEvent>create();

public EventHub(Logger logger) {
this.logger = logger;
}

@Override
public Observable<DebugEvent> events() {
return subject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*******************************************************************************
* Copyright (c) 2017 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
*******************************************************************************/
* Copyright (c) 2017 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;

Expand All @@ -16,6 +16,7 @@
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand All @@ -28,8 +29,8 @@
import com.sun.jdi.event.Event;

public class UsageDataSession {
private final Logger logger = Logger.getLogger(Configuration.LOGGER_NAME);
private final Logger usageDataLogger = Logger.getLogger(Configuration.USAGE_DATA_LOGGER_NAME);
private final Logger logger;
private final Logger usageDataLogger;
private static final long RESPONSE_MAX_DELAY_MS = 1000;
private static final ThreadLocal<UsageDataSession> threadLocal = new InheritableThreadLocal<>();

Expand All @@ -52,7 +53,12 @@ public static UsageDataSession currentSession() {
return threadLocal.get();
}

public UsageDataSession() {
/**
* Constructor.
*/
public UsageDataSession(Logger logger, Function<String, Logger> loggerFactory) {
this.logger = logger;
this.usageDataLogger = loggerFactory.apply(Configuration.USAGE_DATA_LOGGER_NAME);
threadLocal.set(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import com.microsoft.java.debug.core.Configuration;
import com.microsoft.java.debug.core.IBreakpoint;

public class BreakpointManager {
private final Logger logger = Logger.getLogger(Configuration.LOGGER_NAME);
private final Logger logger;
/**
* A collection of breakpoints registered with this manager.
*/
Expand All @@ -35,7 +34,8 @@ public class BreakpointManager {
/**
* Constructor.
*/
public BreakpointManager() {
public BreakpointManager(Logger logger) {
this.logger = logger;
this.breakpoints = Collections.synchronizedList(new ArrayList<>(5));
this.sourceToBreakpoints = new HashMap<>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import com.microsoft.java.debug.core.Configuration;
import com.microsoft.java.debug.core.adapter.handler.AttachRequestHandler;
import com.microsoft.java.debug.core.adapter.handler.CompletionsHandler;
import com.microsoft.java.debug.core.adapter.handler.ConfigurationDoneRequestHandler;
Expand Down Expand Up @@ -47,7 +46,7 @@
import com.microsoft.java.debug.core.protocol.Requests.Command;

public class DebugAdapter implements IDebugAdapter {
private final Logger logger = Logger.getLogger(Configuration.LOGGER_NAME);
private final Logger logger;

private IDebugAdapterContext debugContext = null;
private Map<Command, List<IDebugRequestHandler>> requestHandlersForDebug = null;
Expand All @@ -56,7 +55,8 @@ public class DebugAdapter implements IDebugAdapter {
/**
* Constructor.
*/
public DebugAdapter(IProtocolServer server, IProviderContext providerContext) {
public DebugAdapter(IProtocolServer server, IProviderContext providerContext, Logger logger) {
this.logger = logger;
this.debugContext = new DebugAdapterContext(server, providerContext);
requestHandlersForDebug = new HashMap<>();
requestHandlersForNoDebug = new HashMap<>();
Expand Down Expand Up @@ -97,29 +97,29 @@ private void initialize() {
// Register request handlers.
// When there are multiple handlers registered for the same request, follow the rule "first register, first execute".
registerHandler(new InitializeRequestHandler());
registerHandler(new LaunchRequestHandler());
registerHandler(new LaunchRequestHandler(logger));

// DEBUG node only
registerHandlerForDebug(new AttachRequestHandler());
registerHandlerForDebug(new ConfigurationDoneRequestHandler());
registerHandlerForDebug(new DisconnectRequestHandler());
registerHandlerForDebug(new SetBreakpointsRequestHandler());
registerHandlerForDebug(new AttachRequestHandler(logger));
registerHandlerForDebug(new ConfigurationDoneRequestHandler(logger));
registerHandlerForDebug(new DisconnectRequestHandler(logger));
registerHandlerForDebug(new SetBreakpointsRequestHandler(logger));
registerHandlerForDebug(new SetExceptionBreakpointsRequestHandler());
registerHandlerForDebug(new SourceRequestHandler());
registerHandlerForDebug(new ThreadsRequestHandler());
registerHandlerForDebug(new StepRequestHandler());
registerHandlerForDebug(new StackTraceRequestHandler());
registerHandlerForDebug(new ScopesRequestHandler());
registerHandlerForDebug(new VariablesRequestHandler());
registerHandlerForDebug(new VariablesRequestHandler(logger));
registerHandlerForDebug(new SetVariableRequestHandler());
registerHandlerForDebug(new EvaluateRequestHandler());
registerHandlerForDebug(new EvaluateRequestHandler(logger));
registerHandlerForDebug(new HotCodeReplaceHandler());
registerHandlerForDebug(new RestartFrameHandler());
registerHandlerForDebug(new CompletionsHandler());
registerHandlerForDebug(new ExceptionInfoRequestHandler());
registerHandlerForDebug(new ExceptionInfoRequestHandler(logger));

// NO_DEBUG mode only
registerHandlerForNoDebug(new DisconnectRequestWithoutDebuggingHandler());
registerHandlerForNoDebug(new DisconnectRequestWithoutDebuggingHandler(logger));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand All @@ -29,15 +30,23 @@
import com.sun.jdi.VMDisconnectedException;

public class ProtocolServer extends AbstractProtocolServer {
private final Logger logger = Logger.getLogger(Configuration.LOGGER_NAME);

private IDebugAdapter debugAdapter;
private UsageDataSession usageDataSession = new UsageDataSession();
private UsageDataSession usageDataSession;

private Object lock = new Object();
private boolean isDispatchingRequest = false;
private ConcurrentLinkedQueue<DebugEvent> eventQueue = new ConcurrentLinkedQueue<>();


/**
* Constructor.
*/
public ProtocolServer(InputStream input, OutputStream output, IProviderContext context, Function<String, Logger> loggerFactory) {
super(input, output, loggerFactory.apply(Configuration.LOGGER_NAME));
debugAdapter = new DebugAdapter(this, context, logger);
usageDataSession = new UsageDataSession(logger, loggerFactory);
}

/**
* Constructs a protocol server instance based on the given input stream and output stream.
* @param input
Expand All @@ -48,8 +57,7 @@ public class ProtocolServer extends AbstractProtocolServer {
* provider context for a series of provider implementation
*/
public ProtocolServer(InputStream input, OutputStream output, IProviderContext context) {
super(input, output);
debugAdapter = new DebugAdapter(this, context);
this(input, output, context, Logger::getLogger);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import com.microsoft.java.debug.core.Configuration;
import com.microsoft.java.debug.core.adapter.IDebugAdapterContext;
import com.microsoft.java.debug.core.adapter.IDebugRequestHandler;
import com.microsoft.java.debug.core.adapter.LaunchMode;
Expand All @@ -29,7 +28,11 @@
import com.microsoft.java.debug.core.protocol.Requests.Command;

public abstract class AbstractDisconnectRequestHandler implements IDebugRequestHandler {
private final Logger logger = Logger.getLogger(Configuration.LOGGER_NAME);
private final Logger logger;

public AbstractDisconnectRequestHandler(Logger logger) {
this.logger = logger;
}

@Override
public List<Command> getTargetCommands() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@

package com.microsoft.java.debug.core.adapter.handler;

import com.microsoft.java.debug.core.Configuration;
import com.microsoft.java.debug.core.protocol.Requests;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import com.microsoft.java.debug.core.protocol.Requests;

abstract class AbstractLaunchDelegate implements ILaunchDelegate {
protected final Logger logger = Logger.getLogger(Configuration.LOGGER_NAME);
protected final Logger logger;

protected AbstractLaunchDelegate(Logger logger) {
this.logger = logger;
}

protected String[] constructEnvironmentVariables(Requests.LaunchArguments launchArguments) {
String[] envVars = null;
Expand Down
Loading