mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-02 05:57:56 +08:00
Merge remote-tracking branch 'origin/GP-1140_ghizard_Improve_AbstractProgramLoader_error_reporting_for_createFile' into patch
This commit is contained in:
+17
-5
@@ -179,8 +179,7 @@ public abstract class AbstractProgramLoader implements Loader {
|
|||||||
public List<Option> getDefaultOptions(ByteProvider provider, LoadSpec loadSpec,
|
public List<Option> getDefaultOptions(ByteProvider provider, LoadSpec loadSpec,
|
||||||
DomainObject domainObject, boolean isLoadIntoProgram) {
|
DomainObject domainObject, boolean isLoadIntoProgram) {
|
||||||
ArrayList<Option> list = new ArrayList<>();
|
ArrayList<Option> list = new ArrayList<>();
|
||||||
list.add(new Option(APPLY_LABELS_OPTION_NAME,
|
list.add(new Option(APPLY_LABELS_OPTION_NAME, shouldApplyProcessorLabelsByDefault(),
|
||||||
shouldApplyProcessorLabelsByDefault(),
|
|
||||||
Boolean.class, Loader.COMMAND_LINE_ARG_PREFIX + "-applyLabels"));
|
Boolean.class, Loader.COMMAND_LINE_ARG_PREFIX + "-applyLabels"));
|
||||||
list.add(new Option(ANCHOR_LABELS_OPTION_NAME, true, Boolean.class,
|
list.add(new Option(ANCHOR_LABELS_OPTION_NAME, true, Boolean.class,
|
||||||
Loader.COMMAND_LINE_ARG_PREFIX + "-anchorLabels"));
|
Loader.COMMAND_LINE_ARG_PREFIX + "-anchorLabels"));
|
||||||
@@ -189,7 +188,8 @@ public abstract class AbstractProgramLoader implements Loader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String validateOptions(ByteProvider provider, LoadSpec loadSpec, List<Option> options, Program program) {
|
public String validateOptions(ByteProvider provider, LoadSpec loadSpec, List<Option> options,
|
||||||
|
Program program) {
|
||||||
if (options != null) {
|
if (options != null) {
|
||||||
for (Option option : options) {
|
for (Option option : options) {
|
||||||
String name = option.getName();
|
String name = option.getName();
|
||||||
@@ -389,6 +389,19 @@ public abstract class AbstractProgramLoader implements Loader {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
Throwable t = e.getCause();
|
||||||
|
if (t == null) {
|
||||||
|
t = e;
|
||||||
|
}
|
||||||
|
String msg = t.getMessage();
|
||||||
|
if (msg == null) {
|
||||||
|
msg = "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg = "\n" + msg;
|
||||||
|
}
|
||||||
|
Msg.showError(this, null, "Create Program Failed",
|
||||||
|
"Failed to create program file: " + uniqueName + msg, e);
|
||||||
messageLog.appendMsg("Unexpected exception creating file: " + uniqueName);
|
messageLog.appendMsg("Unexpected exception creating file: " + uniqueName);
|
||||||
messageLog.appendException(e);
|
messageLog.appendException(e);
|
||||||
return false;
|
return false;
|
||||||
@@ -441,8 +454,7 @@ public abstract class AbstractProgramLoader implements Loader {
|
|||||||
if (info.getScope() != null) {
|
if (info.getScope() != null) {
|
||||||
namespace = info.getScope();
|
namespace = info.getScope();
|
||||||
}
|
}
|
||||||
s = symTable.createLabel(addr, info.getLabel(), namespace,
|
s = symTable.createLabel(addr, info.getLabel(), namespace, info.getSource());
|
||||||
info.getSource());
|
|
||||||
if (info.isEntry()) {
|
if (info.isEntry()) {
|
||||||
symTable.addExternalEntryPoint(addr);
|
symTable.addExternalEntryPoint(addr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user