GP-0 corrected various test failures

This commit is contained in:
ghidra1 2023-01-06 17:32:16 -05:00
parent 68b9cb54e4
commit 0f3bb2acee
6 changed files with 15 additions and 20 deletions

View file

@ -256,7 +256,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
false); false);
// NOTE: qword ptr [0x00600800] is RIP-relative // 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); memory.setLong(addr(program, 0x00600800), 0xdeadbeefcafebabeL);
} }

View file

@ -327,7 +327,7 @@ public class BytesTracePcodeEmulatorTest extends AbstractTracePcodeEmulatorTest
""", """,
List.of( List.of(
// First instruction undoes the modification above // 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 "MOV EAX,0xdeadbeef")); // 5 bytes
BytesTracePcodeEmulator emu = new BytesTracePcodeEmulator(tb.host, 0); BytesTracePcodeEmulator emu = new BytesTracePcodeEmulator(tb.host, 0);
@ -600,7 +600,7 @@ public class BytesTracePcodeEmulatorTest extends AbstractTracePcodeEmulatorTest
*:8 0x00600000:8 = 0xfedcba9876543210; *:8 0x00600000:8 = 0xfedcba9876543210;
""", """,
List.of( List.of(
"MOVAPS XMM0, xmmword ptr [0x00600000]")); "MOVAPS XMM0, xmmword ptr [RIP + 0x1ffff9]"));
BytesTracePcodeEmulator emu = new BytesTracePcodeEmulator(tb.host, 0); BytesTracePcodeEmulator emu = new BytesTracePcodeEmulator(tb.host, 0);
PcodeThread<byte[]> emuThread = emu.newThread(thread.getPath()); PcodeThread<byte[]> emuThread = emu.newThread(thread.getPath());

View file

@ -15,8 +15,7 @@
*/ */
package ghidra.pcode.emu.taint.full; package ghidra.pcode.emu.taint.full;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;
import java.util.Set; import java.util.Set;
@ -120,7 +119,7 @@ public class TaintDebuggerPcodeEmulatorTest extends AbstractGhidraHeadedDebugger
Assembler asm = Assemblers.getAssembler(program); Assembler asm = Assemblers.getAssembler(program);
// NOTE: qword ptr [0x00400800] is RIP-relative // 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"); TraceSchedule time = TraceSchedule.parse("0:t0-1");

View file

@ -114,7 +114,7 @@ public abstract class CompositeEditorModel extends CompositeViewerModel implemen
hadChanges = false; hadChanges = false;
if (lastCompositeId != originalCompositeId) { if (originalCompositeId == -1 || lastCompositeId != originalCompositeId) {
// only clear the selection if loading a new type // only clear the selection if loading a new type
setSelection(new FieldSelection()); setSelection(new FieldSelection());
} }

View file

@ -118,18 +118,15 @@ public class StackEditorModel extends CompositeEditorModel {
return false; return false;
} }
StackFrameDataType sfdt = (StackFrameDataType) viewComposite; StackFrameDataType sfdt = (StackFrameDataType) viewComposite;
int editFrameSize = sfdt.getLength();
int editReturnAddressOffset = sfdt.getReturnAddressOffset(); int editReturnAddressOffset = sfdt.getReturnAddressOffset();
int editLocalSize = sfdt.getLocalSize(); int editLocalSize = sfdt.getLocalSize();
int editParamOffset = sfdt.getParameterOffset(); int editParamOffset = sfdt.getParameterOffset();
int editParamSize = sfdt.getParameterSize(); int editParamSize = sfdt.getParameterSize();
int stackFrameSize = sfdt.getLength(); int stackReturnAddressOffset = originalStack.getReturnAddressOffset();
int stackReturnAddressOffset = sfdt.getReturnAddressOffset(); int stackLocalSize = originalStack.getLocalSize();
int stackLocalSize = sfdt.getLocalSize(); int stackParamOffset = originalStack.getParameterOffset();
int stackParamOffset = sfdt.getParameterOffset(); int stackParamSize = originalStack.getParameterSize();
int stackParamSize = sfdt.getParameterSize(); hadChanges = (editReturnAddressOffset != stackReturnAddressOffset) ||
hadChanges = (editFrameSize != stackFrameSize) ||
(editReturnAddressOffset != stackReturnAddressOffset) ||
(editLocalSize != stackLocalSize) || (editParamOffset != stackParamOffset) || (editLocalSize != stackLocalSize) || (editParamOffset != stackParamOffset) ||
(editParamSize != stackParamSize) || super.updateAndCheckChangeState(); (editParamSize != stackParamSize) || super.updateAndCheckChangeState();
return hadChanges; return hadChanges;
@ -932,7 +929,7 @@ public class StackEditorModel extends CompositeEditorModel {
if (!isValidName() || !hasChanges()) { if (!isValidName() || !hasChanges()) {
return false; return false;
} }
StackFrame original = getOriginalStack(); StackFrame original = getOriginalStack(); // FIXME: Not Needed - use originalStack
Function function = original.getFunction(); Function function = original.getFunction();
StackFrameDataType edited = getEditorStack(); StackFrameDataType edited = getEditorStack();

View file

@ -15,8 +15,7 @@
*/ */
package ghidra.app.plugin.assembler.sleigh; package ghidra.app.plugin.assembler.sleigh;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.*;
import static org.junit.Assert.fail;
import org.junit.Test; import org.junit.Test;
@ -151,8 +150,8 @@ public class x64AssemblyTest extends AbstractAssemblyTest {
@Test @Test
public void testAssemble_CMP_byte_ptr_m0x006dbeefm_0() { public void testAssemble_CMP_byte_ptr_m0x006dbeefm_0() {
assertOneCompatRestExact("CMP byte ptr [0x006dbeef],0", "80:3d:e8:be:6d:c0:00", assertOneCompatRestExact("CMP byte ptr [RIP + -0x3f924118],0", "80:3d:e8:be:6d:c0:00",
"CMP byte ptr [0x006dbeef],0x0"); "CMP byte ptr [RIP + -0x3f924118],0x0");
} }
@Test @Test