mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-10-03 00:44:52 +00:00
GP-3612 Always use program architecture when parsing header files to
program
This commit is contained in:
parent
76c52ba9a4
commit
081f1a6338
|
@ -41,6 +41,7 @@ import ghidra.framework.plugintool.PluginTool;
|
|||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.database.data.ProgramDataTypeManager;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.lang.LanguageCompilerSpecPair;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
|
@ -300,16 +301,25 @@ public class CParserPlugin extends ProgramPlugin {
|
|||
|
||||
/*
|
||||
* Parse into the current programs data type manager
|
||||
*
|
||||
* Always uses the program's processor architecture
|
||||
*/
|
||||
protected void parse(String[] filenames, String[] includePaths, String options,
|
||||
String languageIDString, String compilerIDString) {
|
||||
protected void parse(String[] filenames, String[] includePaths, String options) {
|
||||
if (currentProgram == null) {
|
||||
Msg.showInfo(getClass(), parseDialog.getComponent(), "No Open Program",
|
||||
"A program must be open to \"Parse to Program\"");
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* always use the processor/compiler for the program when parsing to program
|
||||
*/
|
||||
LanguageCompilerSpecPair languageCompilerSpecPair = currentProgram.getLanguageCompilerSpecPair();
|
||||
String procID = languageCompilerSpecPair.languageID.getIdAsString();
|
||||
String compilerID = languageCompilerSpecPair.compilerSpecID.getIdAsString();
|
||||
|
||||
int result = OptionDialog.showOptionDialog(parseDialog.getComponent(), "Confirm",
|
||||
"Parse C source to \"" + currentProgram.getDomainFile().getName() + "\"?", "Continue");
|
||||
"Parse C source to \"" + currentProgram.getDomainFile().getName() + "\"?" + "\n\n" +
|
||||
"Using program architecture: " + procID + " / " + compilerID, "Continue");
|
||||
|
||||
if (result == OptionDialog.CANCEL_OPTION) {
|
||||
return;
|
||||
|
@ -320,8 +330,8 @@ public class CParserPlugin extends ProgramPlugin {
|
|||
.setFileNames(filenames)
|
||||
.setIncludePaths(includePaths)
|
||||
.setOptions(options)
|
||||
.setLanguageID(languageIDString)
|
||||
.setCompilerID(compilerIDString);
|
||||
.setLanguageID(procID)
|
||||
.setCompilerID(compilerID);
|
||||
|
||||
tool.execute(parseTask);
|
||||
}
|
||||
|
|
|
@ -804,22 +804,22 @@ class ParseDialog extends ReusableDialogComponentProvider {
|
|||
paths = expandPaths(paths);
|
||||
pathPanel.setPaths(paths);
|
||||
|
||||
if (languageIDString == null || compilerIDString == null) {
|
||||
Msg.showWarn(getClass(), rootPanel, "Program Architecture not Specified",
|
||||
"A Program Architecture must be specified in order to parse to a file.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (parseToFile) {
|
||||
if (parseToFile) {
|
||||
if (languageIDString == null || compilerIDString == null) {
|
||||
Msg.showWarn(getClass(), rootPanel, "Program Architecture not Specified",
|
||||
"A Program Architecture must be specified in order to parse to a file.");
|
||||
return;
|
||||
}
|
||||
|
||||
File file = getSaveFile();
|
||||
if (file != null) {
|
||||
plugin.parse(paths, includePaths, options, languageIDString, compilerIDString,
|
||||
file.getAbsolutePath());
|
||||
}
|
||||
return;
|
||||
}
|
||||
else {
|
||||
plugin.parse(paths, includePaths, options, languageIDString, compilerIDString);
|
||||
}
|
||||
|
||||
plugin.parse(paths, includePaths, options);
|
||||
}
|
||||
|
||||
private String[] expandPaths(String[] paths) {
|
||||
|
|
Loading…
Reference in a new issue