mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
c65c83794f
2 changed files with 26 additions and 12 deletions
|
@ -591,8 +591,11 @@ public abstract class AbstractDebuggerProgramLaunchOffer implements DebuggerProg
|
||||||
monitor.incrementProgress(1);
|
monitor.incrementProgress(1);
|
||||||
monitor.setMessage("Launching");
|
monitor.setMessage("Launching");
|
||||||
locals.futureTarget = listenForTarget(l.getModel());
|
locals.futureTarget = listenForTarget(l.getModel());
|
||||||
|
if (prompt) {
|
||||||
|
return launch(l, true, configurator);
|
||||||
|
}
|
||||||
return AsyncTimer.DEFAULT_TIMER.mark()
|
return AsyncTimer.DEFAULT_TIMER.mark()
|
||||||
.timeOut(launch(l, prompt, configurator), getTimeoutMillis(),
|
.timeOut(launch(l, false, configurator), getTimeoutMillis(),
|
||||||
() -> onTimedOutLaunch(monitor));
|
() -> onTimedOutLaunch(monitor));
|
||||||
}).thenCompose(__ -> {
|
}).thenCompose(__ -> {
|
||||||
checkCancelled(monitor);
|
checkCancelled(monitor);
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.awt.event.WindowListener;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.text.*;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.core.Appender;
|
import org.apache.logging.log4j.core.Appender;
|
||||||
|
@ -36,8 +37,8 @@ import log.LogPanelAppender;
|
||||||
public class AgentWindow extends JFrame implements WindowListener, LogListener {
|
public class AgentWindow extends JFrame implements WindowListener, LogListener {
|
||||||
public static final int MAX_LOG_CHARS = 100000;
|
public static final int MAX_LOG_CHARS = 100000;
|
||||||
|
|
||||||
protected final JTextArea logArea = new JTextArea();
|
protected final JTextPane logPane = new JTextPane();
|
||||||
protected final JScrollPane logScroll = new JScrollPane(logArea);
|
protected final JScrollPane logScroll = new JScrollPane(logPane);
|
||||||
|
|
||||||
public AgentWindow(String title, SocketAddress localAddress) {
|
public AgentWindow(String title, SocketAddress localAddress) {
|
||||||
super(title);
|
super(title);
|
||||||
|
@ -45,10 +46,12 @@ public class AgentWindow extends JFrame implements WindowListener, LogListener {
|
||||||
addWindowListener(this);
|
addWindowListener(this);
|
||||||
add(new JLabel("<html>This agent is listening at <b>" + localAddress +
|
add(new JLabel("<html>This agent is listening at <b>" + localAddress +
|
||||||
"</b>. Close this window to terminate it.</html>"), BorderLayout.NORTH);
|
"</b>. Close this window to terminate it.</html>"), BorderLayout.NORTH);
|
||||||
logArea.setEditable(false);
|
logPane.setEditable(false);
|
||||||
logArea.setFont(Font.decode(Font.MONOSPACED));
|
logPane.setFont(Font.decode(Font.MONOSPACED));
|
||||||
logArea.setAutoscrolls(true);
|
logPane.setAutoscrolls(true);
|
||||||
logScroll.setAutoscrolls(true);
|
logScroll.setAutoscrolls(true);
|
||||||
|
DefaultCaret caret = (DefaultCaret) logPane.getCaret();
|
||||||
|
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
|
||||||
add(logScroll);
|
add(logScroll);
|
||||||
setMinimumSize(new Dimension(400, 300));
|
setMinimumSize(new Dimension(400, 300));
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
@ -70,13 +73,21 @@ public class AgentWindow extends JFrame implements WindowListener, LogListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageLogged(String message, boolean isError) {
|
public void messageLogged(String message, boolean isError) {
|
||||||
String fMessage = isError ? "<font color=\"red\">" + message + "</font>" : message;
|
|
||||||
Swing.runIfSwingOrRunLater(() -> {
|
Swing.runIfSwingOrRunLater(() -> {
|
||||||
String allText = logArea.getText() + fMessage + "\n";
|
MutableAttributeSet attributes = new SimpleAttributeSet();
|
||||||
logArea.setText(
|
if (isError) {
|
||||||
allText.substring(Math.max(0, allText.length() - MAX_LOG_CHARS), allText.length()));
|
StyleConstants.setForeground(attributes, Color.RED);
|
||||||
JScrollBar vScroll = logScroll.getVerticalScrollBar();
|
}
|
||||||
vScroll.setValue(vScroll.getMaximum());
|
Document document = logPane.getStyledDocument();
|
||||||
|
try {
|
||||||
|
document.insertString(document.getLength(), message + "\n", attributes);
|
||||||
|
if (document.getLength() > MAX_LOG_CHARS) {
|
||||||
|
document.remove(0, document.getLength() - MAX_LOG_CHARS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (BadLocationException e) {
|
||||||
|
throw new AssertionError(e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue