mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GP-0 improved error logging for ApplyDataArchiveAnalyzer
This commit is contained in:
parent
b0a2791826
commit
b7c7120f0f
2 changed files with 17 additions and 9 deletions
|
@ -27,7 +27,7 @@ import ghidra.program.model.address.AddressSetView;
|
|||
import ghidra.program.model.data.DataTypeManager;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.symbol.SourceType;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.VersionException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
public class ApplyDataArchiveAnalyzer extends AbstractAnalyzer {
|
||||
|
@ -67,7 +67,7 @@ public class ApplyDataArchiveAnalyzer extends AbstractAnalyzer {
|
|||
try {
|
||||
dtm = service.openDataTypeArchive(archiveName);
|
||||
if (dtm == null) {
|
||||
Msg.showError(this, null, "Failed to Apply Data Types",
|
||||
log.appendMsg("Apply Data Archives",
|
||||
"Failed to locate data type archive: " + archiveName);
|
||||
}
|
||||
else {
|
||||
|
@ -75,8 +75,18 @@ public class ApplyDataArchiveAnalyzer extends AbstractAnalyzer {
|
|||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (mgr.debugOn) {
|
||||
Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);
|
||||
Throwable cause = e.getCause();
|
||||
if (cause instanceof VersionException) {
|
||||
log.appendMsg("Apply Data Archives",
|
||||
"Unable to open archive " + archiveName + ": " + cause.toString());
|
||||
}
|
||||
else {
|
||||
String msg = e.getMessage();
|
||||
if (msg == null) {
|
||||
msg = e.toString();
|
||||
}
|
||||
log.appendMsg("Apply Data Archives",
|
||||
"Unexpected Error opening archive " + archiveName + ": " + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -438,10 +438,8 @@ public class DataTypeManagerHandler {
|
|||
addArchive(archive);
|
||||
}
|
||||
if (isUserAction && (archive instanceof FileArchive)) {
|
||||
if (file != null) {
|
||||
userOpenedFileArchiveNames.add(getSaveableArchive(file.getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
return archive;
|
||||
}
|
||||
|
||||
|
@ -1251,8 +1249,8 @@ public class DataTypeManagerHandler {
|
|||
|
||||
public Set<String> getPossibleEquateNames(long value) {
|
||||
Set<String> equateNames = new HashSet<>();
|
||||
for (int i = 0; i < openArchives.size(); i++) {
|
||||
DataTypeManager dtMgr = openArchives.get(i).getDataTypeManager();
|
||||
for (Archive element : openArchives) {
|
||||
DataTypeManager dtMgr = element.getDataTypeManager();
|
||||
dtMgr.findEnumValueNames(value, equateNames);
|
||||
}
|
||||
return equateNames;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue