fixed bug in intel hex importer

This commit is contained in:
ghidravore 2019-08-01 13:12:28 -04:00
parent fc3146ba91
commit 6e59716a50
5 changed files with 18 additions and 7 deletions

View file

@ -295,7 +295,7 @@ public class MemoryBlockUtils {
} }
setBlockAttributes(block, comment, source, r, w, x); setBlockAttributes(block, comment, source, r, w, x);
adjustFragment(program, block.getStart(), name); adjustFragment(program, block.getStart(), block.getName());
return block; return block;
} }

View file

@ -211,7 +211,7 @@ class IntelHexMemImage {
myRangeMap.remove(range); myRangeMap.remove(range);
} }
String name = blockName; String name = blockName == null ? base.getAddressSpace().getName() : blockName;
while (true) { while (true) {
try { try {
MemoryBlockUtils.createInitializedBlock(program, isOverlay, name, MemoryBlockUtils.createInitializedBlock(program, isOverlay, name,

View file

@ -331,11 +331,10 @@ public class MotorolaHexLoader extends AbstractProgramLoader {
byte[] data = new byte[offset]; byte[] data = new byte[offset];
System.arraycopy(dataBuffer, 0, data, 0, offset); System.arraycopy(dataBuffer, 0, data, 0, offset);
String name = baseAddr.getAddressSpace().getName();
Address start = baseAddr.add(startAddress); Address start = baseAddr.add(startAddress);
name = blockName; String name =
blockName == null ? baseAddr.getAddressSpace().getName() : blockName;
int count = 0; int count = 0;
while (true) { while (true) {
try { try {

View file

@ -116,7 +116,11 @@ public class MemoryBlockDB implements MemoryBlock {
@Override @Override
public String getName() { public String getName() {
return record.getString(MemoryMapDBAdapter.NAME_COL); String name = record.getString(MemoryMapDBAdapter.NAME_COL);
if (name == null) {
name = "";
}
return name;
} }
@Override @Override

View file

@ -471,7 +471,7 @@ public class MemoryMapDB implements Memory, ManagerDB, LiveMemoryListener {
public MemoryBlock createInitializedBlock(String name, Address start, InputStream is, public MemoryBlock createInitializedBlock(String name, Address start, InputStream is,
long length, TaskMonitor monitor, boolean overlay) throws MemoryConflictException, long length, TaskMonitor monitor, boolean overlay) throws MemoryConflictException,
AddressOverflowException, CancelledException, LockException, DuplicateNameException { AddressOverflowException, CancelledException, LockException, DuplicateNameException {
Objects.requireNonNull(name);
lock.acquire(); lock.acquire();
try { try {
checkBlockSize(length, true); checkBlockSize(length, true);
@ -513,6 +513,7 @@ public class MemoryMapDB implements Memory, ManagerDB, LiveMemoryListener {
long offset, long length, boolean overlay) throws LockException, DuplicateNameException, long offset, long length, boolean overlay) throws LockException, DuplicateNameException,
MemoryConflictException, AddressOverflowException { MemoryConflictException, AddressOverflowException {
Objects.requireNonNull(name);
lock.acquire(); lock.acquire();
try { try {
checkBlockSize(length, true); checkBlockSize(length, true);
@ -565,6 +566,7 @@ public class MemoryMapDB implements Memory, ManagerDB, LiveMemoryListener {
boolean overlay) throws MemoryConflictException, AddressOverflowException, boolean overlay) throws MemoryConflictException, AddressOverflowException,
LockException, DuplicateNameException { LockException, DuplicateNameException {
Objects.requireNonNull(name);
lock.acquire(); lock.acquire();
try { try {
checkBlockSize(size, false); checkBlockSize(size, false);
@ -598,6 +600,8 @@ public class MemoryMapDB implements Memory, ManagerDB, LiveMemoryListener {
@Override @Override
public MemoryBlock createBitMappedBlock(String name, Address start, Address overlayAddress, public MemoryBlock createBitMappedBlock(String name, Address start, Address overlayAddress,
long length) throws MemoryConflictException, AddressOverflowException, LockException { long length) throws MemoryConflictException, AddressOverflowException, LockException {
Objects.requireNonNull(name);
lock.acquire(); lock.acquire();
try { try {
checkBlockSize(length, false); checkBlockSize(length, false);
@ -625,6 +629,8 @@ public class MemoryMapDB implements Memory, ManagerDB, LiveMemoryListener {
@Override @Override
public MemoryBlock createByteMappedBlock(String name, Address start, Address overlayAddress, public MemoryBlock createByteMappedBlock(String name, Address start, Address overlayAddress,
long length) throws MemoryConflictException, AddressOverflowException, LockException { long length) throws MemoryConflictException, AddressOverflowException, LockException {
Objects.requireNonNull(name);
lock.acquire(); lock.acquire();
try { try {
checkBlockSize(length, false); checkBlockSize(length, false);
@ -653,6 +659,8 @@ public class MemoryMapDB implements Memory, ManagerDB, LiveMemoryListener {
@Override @Override
public MemoryBlock createBlock(MemoryBlock block, String name, Address start, long length) public MemoryBlock createBlock(MemoryBlock block, String name, Address start, long length)
throws MemoryConflictException, AddressOverflowException, LockException { throws MemoryConflictException, AddressOverflowException, LockException {
Objects.requireNonNull(name);
lock.acquire(); lock.acquire();
try { try {
checkBlockSize(length, block.isInitialized()); checkBlockSize(length, block.isInitialized());