mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
GT-3223_emteere code review changes
This commit is contained in:
parent
9c3ae59860
commit
136c41c027
2 changed files with 22 additions and 3 deletions
|
@ -366,8 +366,13 @@ public class MemoryManagerTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
block = mem.getBlock("NoExist");
|
||||
assertNull(block);
|
||||
|
||||
program.endTransaction(transactionID, true);
|
||||
transactionID = program.startTransaction("Test");
|
||||
|
||||
// now exists
|
||||
mem.getBlock("Test1").setName("NoExist");
|
||||
// Test1 no longer exists
|
||||
assertNull("block deleted", mem.getBlock("Test1"));
|
||||
block = mem.getBlock("NoExist");
|
||||
assertEquals("NoExist", block.getName());
|
||||
|
||||
|
@ -375,11 +380,22 @@ public class MemoryManagerTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
block = mem.getBlock("NoExist");
|
||||
assertNull("block should be deleted", block);
|
||||
|
||||
// Test1 still doesn't exist
|
||||
block = mem.getBlock("Test1");
|
||||
assertNull("block deleted", block);
|
||||
|
||||
block = mem.getBlock("Test2");
|
||||
assertEquals("Test2", block.getName());
|
||||
|
||||
program.endTransaction(transactionID, true);
|
||||
|
||||
program.undo();
|
||||
|
||||
// Test1 still doesn't exist
|
||||
block = mem.getBlock("Test1");
|
||||
assertNotNull("Undo, Test1 exists again", block);
|
||||
|
||||
transactionID = program.startTransaction("Test");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -309,10 +309,13 @@ public class MemoryMapDB implements Memory, ManagerDB, LiveMemoryListener {
|
|||
public synchronized MemoryBlock getBlock(String blockName) {
|
||||
// find block that might have been cached from previous call
|
||||
MemoryBlock memoryBlock = nameBlockMap.get(blockName);
|
||||
if (memoryBlock != null) {
|
||||
if (memoryBlock == NoBlock) {
|
||||
// found placeholder, have searched and found nothing before
|
||||
return null;
|
||||
}
|
||||
return memoryBlock;
|
||||
}
|
||||
|
||||
for (MemoryBlock block : blocks) {
|
||||
if (block.getName().equals(blockName)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue