fixed pid address presentation - IDEA-168185

This commit is contained in:
Egor Ushakov
2018-08-17 16:06:47 +03:00
parent 93accee11f
commit ed9e6f8451
6 changed files with 42 additions and 48 deletions
@@ -9,6 +9,7 @@ import com.intellij.debugger.engine.requests.MethodReturnValueWatcher;
import com.intellij.debugger.engine.requests.RequestManagerImpl;
import com.intellij.debugger.impl.DebuggerManagerImpl;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.debugger.impl.DebuggerUtilsImpl;
import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
import com.intellij.debugger.requests.Requestor;
@@ -19,7 +20,6 @@ import com.intellij.debugger.ui.breakpoints.RunToCursorBreakpoint;
import com.intellij.debugger.ui.breakpoints.StackCapturingLineBreakpoint;
import com.intellij.debugger.ui.overhead.OverheadProducer;
import com.intellij.debugger.ui.overhead.OverheadTimings;
import com.intellij.execution.configurations.RemoteConnection;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
@@ -110,10 +110,7 @@ public class DebugProcessEvents extends DebugProcessImpl {
text = DebuggerBundle.message("status.process.terminated");
}
else if (event instanceof VMDisconnectEvent) {
final RemoteConnection connection = getConnection();
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(connection);
final String transportName = DebuggerBundle.getTransportName(connection);
text = DebuggerBundle.message("status.disconnected", addressDisplayName, transportName);
text = DebuggerBundle.message("status.disconnected", DebuggerUtilsImpl.getConnectionDisplayName(getConnection()));
}
return text;
}
@@ -375,9 +372,7 @@ public class DebugProcessEvents extends DebugProcessImpl {
trackClassRedefinitions();
}
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(getConnection());
final String transportName = DebuggerBundle.getTransportName(getConnection());
showStatusText(DebuggerBundle.message("status.connected", addressDisplayName, transportName));
showStatusText(DebuggerBundle.message("status.connected", DebuggerUtilsImpl.getConnectionDisplayName(getConnection())));
LOG.debug("leave: processVMStartEvent()");
if (!machineProxy.canBeModified()) {
@@ -1473,7 +1473,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
VirtualMachineProxyImpl virtualMachineProxy = getVirtualMachineProxy();
if (!virtualMachineProxy.canBeModified()) {
closeProcess(true);
closeProcess(false);
return;
}
@@ -6,7 +6,7 @@ import com.intellij.execution.configurations.RemoteConnection;
/**
* @author egor
*/
class PidRemoteConnection extends RemoteConnection {
public class PidRemoteConnection extends RemoteConnection {
private final String myPid;
public PidRemoteConnection(String pid) {
@@ -262,9 +262,8 @@ public class DebuggerSession implements AbstractDebuggerSession {
return DebuggerBundle.message("status.app.running");
case WAITING_ATTACH:
RemoteConnection connection = getProcess().getConnection();
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(connection);
final String transportName = DebuggerBundle.getTransportName(connection);
return connection.isServerMode() ? DebuggerBundle.message("status.listening", addressDisplayName, transportName) : DebuggerBundle.message("status.connecting", addressDisplayName, transportName);
return DebuggerBundle.message(connection.isServerMode() ? "status.listening" : "status.connecting",
DebuggerUtilsImpl.getConnectionDisplayName(connection));
case PAUSED:
return DebuggerBundle.message("status.paused");
case WAIT_EVALUATION:
@@ -432,12 +431,10 @@ public class DebuggerSession implements AbstractDebuggerSession {
private void attach() throws ExecutionException {
RemoteConnection remoteConnection = myDebugEnvironment.getRemoteConnection();
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(remoteConnection);
final String transportName = DebuggerBundle.getTransportName(remoteConnection);
myDebugProcess.attachVirtualMachine(myDebugEnvironment, this);
getContextManager().setState(SESSION_EMPTY_CONTEXT, State.WAITING_ATTACH,
Event.START_WAIT_ATTACH,
DebuggerBundle.message("status.waiting.attach", addressDisplayName, transportName));
getContextManager().setState(SESSION_EMPTY_CONTEXT, State.WAITING_ATTACH, Event.START_WAIT_ATTACH,
DebuggerBundle.message("status.waiting.attach",
DebuggerUtilsImpl.getConnectionDisplayName(remoteConnection)));
}
private class MyDebugProcessListener extends DebugProcessAdapterImpl {
@@ -452,11 +449,9 @@ public class DebuggerSession implements AbstractDebuggerSession {
public void connectorIsReady() {
DebuggerInvocationUtil.invokeLater(getProject(), () -> {
RemoteConnection connection = myDebugProcess.getConnection();
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(connection);
final String transportName = DebuggerBundle.getTransportName(connection);
final String connectionStatusMessage = connection.isServerMode() ? DebuggerBundle.message("status.listening", addressDisplayName, transportName) : DebuggerBundle.message("status.connecting", addressDisplayName, transportName);
getContextManager().setState(SESSION_EMPTY_CONTEXT, State.WAITING_ATTACH,
Event.START_WAIT_ATTACH, connectionStatusMessage);
String connectionStatusMessage = DebuggerBundle.message(connection.isServerMode() ? "status.listening" : "status.connecting",
DebuggerUtilsImpl.getConnectionDisplayName(connection));
getContextManager().setState(SESSION_EMPTY_CONTEXT, State.WAITING_ATTACH, Event.START_WAIT_ATTACH, connectionStatusMessage);
});
}
@@ -656,10 +651,7 @@ public class DebuggerSession implements AbstractDebuggerSession {
@Override
public void processAttached(final DebugProcessImpl process) {
final RemoteConnection connection = getProcess().getConnection();
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(connection);
final String transportName = DebuggerBundle.getTransportName(connection);
final String message = DebuggerBundle.message("status.connected", addressDisplayName, transportName);
String message = DebuggerBundle.message("status.connected", DebuggerUtilsImpl.getConnectionDisplayName(process.getConnection()));
process.printToConsole(message + "\n");
DebuggerInvocationUtil.invokeLater(getProject(),
@@ -671,7 +663,7 @@ public class DebuggerSession implements AbstractDebuggerSession {
DebuggerInvocationUtil.invokeLater(getProject(), () -> {
String message = "";
if (state instanceof RemoteState) {
message = DebuggerBundle.message("status.connect.failed", DebuggerBundle.getAddressDisplayName(remoteConnection), DebuggerBundle.getTransportName(remoteConnection));
message = DebuggerBundle.message("status.connect.failed", DebuggerUtilsImpl.getConnectionDisplayName(remoteConnection));
}
message += exception.getMessage();
getContextManager().setState(SESSION_EMPTY_CONTEXT, State.STOPPED, Event.DETACHED, message);
@@ -682,20 +674,16 @@ public class DebuggerSession implements AbstractDebuggerSession {
public void processDetached(final DebugProcessImpl debugProcess, boolean closedByUser) {
if (!closedByUser) {
ProcessHandler processHandler = debugProcess.getProcessHandler();
if(processHandler != null) {
final RemoteConnection connection = getProcess().getConnection();
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(connection);
final String transportName = DebuggerBundle.getTransportName(connection);
processHandler.notifyTextAvailable(DebuggerBundle.message("status.disconnected", addressDisplayName, transportName) + "\n", ProcessOutputTypes.SYSTEM);
if (processHandler != null) {
processHandler.notifyTextAvailable(
DebuggerBundle.message("status.disconnected", DebuggerUtilsImpl.getConnectionDisplayName(debugProcess.getConnection())) + "\n",
ProcessOutputTypes.SYSTEM);
}
}
DebuggerInvocationUtil.invokeLater(getProject(), () -> {
final RemoteConnection connection = getProcess().getConnection();
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(connection);
final String transportName = DebuggerBundle.getTransportName(connection);
DebuggerInvocationUtil.invokeLater(getProject(), () ->
getContextManager().setState(SESSION_EMPTY_CONTEXT, State.STOPPED, Event.DETACHED,
DebuggerBundle.message("status.disconnected", addressDisplayName, transportName));
});
DebuggerBundle.message("status.disconnected",
DebuggerUtilsImpl.getConnectionDisplayName(debugProcess.getConnection()))));
clearSteppingThrough();
}
@@ -1,11 +1,11 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.debugger.impl;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.actions.DebuggerAction;
import com.intellij.debugger.engine.DebugProcess;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.PidRemoteConnection;
import com.intellij.debugger.engine.StackFrameContext;
import com.intellij.debugger.engine.evaluation.CodeFragmentKind;
import com.intellij.debugger.engine.evaluation.EvaluateException;
@@ -17,6 +17,7 @@ import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeExpression;
import com.intellij.debugger.ui.tree.DebuggerTreeNode;
import com.intellij.debugger.ui.tree.render.BatchEvaluator;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.RemoteConnection;
import com.intellij.ide.util.TreeClassChooser;
import com.intellij.ide.util.TreeClassChooserFactory;
import com.intellij.openapi.actionSystem.DataContext;
@@ -259,4 +260,13 @@ public class DebuggerUtilsImpl extends DebuggerUtilsEx{
ProgressIndicatorUtils.yieldToPendingWriteActions();
}
}
public static String getConnectionDisplayName(RemoteConnection connection) {
if (connection instanceof PidRemoteConnection) {
return "pid " + ((PidRemoteConnection)connection).getPid();
}
String addressDisplayName = DebuggerBundle.getAddressDisplayName(connection);
String transportName = DebuggerBundle.getTransportName(connection);
return DebuggerBundle.message("string.connection", addressDisplayName, transportName);
}
}
@@ -47,7 +47,7 @@ progress.set.value=Setting value...
action.add.field.watchpoint.text=Add Field Watchpoint
status.process.started=Process started
status.process.terminated=Process terminated
status.disconnected=Disconnected from the target VM, address: ''{0}'', transport: ''{1}''
status.disconnected=Disconnected from the target VM, address: {0}
status.stopped.at.cursor=Stopped at cursor
status.line.breakpoint.reached=Breakpoint reached at {0}({1}:{2,number,#})
status.line.breakpoint.reached.full.trace=Breakpoint reached
@@ -66,8 +66,8 @@ status.field.watchpoint.reached.access='{'{0}@{5}'}'.{1} will be accessed at {2}
status.static.field.watchpoint.reached.access={0}.{1} will be accessed at {2}({3}:{4,number,#})
status.field.watchpoint.reached.modification='{'{0}@{7}'}'.{1} will be modified at {4}({5}:{6,number,#}). Current value = ''{2}''. New value = ''{3}''
status.static.field.watchpoint.reached.modification={0}.{1} will be modified at {4}({5}:{6,number,#}). Current value = ''{2}''. New value = ''{3}''
status.connected=Connected to the target VM, address: ''{0}'', transport: ''{1}''
status.connect.failed=Failed to establish connection to the target VM, address: ''{0}'', transport: ''{1}''
status.connected=Connected to the target VM, address: {0}
status.connect.failed=Failed to establish connection to the target VM, address: {0}
error.debugger.already.listening=Debugger is already listening
transport.name.shared.memory=shared memory
transport.name.socket=socket
@@ -86,9 +86,9 @@ error.vm.disconnected=VM disconnected. Target virtual machine closed connection
error.unknown.host=Cannot connect to remote process, host is unknown
error.cannot.open.debugger.port=Unable to open debugger port
error.exception.while.connecting=Error connecting to remote process.\nException occurred: {0}\nException message: {1}
status.waiting.attach=Debugger is waiting for application to start; debug address: ''{0}''; transport: ''{1}''
status.listening=Listening to the connection, address: ''{0}'', transport: ''{1}''
status.connecting=Connecting to the target VM, address: ''{0}'', transport: ''{1}''
status.waiting.attach=Debugger is waiting for application to start; debug address: {0}
status.listening=Listening to the connection, address: {0}
status.connecting=Connecting to the target VM, address: {0}
status.app.running=The application is running
status.debug.stopped=Debug stopped
status.waiting.evaluation.result=Waiting until last debugger command completes
@@ -98,6 +98,7 @@ status.step.over=Stepping over
status.run.to.cursor=Run to cursor
status.process.resumed=Process resumed
status.paused.in.another.thread=Paused in another thread
string.connection=''{0}'', transport: ''{1}''
error.pop.bottom.stackframe=Cannot pop bottom frame
error.pop.stackframe=An error occurred while popping stack frame: {0}
error.class.not.loaded=Class not loaded : {0}