GP-874: Adding connection info to remote connectors

This commit is contained in:
d-millar 2021-04-26 10:48:01 -04:00 committed by Dan
parent ac3097a086
commit d1c1d9d5e8
7 changed files with 29 additions and 3 deletions

View File

@ -514,4 +514,12 @@ public interface GdbManager extends AutoCloseable, GdbBreakpointInsertions {
* @throws IOException if the filename could not be determined
*/
String getMi2PtyName() throws IOException;
/**
* Get a description for the pty for this GDB session
*
* @return the description
*/
String getPtyDescription();
}

View File

@ -15,7 +15,7 @@
*/
package agent.gdb.manager.impl;
import static ghidra.async.AsyncUtils.loop;
import static ghidra.async.AsyncUtils.*;
import java.io.*;
import java.util.*;
@ -1616,6 +1616,11 @@ public class GdbManagerImpl implements GdbManager {
return mi2Thread.pty.getChild().nullSession();
}
@Override
public String getPtyDescription() {
return ptyFactory.getDescription();
}
public boolean hasCli() {
return cliThread != null && cliThread.pty != null;
}

View File

@ -85,7 +85,8 @@ public class GdbModelImpl extends AbstractDebuggerObjectModel {
@Override
public String getBrief() {
return "GDB@" + Integer.toHexString(System.identityHashCode(this));
return "GDB@" + Integer.toHexString(System.identityHashCode(this)) + " " +
gdb.getPtyDescription();
}
@Override

View File

@ -29,4 +29,6 @@ public interface PtyFactory {
* @throws IOException for an I/O error, including cancellation
*/
Pty openpty() throws IOException;
String getDescription();
}

View File

@ -25,4 +25,9 @@ public class LinuxPtyFactory implements PtyFactory {
public Pty openpty() throws IOException {
return LinuxPty.openpty();
}
@Override
public String getDescription() {
return "local";
}
}

View File

@ -131,4 +131,9 @@ public class GhidraSshPtyFactory implements PtyFactory {
}
return new SshPty(sshConn.openSession());
}
@Override
public String getDescription() {
return "ssh:" + hostname + "(user=" + username + ",port=" + port + ")";
}
}

View File

@ -438,7 +438,7 @@ public class GadpClient extends AbstractDebuggerObjectModel
@Override
public String getBrief() {
return description + " via GADP (" + channelState.get().name().toLowerCase() + ")";
return "GADP@" + Integer.toHexString(System.identityHashCode(this)) + " " + description;
}
public CompletableFuture<Void> connect() {