mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-30 07:09:41 +08:00
GP-6630: Index TraceMemoryState by full lifespan of 'most-recent' effect.
This commit is contained in:
+4
-6
@@ -17,7 +17,7 @@ package agent.gdb.rmi;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.*;
|
||||
import static org.junit.Assume.assumeFalse;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
@@ -247,13 +247,11 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {
|
||||
quit
|
||||
""".formatted(PREAMBLE, target));
|
||||
String importSection = extractOutSection(out, "---Import---");
|
||||
assertTrue(importSection.contains(
|
||||
"""
|
||||
assertTrue(importSection.contains("""
|
||||
Selected Ghidra language: x86:LE:32:default
|
||||
Selected Ghidra compiler: %s""".formatted(PLAT.cSpec())));
|
||||
String fileSection = extractOutSection(out, "---File---");
|
||||
assertTrue(fileSection.contains(
|
||||
"""
|
||||
assertTrue(fileSection.contains("""
|
||||
Selected Ghidra language: %s
|
||||
Selected Ghidra compiler: %s""".formatted(PLAT.lang(), PLAT.cSpec())));
|
||||
assertEquals("""
|
||||
@@ -425,7 +423,7 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {
|
||||
Entry<TraceAddressSnapRange, TraceMemoryState> entry =
|
||||
tb.trace.getMemoryManager().getMostRecentStateEntry(snap, addr);
|
||||
assertEquals(Map.entry(new ImmutableTraceAddressSnapRange(
|
||||
quantize(rng(addr, 10), 4096), Lifespan.at(0)), TraceMemoryState.ERROR), entry);
|
||||
quantize(rng(addr, 10), 4096), Lifespan.nowOn(0)), TraceMemoryState.ERROR), entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+17
-19
@@ -17,7 +17,7 @@ package agent.lldb.rmi;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.*;
|
||||
import static org.junit.Assume.assumeFalse;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
@@ -384,7 +384,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {
|
||||
Entry<TraceAddressSnapRange, TraceMemoryState> entry =
|
||||
tb.trace.getMemoryManager().getMostRecentStateEntry(snap, addr);
|
||||
assertEquals(Map.entry(new ImmutableTraceAddressSnapRange(
|
||||
quantize(rng(addr, 10), 4096), Lifespan.at(0)), TraceMemoryState.ERROR), entry);
|
||||
quantize(rng(addr, 10), 4096), Lifespan.nowOn(0)), TraceMemoryState.ERROR), entry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -900,18 +900,17 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {
|
||||
""".formatted(PREAMBLE, addr, getSpecimenPrint()));
|
||||
try (ManagedDomainObject mdo = openDomainObject(projectName("expPrint"))) {
|
||||
tb = new ToyDBTraceBuilder((Trace) mdo.get());
|
||||
assertEquals(
|
||||
"""
|
||||
Parent Key Span Value Type
|
||||
Test.Objects[1] vaddr [0,+inf) ram:0000dead ADDRESS
|
||||
Test.Objects[1] vbool [0,+inf) True BOOL
|
||||
Test.Objects[1] vbyte [0,+inf) 1 BYTE
|
||||
Test.Objects[1] vchar [0,+inf) 'A' CHAR
|
||||
Test.Objects[1] vint [0,+inf) 3 INT
|
||||
Test.Objects[1] vlong [0,+inf) 4 LONG
|
||||
Test.Objects[1] vobj [0,+inf) Test.Objects[1] OBJECT
|
||||
Test.Objects[1] vshort [0,+inf) 2 SHORT\
|
||||
""",
|
||||
assertEquals("""
|
||||
Parent Key Span Value Type
|
||||
Test.Objects[1] vaddr [0,+inf) ram:0000dead ADDRESS
|
||||
Test.Objects[1] vbool [0,+inf) True BOOL
|
||||
Test.Objects[1] vbyte [0,+inf) 1 BYTE
|
||||
Test.Objects[1] vchar [0,+inf) 'A' CHAR
|
||||
Test.Objects[1] vint [0,+inf) 3 INT
|
||||
Test.Objects[1] vlong [0,+inf) 4 LONG
|
||||
Test.Objects[1] vobj [0,+inf) Test.Objects[1] OBJECT
|
||||
Test.Objects[1] vshort [0,+inf) 2 SHORT\
|
||||
""",
|
||||
extractOutSection(out, "---GetValues---"));
|
||||
}
|
||||
}
|
||||
@@ -939,11 +938,10 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {
|
||||
""".formatted(PREAMBLE, addr, getSpecimenPrint()));
|
||||
try (ManagedDomainObject mdo = openDomainObject(projectName("expPrint"))) {
|
||||
tb = new ToyDBTraceBuilder((Trace) mdo.get());
|
||||
assertTrue(extractOutSectionWithPrompt(out, "---GetValues---").contains(
|
||||
"""
|
||||
Parent Key Span Value Type
|
||||
Test.Objects[1] vaddr [0,+inf) ram:0000dead ADDRESS\
|
||||
"""));
|
||||
assertTrue(extractOutSectionWithPrompt(out, "---GetValues---").contains("""
|
||||
Parent Key Span Value Type
|
||||
Test.Objects[1] vaddr [0,+inf) ram:0000dead ADDRESS\
|
||||
"""));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user