mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-860: Windows debuggers take their prompts from the engine.
This commit is contained in:
parent
b7a1d4bfd4
commit
d4182c2410
5 changed files with 61 additions and 13 deletions
|
@ -15,10 +15,10 @@
|
|||
*/
|
||||
package agent.dbgeng.manager.cmd;
|
||||
|
||||
import agent.dbgeng.dbgeng.DebugControl;
|
||||
import agent.dbgeng.manager.DbgEvent;
|
||||
import agent.dbgeng.manager.DbgManager;
|
||||
import agent.dbgeng.manager.evt.AbstractDbgCompletedCommandEvent;
|
||||
import agent.dbgeng.manager.evt.DbgConsoleOutputEvent;
|
||||
import agent.dbgeng.manager.evt.*;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
|
||||
/**
|
||||
|
@ -63,6 +63,8 @@ public class DbgConsoleExecCommand extends AbstractDbgCommand<String> {
|
|||
|
||||
@Override
|
||||
public void invoke() {
|
||||
manager.getControl().execute(command);
|
||||
DebugControl control = manager.getControl();
|
||||
control.execute(command);
|
||||
manager.processEvent(new DbgPromptChangedEvent(control.getPromptText()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package agent.dbgeng.manager.evt;
|
||||
|
||||
public class DbgPromptChangedEvent extends AbstractDbgEvent<String> {
|
||||
public DbgPromptChangedEvent(String prompt) {
|
||||
super(prompt);
|
||||
}
|
||||
|
||||
public String getPrompt() {
|
||||
return getInfo();
|
||||
}
|
||||
}
|
|
@ -41,7 +41,8 @@ import agent.dbgeng.manager.breakpoint.DbgBreakpointInfo;
|
|||
import agent.dbgeng.manager.breakpoint.DbgBreakpointType;
|
||||
import agent.dbgeng.manager.cmd.*;
|
||||
import agent.dbgeng.manager.evt.*;
|
||||
import agent.dbgeng.model.iface1.*;
|
||||
import agent.dbgeng.model.iface1.DbgModelTargetActiveScope;
|
||||
import agent.dbgeng.model.iface1.DbgModelTargetFocusScope;
|
||||
import agent.dbgeng.model.iface2.DbgModelTargetObject;
|
||||
import agent.dbgeng.model.iface2.DbgModelTargetThread;
|
||||
import ghidra.async.*;
|
||||
|
@ -597,6 +598,7 @@ public class DbgManagerImpl implements DbgManager {
|
|||
handlerMap.putVoid(DbgStoppedEvent.class, this::processDefault);
|
||||
handlerMap.putVoid(DbgRunningEvent.class, this::processDefault);
|
||||
handlerMap.putVoid(DbgConsoleOutputEvent.class, this::processConsoleOutput);
|
||||
handlerMap.putVoid(DbgPromptChangedEvent.class, this::processPromptChanged);
|
||||
handlerMap.putVoid(DbgBreakpointCreatedEvent.class, this::processBreakpointCreated);
|
||||
handlerMap.putVoid(DbgBreakpointModifiedEvent.class, this::processBreakpointModified);
|
||||
handlerMap.putVoid(DbgBreakpointDeletedEvent.class, this::processBreakpointDeleted);
|
||||
|
@ -925,6 +927,7 @@ public class DbgManagerImpl implements DbgManager {
|
|||
dbgState = DbgState.STOPPED;
|
||||
//System.err.println("STOPPED " + id);
|
||||
processEvent(new DbgStoppedEvent(eventThread.getId()));
|
||||
processEvent(new DbgPromptChangedEvent(getControl().getPromptText()));
|
||||
}
|
||||
if (status.threadState.equals(ExecutionState.RUNNING)) {
|
||||
//System.err.println("RUNNING " + id);
|
||||
|
@ -949,6 +952,7 @@ public class DbgManagerImpl implements DbgManager {
|
|||
if (process != null) {
|
||||
processEvent(new DbgProcessSelectedEvent(process));
|
||||
}
|
||||
processEvent(new DbgPromptChangedEvent(getControl().getPromptText()));
|
||||
return DebugStatus.BREAK;
|
||||
}
|
||||
if (status.equals(DebugStatus.GO)) {
|
||||
|
@ -972,6 +976,7 @@ public class DbgManagerImpl implements DbgManager {
|
|||
if (thread != null) {
|
||||
getEventListeners().fire.threadSelected(thread, null, evt.getCause());
|
||||
}
|
||||
processEvent(new DbgPromptChangedEvent(getControl().getPromptText()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1033,6 +1038,10 @@ public class DbgManagerImpl implements DbgManager {
|
|||
getEventListeners().fire.consoleOutput(evt.getInfo(), evt.getMask());
|
||||
}
|
||||
|
||||
protected void processPromptChanged(DbgPromptChangedEvent evt, Void v) {
|
||||
getEventListeners().fire.promptChanged(evt.getPrompt());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for breakpoint-created event
|
||||
*
|
||||
|
@ -1480,8 +1489,8 @@ public class DbgManagerImpl implements DbgManager {
|
|||
@Override
|
||||
public CompletableFuture<Void> console(String command) {
|
||||
if (continuation != null) {
|
||||
String prompt = command.equals("") ? DbgModelTargetInterpreter.DBG_PROMPT : ">>>";
|
||||
getEventListeners().fire.promptChanged(prompt);
|
||||
//String prompt = command.equals("") ? DbgModelTargetInterpreter.DBG_PROMPT : ">>>";
|
||||
//getEventListeners().fire.promptChanged(prompt);
|
||||
continuation.complete(command);
|
||||
setContinuation(null);
|
||||
return AsyncUtils.NIL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue