Ghidra is a software reverse engineering (SRE) framework
GP-0: Fix EMPTY needs to still include language userops.
Dan534dc7cd7b30
diff --git a/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/emu/jit/decode/DecoderExecutor.java b/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/emu/jit/decode/DecoderExecutor.javaindex bf4602ad61..0c043a8ef1 100644--- a/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/emu/jit/decode/DecoderExecutor.java+++ b/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/emu/jit/decode/DecoderExecutor.java@@ -523,8 +523,7 @@ class DecoderExecutor extends FoldingExecutor implements DisassemblerContextAdap* @param the computed reachability of the source block. Use {@link CtxReach#WITHOUT_CTXMOD} for* the seed.*/- private void collectCtxReach(Map<JitBlock, CtxReach> into, JitBlock cur,- CtxReach how) {+ private void collectCtxReach(Map<JitBlock, CtxReach> into, JitBlock cur, CtxReach how) {CtxReach curHow = into.get(cur);if (blockModifiesContext(cur)) {diff --git a/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/exec/PcodeProgram.java b/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/exec/PcodeProgram.javaindex 04c62bf1ba..4f7fe8020d 100644--- a/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/exec/PcodeProgram.java+++ b/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/exec/PcodeProgram.java@@ -140,7 +140,7 @@ public class PcodeProgram {throw new IllegalArgumentException("Instruction must be parsed using Sleigh");}PcodeOp[] pcode = instruction.getPcode(includeOverrides);- return new PcodeProgram(slang, List.of(pcode), PcodeUseropSymbolMap.EMPTY);+ return new PcodeProgram(slang, List.of(pcode), PcodeUseropSymbolMap.empty(slang));}/**@@ -162,8 +162,8 @@ public class PcodeProgram {InjectContext ctx = library.buildInjectContext();InjectPayload payload = library.getPayload(type, name);PcodeOp[] pcode = payload.getPcode(program, ctx);- return new PcodeProgram((SleighLanguage) program.getLanguage(), List.of(pcode),- PcodeUseropSymbolMap.EMPTY);+ SleighLanguage language = (SleighLanguage) program.getLanguage();+ return new PcodeProgram(language, List.of(pcode), PcodeUseropSymbolMap.empty(language));}protected final SleighLanguage language;diff --git a/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/exec/PcodeUseropLibrary.java b/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/exec/PcodeUseropLibrary.javaindex 3aa121d21b..3a0baffffe 100644--- a/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/exec/PcodeUseropLibrary.java+++ b/Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/exec/PcodeUseropLibrary.java@@ -51,17 +51,10 @@ public interface PcodeUseropLibrary<T> {*/record PcodeUseropSymbolMap(SleighLanguage language, Map<Integer, UserOpSymbol> byIndex,Map<String, UserOpSymbol> byName) {- public PcodeUseropSymbolMap {- if (!byIndex.isEmpty() || !byName.isEmpty()) {- Objects.requireNonNull(language);- }- }- /**- * The empty set of symbols- */- public static final PcodeUseropSymbolMap EMPTY =- new PcodeUseropSymbolMap(null, Map.of(), Map.of());+ public static PcodeUseropSymbolMap empty(SleighLanguage language) {+ return new PcodeUseropSymbolMap(language, Map.of());+ }private static Map<String, UserOpSymbol> byName(Map<Integer, UserOpSymbol> byIndex) {return byIndex.values()