mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-25 17:00:36 -09:00
GP-5879: Add callbacks to PcodeEmulator. Refactor for composition vice inheritance.
This commit is contained in:
@@ -13,18 +13,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import ghidra.app.plugin.core.debug.service.emulation.BytesDebuggerPcodeEmulator;
|
||||
import ghidra.app.plugin.core.debug.service.emulation.BytesDebuggerPcodeEmulatorFactory;
|
||||
import ghidra.app.plugin.core.debug.service.emulation.DefaultEmulatorFactory;
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.debug.api.emulation.DebuggerPcodeMachine;
|
||||
import ghidra.debug.api.emulation.PcodeDebuggerAccess;
|
||||
import ghidra.debug.flatapi.FlatDebuggerAPI;
|
||||
import ghidra.pcode.emu.*;
|
||||
import ghidra.pcode.exec.PcodeUseropLibrary;
|
||||
import ghidra.pcode.exec.trace.TraceEmulationIntegration.Writer;
|
||||
import ghidra.program.model.lang.Language;
|
||||
|
||||
public class InstallCustomLibraryScript extends GhidraScript implements FlatDebuggerAPI {
|
||||
public static class CustomBytesDebuggerPcodeEmulator extends BytesDebuggerPcodeEmulator {
|
||||
private CustomBytesDebuggerPcodeEmulator(PcodeDebuggerAccess access) {
|
||||
super(access);
|
||||
public static class CustomPcodeEmulator extends PcodeEmulator {
|
||||
private CustomPcodeEmulator(Language language, PcodeEmulationCallbacks<byte[]> cb) {
|
||||
super(language, cb);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,10 +36,10 @@ public class InstallCustomLibraryScript extends GhidraScript implements FlatDebu
|
||||
}
|
||||
|
||||
public static class CustomBytesDebuggerPcodeEmulatorFactory
|
||||
extends BytesDebuggerPcodeEmulatorFactory {
|
||||
extends DefaultEmulatorFactory {
|
||||
@Override
|
||||
public DebuggerPcodeMachine<?> create(PcodeDebuggerAccess access) {
|
||||
return new CustomBytesDebuggerPcodeEmulator(access);
|
||||
public PcodeMachine<?> create(PcodeDebuggerAccess access, Writer writer) {
|
||||
return new CustomPcodeEmulator(access.getLanguage(), writer.callbacks());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user