diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServiceTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServiceTest.java index f3073b3ace..ff687bd181 100644 --- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServiceTest.java +++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServiceTest.java @@ -256,7 +256,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU false); // NOTE: qword ptr [0x00600800] is RIP-relative - asm.assemble(addrText, "MOV RAX, qword ptr [0x00600800]"); + asm.assemble(addrText, "MOV RAX, qword ptr [RIP + 0x2007f9]"); memory.setLong(addr(program, 0x00600800), 0xdeadbeefcafebabeL); } diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/pcode/exec/trace/BytesTracePcodeEmulatorTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/pcode/exec/trace/BytesTracePcodeEmulatorTest.java index 14a30b85df..5cf113b052 100644 --- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/pcode/exec/trace/BytesTracePcodeEmulatorTest.java +++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/pcode/exec/trace/BytesTracePcodeEmulatorTest.java @@ -327,7 +327,7 @@ public class BytesTracePcodeEmulatorTest extends AbstractTracePcodeEmulatorTest """, List.of( // First instruction undoes the modification above - "XOR byte ptr [0x00400007], 0xcc", // 7 bytes + "XOR byte ptr [RIP], 0xcc", // 7 bytes "MOV EAX,0xdeadbeef")); // 5 bytes BytesTracePcodeEmulator emu = new BytesTracePcodeEmulator(tb.host, 0); @@ -600,7 +600,7 @@ public class BytesTracePcodeEmulatorTest extends AbstractTracePcodeEmulatorTest *:8 0x00600000:8 = 0xfedcba9876543210; """, List.of( - "MOVAPS XMM0, xmmword ptr [0x00600000]")); + "MOVAPS XMM0, xmmword ptr [RIP + 0x1ffff9]")); BytesTracePcodeEmulator emu = new BytesTracePcodeEmulator(tb.host, 0); PcodeThread emuThread = emu.newThread(thread.getPath()); diff --git a/Ghidra/Debug/TaintAnalysis/src/test/java/ghidra/pcode/emu/taint/full/TaintDebuggerPcodeEmulatorTest.java b/Ghidra/Debug/TaintAnalysis/src/test/java/ghidra/pcode/emu/taint/full/TaintDebuggerPcodeEmulatorTest.java index 1ae067a10c..a1840f968f 100644 --- a/Ghidra/Debug/TaintAnalysis/src/test/java/ghidra/pcode/emu/taint/full/TaintDebuggerPcodeEmulatorTest.java +++ b/Ghidra/Debug/TaintAnalysis/src/test/java/ghidra/pcode/emu/taint/full/TaintDebuggerPcodeEmulatorTest.java @@ -15,8 +15,7 @@ */ package ghidra.pcode.emu.taint.full; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import java.util.Set; @@ -120,7 +119,7 @@ public class TaintDebuggerPcodeEmulatorTest extends AbstractGhidraHeadedDebugger Assembler asm = Assemblers.getAssembler(program); // NOTE: qword ptr [0x00400800] is RIP-relative - asm.assemble(tb.addr(0x00400000), "MOV RAX, qword ptr [0x00400800]"); + asm.assemble(tb.addr(0x00400000), "MOV RAX, qword ptr [RIP + 0x7f9]"); } TraceSchedule time = TraceSchedule.parse("0:t0-1"); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorModel.java index c0e0e8f37a..1c795f79d8 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorModel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorModel.java @@ -114,7 +114,7 @@ public abstract class CompositeEditorModel extends CompositeViewerModel implemen hadChanges = false; - if (lastCompositeId != originalCompositeId) { + if (originalCompositeId == -1 || lastCompositeId != originalCompositeId) { // only clear the selection if loading a new type setSelection(new FieldSelection()); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackEditorModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackEditorModel.java index af7ec49d64..d90d9c3c32 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackEditorModel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackEditorModel.java @@ -118,18 +118,15 @@ public class StackEditorModel extends CompositeEditorModel { return false; } StackFrameDataType sfdt = (StackFrameDataType) viewComposite; - int editFrameSize = sfdt.getLength(); int editReturnAddressOffset = sfdt.getReturnAddressOffset(); int editLocalSize = sfdt.getLocalSize(); int editParamOffset = sfdt.getParameterOffset(); int editParamSize = sfdt.getParameterSize(); - int stackFrameSize = sfdt.getLength(); - int stackReturnAddressOffset = sfdt.getReturnAddressOffset(); - int stackLocalSize = sfdt.getLocalSize(); - int stackParamOffset = sfdt.getParameterOffset(); - int stackParamSize = sfdt.getParameterSize(); - hadChanges = (editFrameSize != stackFrameSize) || - (editReturnAddressOffset != stackReturnAddressOffset) || + int stackReturnAddressOffset = originalStack.getReturnAddressOffset(); + int stackLocalSize = originalStack.getLocalSize(); + int stackParamOffset = originalStack.getParameterOffset(); + int stackParamSize = originalStack.getParameterSize(); + hadChanges = (editReturnAddressOffset != stackReturnAddressOffset) || (editLocalSize != stackLocalSize) || (editParamOffset != stackParamOffset) || (editParamSize != stackParamSize) || super.updateAndCheckChangeState(); return hadChanges; @@ -932,7 +929,7 @@ public class StackEditorModel extends CompositeEditorModel { if (!isValidName() || !hasChanges()) { return false; } - StackFrame original = getOriginalStack(); + StackFrame original = getOriginalStack(); // FIXME: Not Needed - use originalStack Function function = original.getFunction(); StackFrameDataType edited = getEditorStack(); diff --git a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/app/plugin/assembler/sleigh/x64AssemblyTest.java b/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/app/plugin/assembler/sleigh/x64AssemblyTest.java index 31c03fd1bf..812d5176b8 100644 --- a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/app/plugin/assembler/sleigh/x64AssemblyTest.java +++ b/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/app/plugin/assembler/sleigh/x64AssemblyTest.java @@ -15,8 +15,7 @@ */ package ghidra.app.plugin.assembler.sleigh; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; import org.junit.Test; @@ -151,8 +150,8 @@ public class x64AssemblyTest extends AbstractAssemblyTest { @Test public void testAssemble_CMP_byte_ptr_m0x006dbeefm_0() { - assertOneCompatRestExact("CMP byte ptr [0x006dbeef],0", "80:3d:e8:be:6d:c0:00", - "CMP byte ptr [0x006dbeef],0x0"); + assertOneCompatRestExact("CMP byte ptr [RIP + -0x3f924118],0", "80:3d:e8:be:6d:c0:00", + "CMP byte ptr [RIP + -0x3f924118],0x0"); } @Test