mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-04-25 17:25:17 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
@@ -233,7 +233,7 @@ public class ExporterDialog extends DialogComponentProvider implements AddressFa
|
||||
return "Unexpected exception validating options: " + e.getMessage();
|
||||
}
|
||||
};
|
||||
AddressFactoryService svc = (domainObject instanceof Program) ? null : this;
|
||||
AddressFactoryService svc = (domainObject instanceof Program) ? this : null;
|
||||
OptionsDialog optionsDialog = new OptionsDialog(options, validator, svc);
|
||||
optionsDialog
|
||||
.setHelpLocation(new HelpLocation("ExporterPlugin", getAnchorForSelectedFormat()));
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -150,15 +150,10 @@ public class IntelHexExporter extends Exporter {
|
||||
|
||||
log.clear();
|
||||
|
||||
if (!(domainObj instanceof Program)) {
|
||||
if (!(domainObj instanceof Program program)) {
|
||||
log.appendMsg("Unsupported type: " + domainObj.getClass().getName());
|
||||
return false;
|
||||
}
|
||||
Program program = (Program) domainObj;
|
||||
if (program.getMaxAddress().getSize() > 32) {
|
||||
log.appendMsg("Cannot be used for programs larger than 32 bits");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (addressSpaceOption == null || recordSizeOption == null) {
|
||||
getOptions(() -> program);
|
||||
@@ -168,12 +163,23 @@ public class IntelHexExporter extends Exporter {
|
||||
|
||||
Memory memory = program.getMemory();
|
||||
|
||||
if (addrSet == null) {
|
||||
addrSet = memory;
|
||||
AddressSet set = new AddressSet(addrSet != null ? addrSet : memory);
|
||||
|
||||
for (MemoryBlock block : memory.getBlocks()) {
|
||||
if (!block.isInitialized() ||
|
||||
block.getStart().getAddressSpace() != addressSpaceOption.getValue()) {
|
||||
set.delete(new AddressRangeImpl(block.getStart(), block.getEnd()));
|
||||
}
|
||||
}
|
||||
|
||||
Address maxAddr = set.getMaxAddress();
|
||||
if (maxAddr != null && maxAddr.getSize() > 32) {
|
||||
log.appendMsg("Cannot be used for address spaces larger than 32 bits");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
List<IntelHexRecord> records = dumpMemory(program, memory, addrSet, monitor);
|
||||
List<IntelHexRecord> records = dumpMemory(program, memory, set, monitor);
|
||||
for (IntelHexRecord record : records) {
|
||||
writer.println(record.format());
|
||||
}
|
||||
@@ -198,17 +204,7 @@ public class IntelHexExporter extends Exporter {
|
||||
|
||||
IntelHexRecordWriter writer = new IntelHexRecordWriter(size, dropBytes);
|
||||
|
||||
AddressSet set = new AddressSet(addrSetView);
|
||||
|
||||
MemoryBlock[] blocks = memory.getBlocks();
|
||||
for (MemoryBlock block : blocks) {
|
||||
if (!block.isInitialized() ||
|
||||
block.getStart().getAddressSpace() != addressSpaceOption.getValue()) {
|
||||
set.delete(new AddressRangeImpl(block.getStart(), block.getEnd()));
|
||||
}
|
||||
}
|
||||
|
||||
AddressIterator addresses = set.getAddresses(true);
|
||||
AddressIterator addresses = addrSetView.getAddresses(true);
|
||||
while (addresses.hasNext()) {
|
||||
Address address = addresses.next();
|
||||
byte b = memory.getByte(address);
|
||||
@@ -220,7 +216,7 @@ public class IntelHexExporter extends Exporter {
|
||||
program.getSymbolTable().getExternalEntryPointIterator();
|
||||
while (entryPoint == null && entryPointIterator.hasNext()) {
|
||||
Address address = entryPointIterator.next();
|
||||
if (set.contains(address)) {
|
||||
if (addrSetView.contains(address)) {
|
||||
entryPoint = address;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1209,16 +1209,15 @@ public class CppCompositeType {
|
||||
* @throws CancelledException upon user cancellation
|
||||
*/
|
||||
private void createMembersOnlyClassLayout(TaskMonitor monitor) throws CancelledException {
|
||||
TreeMap<Long, ClassPdbMember> map = new TreeMap<>();
|
||||
List<ClassPdbMember> pdbMembers = new ArrayList<>();
|
||||
for (Member member : layoutMembers) {
|
||||
ClassPdbMember classPdbMember =
|
||||
new ClassPdbMember(member.getName(), member.getDataType(),
|
||||
member.isFlexibleArray(), member.getOffset(), member.getComment());
|
||||
map.put((long) member.getOffset(), classPdbMember);
|
||||
pdbMembers.add(classPdbMember);
|
||||
}
|
||||
List<ClassPdbMember> sm = new ArrayList<>(map.values());
|
||||
if (!DefaultCompositeMember.applyDataTypeMembers(composite, false, false, size,
|
||||
sm, msg -> Msg.warn(this, msg), monitor)) {
|
||||
pdbMembers, msg -> Msg.warn(this, msg), monitor)) {
|
||||
clearComponents(composite);
|
||||
}
|
||||
selfBaseType = composite;
|
||||
|
||||
Reference in New Issue
Block a user