mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-27 20:17:32 +08:00
GhidraDev new module project wizard can now optionally include/exclude
processor. Also fixed building processor using buildLanguage.xml.
This commit is contained in:
+12
-4
@@ -42,7 +42,8 @@ public class GhidraModuleUtils {
|
|||||||
PLUGIN("Plugin", "Extends the Ghidra user interface"),
|
PLUGIN("Plugin", "Extends the Ghidra user interface"),
|
||||||
LOADER("Loader", "Loads/imports a binary file format into Ghidra"),
|
LOADER("Loader", "Loads/imports a binary file format into Ghidra"),
|
||||||
FILESYSTEM("FileSystem", "Opens a file system format for browsing or batch import"),
|
FILESYSTEM("FileSystem", "Opens a file system format for browsing or batch import"),
|
||||||
EXPORTER("Exporter", "Exports/saves a Ghidra program to a specific file format");
|
EXPORTER("Exporter", "Exports/saves a Ghidra program to a specific file format"),
|
||||||
|
PROCESSOR("Processor", "Enables disassembly/decompilation of a processor/architecture");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
@@ -136,7 +137,14 @@ public class GhidraModuleUtils {
|
|||||||
List<String> excludeRegexes = new ArrayList<>();
|
List<String> excludeRegexes = new ArrayList<>();
|
||||||
for (ModuleTemplateType moduleTemplateType : ModuleTemplateType.values()) {
|
for (ModuleTemplateType moduleTemplateType : ModuleTemplateType.values()) {
|
||||||
if (!moduleTemplateTypes.contains(moduleTemplateType)) {
|
if (!moduleTemplateTypes.contains(moduleTemplateType)) {
|
||||||
excludeRegexes.add(SKELETON_CLASS + moduleTemplateType.getName() + "\\.java");
|
if (moduleTemplateType.equals(ModuleTemplateType.PROCESSOR)) {
|
||||||
|
excludeRegexes.add("languages");
|
||||||
|
excludeRegexes.add("buildLanguage\\.xml");
|
||||||
|
excludeRegexes.add("sleighArgs\\.txt");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
excludeRegexes.add(SKELETON_CLASS + moduleTemplateType.getName() + "\\.java");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +207,7 @@ public class GhidraModuleUtils {
|
|||||||
* Writes project-specific ant properties, which get imported by the module project's language
|
* Writes project-specific ant properties, which get imported by the module project's language
|
||||||
* build.xml file to allow building against a Ghidra that lives in an external location. If the
|
* build.xml file to allow building against a Ghidra that lives in an external location. If the
|
||||||
* given project is not a Ghidra module project, or if the Ghidra module project does not have a
|
* given project is not a Ghidra module project, or if the Ghidra module project does not have a
|
||||||
* language build.xml ant file, this method has no effect.
|
* language buildLanguage.xml ant file, this method has no effect.
|
||||||
*
|
*
|
||||||
* @param project The project to receive the ant properties.
|
* @param project The project to receive the ant properties.
|
||||||
* @param ghidraLayout The layout that contains the Ghidra installation directory that the project
|
* @param ghidraLayout The layout that contains the Ghidra installation directory that the project
|
||||||
@@ -216,7 +224,7 @@ public class GhidraModuleUtils {
|
|||||||
if (!dataFolder.exists()) {
|
if (!dataFolder.exists()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IFile buildXmlFile = dataFolder.getFile("build.xml");
|
IFile buildXmlFile = dataFolder.getFile("buildLanguage.xml");
|
||||||
if (!buildXmlFile.exists()) {
|
if (!buildXmlFile.exists()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -49,12 +49,12 @@ public class ConfigureGhidraModuleProjectWizardPage extends WizardPage {
|
|||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
|
|
||||||
Composite container = new Composite(parent, SWT.NULL);
|
Composite container = new Composite(parent, SWT.NULL);
|
||||||
container.setLayout(new GridLayout(2, false));
|
container.setLayout(new GridLayout(1, false));
|
||||||
|
|
||||||
Label moduleTemplateLabel = new Label(container, SWT.NULL);
|
Label moduleTemplateLabel = new Label(container, SWT.NULL);
|
||||||
moduleTemplateLabel.setText("Module template:");
|
moduleTemplateLabel.setText("Module template:");
|
||||||
Group moduleTemplateGroup = new Group(container, SWT.SHADOW_ETCHED_OUT);
|
Group moduleTemplateGroup = new Group(container, SWT.SHADOW_ETCHED_OUT);
|
||||||
moduleTemplateGroup.setLayout(new RowLayout(SWT.HORIZONTAL));
|
moduleTemplateGroup.setLayout(new RowLayout(SWT.VERTICAL));
|
||||||
|
|
||||||
SelectionListener selectionListener = new SelectionListener() {
|
SelectionListener selectionListener = new SelectionListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -71,7 +71,8 @@ public class ConfigureGhidraModuleProjectWizardPage extends WizardPage {
|
|||||||
for (ModuleTemplateType moduleTemplateType : ModuleTemplateType.values()) {
|
for (ModuleTemplateType moduleTemplateType : ModuleTemplateType.values()) {
|
||||||
Button checkboxButton = new Button(moduleTemplateGroup, SWT.CHECK);
|
Button checkboxButton = new Button(moduleTemplateGroup, SWT.CHECK);
|
||||||
checkboxButton.setSelection(true);
|
checkboxButton.setSelection(true);
|
||||||
checkboxButton.setText(moduleTemplateType.getName());
|
checkboxButton.setText(
|
||||||
|
moduleTemplateType.getName() + " - " + moduleTemplateType.getDescription());
|
||||||
checkboxButton.setToolTipText(moduleTemplateType.getDescription());
|
checkboxButton.setToolTipText(moduleTemplateType.getDescription());
|
||||||
checkboxButton.addSelectionListener(selectionListener);
|
checkboxButton.addSelectionListener(selectionListener);
|
||||||
moduleTemplateCheckboxMap.put(checkboxButton, moduleTemplateType);
|
moduleTemplateCheckboxMap.put(checkboxButton, moduleTemplateType);
|
||||||
|
|||||||
Reference in New Issue
Block a user