mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
GP-4147: partial fixes for dbgeng tests
GP-4147: partial fixes for dbgeng tests
This commit is contained in:
parent
1c414dfac5
commit
64694f595c
3 changed files with 15 additions and 5 deletions
|
@ -32,6 +32,7 @@ import ghidra.dbg.target.TargetRegisterBank;
|
||||||
import ghidra.dbg.target.schema.*;
|
import ghidra.dbg.target.schema.*;
|
||||||
import ghidra.dbg.target.schema.TargetObjectSchema.ResyncMode;
|
import ghidra.dbg.target.schema.TargetObjectSchema.ResyncMode;
|
||||||
import ghidra.dbg.util.ConversionUtils;
|
import ghidra.dbg.util.ConversionUtils;
|
||||||
|
import ghidra.docking.settings.FormatSettingsDefinition;
|
||||||
|
|
||||||
@TargetObjectSchemaInfo(
|
@TargetObjectSchemaInfo(
|
||||||
name = "RegisterContainer",
|
name = "RegisterContainer",
|
||||||
|
@ -170,7 +171,13 @@ public class DbgModelTargetRegisterContainerImpl extends DbgModelTargetObjectImp
|
||||||
|
|
||||||
private void changeAttrs(DbgModelTargetRegister reg, BigInteger value) {
|
private void changeAttrs(DbgModelTargetRegister reg, BigInteger value) {
|
||||||
String oldval = (String) reg.getCachedAttributes().get(VALUE_ATTRIBUTE_NAME);
|
String oldval = (String) reg.getCachedAttributes().get(VALUE_ATTRIBUTE_NAME);
|
||||||
String valstr = Long.toUnsignedString(value.longValue(), 16); //value.toString(16);
|
int bitLength = reg.getBitLength();
|
||||||
|
boolean negative = value.signum() < 0;
|
||||||
|
if (negative) {
|
||||||
|
// force use of unsigned value
|
||||||
|
value = value.add(BigInteger.valueOf(2).pow(bitLength));
|
||||||
|
}
|
||||||
|
String valstr = value.toString(16);
|
||||||
String newval = (value.longValue() == 0) ? reg.getName()
|
String newval = (value.longValue() == 0) ? reg.getName()
|
||||||
: reg.getName() + " : " + valstr;
|
: reg.getName() + " : " + valstr;
|
||||||
reg.changeAttributes(List.of(), Map.of( //
|
reg.changeAttributes(List.of(), Map.of( //
|
||||||
|
|
|
@ -408,6 +408,9 @@ public class DbgEngTest extends AbstractGhidraHeadlessIntegrationTest {
|
||||||
System.out.print(Long.toHexString(offset) + ": ");
|
System.out.print(Long.toHexString(offset) + ": ");
|
||||||
DebugMemoryBasicInformation info = client.getDataSpaces().queryVirtual(offset);
|
DebugMemoryBasicInformation info = client.getDataSpaces().queryVirtual(offset);
|
||||||
//System.out.println(info);
|
//System.out.println(info);
|
||||||
|
if (info == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
System.out.println(Long.toHexString(info.baseAddress) + "-" +
|
System.out.println(Long.toHexString(info.baseAddress) + "-" +
|
||||||
Long.toHexString(info.regionSize) + ": " + info.state);
|
Long.toHexString(info.regionSize) + ": " + info.state);
|
||||||
if (info.baseAddress != offset) {
|
if (info.baseAddress != offset) {
|
||||||
|
@ -563,7 +566,7 @@ public class DbgEngTest extends AbstractGhidraHeadlessIntegrationTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test - NOT WORKING, addresses in RW memory still not necessarily writeable (why?)
|
||||||
public void testWriteMemory() {
|
public void testWriteMemory() {
|
||||||
try (ProcMaker maker = new ProcMaker("notepad")) {
|
try (ProcMaker maker = new ProcMaker("notepad")) {
|
||||||
maker.start();
|
maker.start();
|
||||||
|
@ -833,7 +836,7 @@ public class DbgEngTest extends AbstractGhidraHeadlessIntegrationTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test - This test is way broken; the while(true) loop is unexitable
|
||||||
public void testAttachLaunch() throws Exception {
|
public void testAttachLaunch() throws Exception {
|
||||||
final String specimenX = "C:\\windows\\write.exe";
|
final String specimenX = "C:\\windows\\write.exe";
|
||||||
final String specimenA = "C:\\windows\\notepad.exe";
|
final String specimenA = "C:\\windows\\notepad.exe";
|
||||||
|
@ -848,7 +851,7 @@ public class DbgEngTest extends AbstractGhidraHeadlessIntegrationTest {
|
||||||
|
|
||||||
//System.out.println("Attaching...");
|
//System.out.println("Attaching...");
|
||||||
//client.attachProcess(client.getLocalServer(), proc.pid, BitmaskSet.of());
|
//client.attachProcess(client.getLocalServer(), proc.pid, BitmaskSet.of());
|
||||||
client.createProcess(client.getLocalServer(), specimenA, "", "",
|
client.createProcess(client.getLocalServer(), specimenA, null, null,
|
||||||
BitmaskSet.of(DebugCreateFlags.DEBUG_PROCESS),
|
BitmaskSet.of(DebugCreateFlags.DEBUG_PROCESS),
|
||||||
BitmaskSet.of(DebugEngCreateFlags.DEBUG_ECREATE_PROCESS_DEFAULT),
|
BitmaskSet.of(DebugEngCreateFlags.DEBUG_ECREATE_PROCESS_DEFAULT),
|
||||||
BitmaskSet.of(DebugVerifierFlags.DEBUG_VERIFIER_DEFAULT));
|
BitmaskSet.of(DebugVerifierFlags.DEBUG_VERIFIER_DEFAULT));
|
||||||
|
|
|
@ -124,7 +124,7 @@ public abstract class AbstractDebuggerModelTest extends AbstractGhidraHeadedInte
|
||||||
* @throws Throwable if anything goes wrong
|
* @throws Throwable if anything goes wrong
|
||||||
*/
|
*/
|
||||||
protected TargetMemory findMemory(List<String> seedPath) throws Throwable {
|
protected TargetMemory findMemory(List<String> seedPath) throws Throwable {
|
||||||
return m.find(TargetMemory.class, seedPath);
|
return m.suitable(TargetMemory.class, seedPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue