mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
Merge remote-tracking branch 'origin/GP-4147_d-millar_fixes_for_dbgeng_tests--SQUASHED'
This commit is contained in:
commit
c6499898b9
@ -32,6 +32,7 @@ import ghidra.dbg.target.TargetRegisterBank;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.dbg.target.schema.TargetObjectSchema.ResyncMode;
|
||||
import ghidra.dbg.util.ConversionUtils;
|
||||
import ghidra.docking.settings.FormatSettingsDefinition;
|
||||
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "RegisterContainer",
|
||||
@ -170,7 +171,13 @@ public class DbgModelTargetRegisterContainerImpl extends DbgModelTargetObjectImp
|
||||
|
||||
private void changeAttrs(DbgModelTargetRegister reg, BigInteger value) {
|
||||
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()
|
||||
: reg.getName() + " : " + valstr;
|
||||
reg.changeAttributes(List.of(), Map.of( //
|
||||
|
@ -408,6 +408,9 @@ public class DbgEngTest extends AbstractGhidraHeadlessIntegrationTest {
|
||||
System.out.print(Long.toHexString(offset) + ": ");
|
||||
DebugMemoryBasicInformation info = client.getDataSpaces().queryVirtual(offset);
|
||||
//System.out.println(info);
|
||||
if (info == null) {
|
||||
break;
|
||||
}
|
||||
System.out.println(Long.toHexString(info.baseAddress) + "-" +
|
||||
Long.toHexString(info.regionSize) + ": " + info.state);
|
||||
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() {
|
||||
try (ProcMaker maker = new ProcMaker("notepad")) {
|
||||
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 {
|
||||
final String specimenX = "C:\\windows\\write.exe";
|
||||
final String specimenA = "C:\\windows\\notepad.exe";
|
||||
@ -848,7 +851,7 @@ public class DbgEngTest extends AbstractGhidraHeadlessIntegrationTest {
|
||||
|
||||
//System.out.println("Attaching...");
|
||||
//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(DebugEngCreateFlags.DEBUG_ECREATE_PROCESS_DEFAULT),
|
||||
BitmaskSet.of(DebugVerifierFlags.DEBUG_VERIFIER_DEFAULT));
|
||||
|
@ -124,7 +124,7 @@ public abstract class AbstractDebuggerModelTest extends AbstractGhidraHeadedInte
|
||||
* @throws Throwable if anything goes wrong
|
||||
*/
|
||||
protected TargetMemory findMemory(List<String> seedPath) throws Throwable {
|
||||
return m.find(TargetMemory.class, seedPath);
|
||||
return m.suitable(TargetMemory.class, seedPath);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user