diff --git a/Ghidra/Extensions/SampleTablePlugin/src/main/help/help/shared/Frontpage.css b/Ghidra/Extensions/SampleTablePlugin/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Extensions/SampleTablePlugin/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Extensions/SampleTablePlugin/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Extensions/sample/src/main/help/help/shared/Frontpage.css b/Ghidra/Extensions/sample/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Extensions/sample/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Extensions/sample/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/Base/certification.manifest b/Ghidra/Features/Base/certification.manifest
index f801e96de0..219f7fc8ff 100644
--- a/Ghidra/Features/Base/certification.manifest
+++ b/Ghidra/Features/Base/certification.manifest
@@ -82,7 +82,6 @@ ghidra_scripts/world.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END
src/main/help/help/TOC_Source.xml||GHIDRA||||END|
src/main/help/help/shared/arrow.gif||GHIDRA||||END|
src/main/help/help/shared/close16.gif||GHIDRA||||END|
-src/main/help/help/shared/helpWarning.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
src/main/help/help/shared/menu16.gif||GHIDRA||||END|
src/main/help/help/shared/note-red.png||Oxygen Icons - LGPL 3.0|||renamed from flag-red.png|END|
src/main/help/help/shared/note.png||Oxygen Icons - LGPL 3.0|||renamed from flag-green.png|END|
diff --git a/Ghidra/Features/Base/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/Base/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Features/Base/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Features/Base/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/Base/src/main/help/help/shared/helpWarning.png b/Ghidra/Features/Base/src/main/help/help/shared/helpWarning.png
deleted file mode 100644
index 8e9133789b..0000000000
Binary files a/Ghidra/Features/Base/src/main/help/help/shared/helpWarning.png and /dev/null differ
diff --git a/Ghidra/Features/Base/src/main/help/help/topics/AutoAnalysisPlugin/AutoAnalysis.htm b/Ghidra/Features/Base/src/main/help/help/topics/AutoAnalysisPlugin/AutoAnalysis.htm
index 6080e1a543..fc1f56ae04 100644
--- a/Ghidra/Features/Base/src/main/help/help/topics/AutoAnalysisPlugin/AutoAnalysis.htm
+++ b/Ghidra/Features/Base/src/main/help/help/topics/AutoAnalysisPlugin/AutoAnalysis.htm
@@ -5,7 +5,7 @@
-
+ +-
- User Disassembles
+- The user triggers disassembly
- Function Analyzer - looks at all calls and creates Functions
@@ -34,9 +34,8 @@- Operand Analyzer - looks at scalar operands for possible address references
- Data Reference Analyzer - looks at references for possible strings or pointers to - code.
+ code. References to code are disassembled.
- References to code are disassembled.
- ..... Cycle repeats with 2) as additional code is disassembled.
+ .....The cycle repeats with 2) as additional code is disassembled.One program change might cause several Analyzers to become active, however only one @@ -210,46 +209,46 @@
Options
-
- Create strings containing existing strings - if checked, strings will be +
- Create Strings Containing Existing Strings - if checked, strings will be created even if they contain existing substrings (existing strings will be cleared). The string will be created only if existing strings (a) are wholly contained within the potential string, (b) do not share the same starting address as the potential string, (c) share the same ending address as the potential string, and (d) are the same datatype as the potential string to be created).
-- Create strings containing references - if checked, strings that contain, but +
- Create Strings Containing References - if checked, strings that contain, but do not start with, one or more references will be created.
-- Force model reload - if checked, forces the model to be reloaded every time +
- Force Model Reload - if checked, forces the model to be reloaded every time the analyzer is run (in cases where the user wishes to see the effect of changing a model without restarting Ghidra).
-- Minimum string length - specifies the smallest number of characters in a +
- Minimum String Length - specifies the smallest number of characters in a string for it to be considered a valid string. For this analyzer, null termination characters are ignored for the purposes of counting characters. Note that smaller numbers will result in a larger number of false positives. String length must be at least 4.
-- Model file - Specifies the model file built using the BuildStringModels class +
- Model File - Specifies the model file built using the BuildStringModels class (default is 'StringModel.sng'). Note that the location of the model file does not need to be specified, as models should always be placed in the - 'Ghidra/Features/Base/data/stringngrams' directory.
+<GHIDRA_INSTALL_DIR>/Ghidra/Features/Base/data/stringngrams/directory. -- Require null termination for string - if checked, only null-terminated strings +
- Require Null Termination for String - if checked, only null-terminated strings are created.
-- Search only in accessible memory blocks - if checked, searches only in memory +
- Search Only in Accessible Memory Blocks - if checked, searches only in memory blocks that have at least one of the Read (R), Write (W), or Execute (X) permissions set to true. Enabling this option ensures strings are not created in areas such as overlays or debug sections.
-- String end alignment - specifies the byte alignment requirement for the end of +
- String End Alignment - specifies the byte alignment requirement for the end of the string. An alignment of 1 means the string can end at any address. Alignments greater than 1 require that (a) the 'require null termination' option be enabled, and (b) if the null-terminated string does not end at an aligned boundary, that there exist enough trailing '0' bytes following the string to allow alignment. If neither (a) nor (b) apply, end alignment is not enforced.
-- String start alignment - specifies the byte alignment requirement for the +
- String Start Alignment - specifies the byte alignment requirement for the start of the string. An alignment of 1 means that strings can start at any address. An alignment of 2 means that strings must start on an even address. An alignment of 4 means that strings must start on an address that is a multiple of 4.
@@ -344,7 +343,99 @@ name and create a new primary symbol for the demangled name. It will also assign the appropriate datatypes to the parameters and return type. -Started By: New defined functions
++ The default demangler options are: +
+
+ + + ++ +Name +Description ++ +Apply Function Signatures + ++ Apply any recovered function signature type information + in addition to the function name + ++ +Only Demangle Known Mangled Symbols + ++ Only demangle symbols that follow known compiler mangling patterns. + Leaving this option off may cause non-mangled symbols to get demangled. + ++
+When using an external GNU demangler, + please understand the risks associated with using that version of the + software. The
demangler_gnu_v2_24version of the + demangler is a modified version of GNU'sc++filt (v2.24). The + original version has known vulnerabilities which have been mitigated in + the version created for Ghidra. +
+
The Demangler Analyzer is designed to be extensible.
+ You can extend ghidra.app.plugin.core.analysis.AbstractDemanglerAnalyzer
+ to add your demangler analyzer callback. This allows you to precisely control
+ which demanglers get called, as well as which options are used.
+
Started By: New defined functions
Default implementations of this class exist for Microsoft and GNU. These two analyzers will + * only be enabled when the program being analyzed has an architecture that fits each respective + * analyzer. Users can subclass this analyzer to easily control the demangling behavior from + * the analyzer UI. + * + *
This analyzer will call each implementation's
+ * {@link #doDemangle(String, DemanglerOptions, MessageLog)} method for each symbol.
+ * See the various protected methods of this class for points at which behavior can be overridden.
+ *
+ */
public abstract class AbstractDemanglerAnalyzer extends AbstractAnalyzer {
public AbstractDemanglerAnalyzer(String name, String description) {
@@ -35,7 +48,7 @@ public abstract class AbstractDemanglerAnalyzer extends AbstractAnalyzer {
@Override
public boolean canAnalyze(Program program) {
- // override this to be enable for a binary containing symbols you wisht to process
+ // override this to control program-specific enablement
return true;
}
@@ -78,13 +91,38 @@ public abstract class AbstractDemanglerAnalyzer extends AbstractAnalyzer {
return true;
}
- // TODO callback before demangling begins...
+ /**
+ * The implementation-specific demangling callback
+ *
+ * @param mangled the mangled string
+ * @param options the demangler options
+ * @param log the error log
+ * @return the demangled object; null if demangling was unsuccessful
+ * @throws DemangledException if there is a problem demangling or building the result
+ */
+ protected abstract DemangledObject doDemangle(String mangled, DemanglerOptions options,
+ MessageLog log) throws DemangledException;
+
+ /**
+ * Called before each analysis request to ensure that the current options (which may have
+ * user-defined input) will work with the current demangler
+ *
+ * @param options the current options in use
+ * @param log the error log into which error message can be written
+ * @return true if valid
+ */
protected boolean validateOptions(DemanglerOptions options, MessageLog log) {
// override to validate custom options for a particular demangler
return true;
}
- private boolean skipSymbol(Symbol symbol) {
+ /**
+ * True if this analyzer should not attempt to demangle the given symbol
+ *
+ * @param symbol the symbol
+ * @return true to skip the symbol
+ */
+ protected boolean skipSymbol(Symbol symbol) {
if (symbol.getSource() == SourceType.DEFAULT) {
return true;
}
@@ -111,9 +149,13 @@ public abstract class AbstractDemanglerAnalyzer extends AbstractAnalyzer {
return false;
}
- protected abstract DemangledObject doDemangle(String mangled, DemanglerOptions options,
- MessageLog log) throws DemangledException;
-
+ /**
+ * Creates the options for the demangler used by implementations of this analyzer. This will
+ * be called before each {@link #added(Program, AddressSetView, TaskMonitor, MessageLog)}
+ * call processes symbols.
+ *
+ * @return the options
+ */
protected DemanglerOptions getOptions() {
// note: these can be stored in the analyzer subclass and updated when the
// analysis options change
@@ -124,6 +166,15 @@ public abstract class AbstractDemanglerAnalyzer extends AbstractAnalyzer {
return options;
}
+ /**
+ * This calss's default demangle method. This may be overridden to change how errors are
+ * handled.
+ *
+ * @param mangled the mangled string
+ * @param options the demangler options
+ * @param log the error log
+ * @return the demangled object; null if unsuccessful
+ */
protected DemangledObject demangle(String mangled, DemanglerOptions options,
MessageLog log) {
@@ -148,6 +199,16 @@ public abstract class AbstractDemanglerAnalyzer extends AbstractAnalyzer {
return demangled;
}
+ /**
+ * Applies the given demangled object to the program
+ *
+ * @param program the program
+ * @param address the apply address
+ * @param demangled the demangled object
+ * @param options the options used during the apply
+ * @param log the error log
+ * @param monitor the task monitor
+ */
protected void apply(Program program, Address address, DemangledObject demangled,
DemanglerOptions options, MessageLog log, TaskMonitor monitor) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisOptionsDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisOptionsDialog.java
index 774e58e738..24981b85ce 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisOptionsDialog.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisOptionsDialog.java
@@ -43,7 +43,7 @@ public class AnalysisOptionsDialog extends DialogComponentProvider implements
AnalysisOptionsDialog(Program program) {
this(List.of(program));
}
-
+
/**
* Constructor
*
@@ -53,20 +53,20 @@ public class AnalysisOptionsDialog extends DialogComponentProvider implements
super("Analysis Options");
setHelpLocation(new HelpLocation("AutoAnalysisPlugin", "AnalysisOptions"));
panel = buildComponent(programs);
-
+
addWorkPanel(panel);
addOKButton();
addCancelButton();
setOkButtonText("Analyze");
okButton.setMnemonic('A');
setOkEnabled(true);
- setPreferredSize(800, 400);
- setRememberSize(true);
+ setPreferredSize(1000, 600);
+ setRememberSize(true);
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
-
+
// On any analyzer status change, update the options for all programs
// being analyzed. This is necessary to keep options consistent across all
// programs being analyzed.
@@ -75,9 +75,9 @@ public class AnalysisOptionsDialog extends DialogComponentProvider implements
// analysis panel has finished being constructed, so protect against
// that before calling the update method.
if (panel != null) {
- panel.updateOptionForAllPrograms(evt.getPropertyName(), (Boolean)evt.getNewValue());
+ panel.updateOptionForAllPrograms(evt.getPropertyName(), (Boolean) evt.getNewValue());
}
- }
+ }
@Override
public void okCallback() {
@@ -94,7 +94,7 @@ public class AnalysisOptionsDialog extends DialogComponentProvider implements
boolean wasAnalyzeButtonSelected() {
return doAnalysis;
}
-
+
/**
* Constructs a new {@link AnalysisPanel}
*
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisPanel.java
index c107b8731c..a47cb4795c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisPanel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisPanel.java
@@ -16,20 +16,18 @@
package ghidra.app.plugin.core.analysis;
import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.beans.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.border.Border;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
import javax.swing.table.*;
import org.apache.commons.collections4.CollectionUtils;
+import docking.help.Help;
+import docking.help.HelpService;
import docking.options.editor.GenericOptionsComponent;
import docking.widgets.OptionDialog;
import docking.widgets.label.GLabel;
@@ -39,11 +37,11 @@ import ghidra.app.services.Analyzer;
import ghidra.framework.options.*;
import ghidra.program.model.listing.Program;
import ghidra.util.ColorUtils;
+import ghidra.util.HelpLocation;
import ghidra.util.exception.AssertException;
import ghidra.util.layout.VerticalLayout;
class AnalysisPanel extends JPanel implements PropertyChangeListener {
- private static final long serialVersionUID = 1L;
public static final String PROTOTYPE = " (Prototype)";
@@ -132,12 +130,7 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
AutoAnalysisManager manager = AutoAnalysisManager.getAnalysisManager(programs.get(0));
List...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/BytePatterns/src/main/java/ghidra/app/analyzers/LibHashDB.java b/Ghidra/Features/BytePatterns/src/main/java/ghidra/app/analyzers/LibHashDB.java
deleted file mode 100644
index 989cdb5fcc..0000000000
--- a/Ghidra/Features/BytePatterns/src/main/java/ghidra/app/analyzers/LibHashDB.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/* ###
- * IP: GHIDRA
- * REVIEWED: YES
- *
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package ghidra.app.analyzers;
-
-import ghidra.program.model.listing.Function;
-import ghidra.program.model.listing.Program;
-import ghidra.util.exception.CancelledException;
-import ghidra.xml.XmlPullParser;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.TreeSet;
-
-public class LibHashDB {
-
- private TreeSet...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/Decompiler/src/main/doc/Frontpage.css b/Ghidra/Features/Decompiler/src/main/doc/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Features/Decompiler/src/main/doc/Frontpage.css
+++ b/Ghidra/Features/Decompiler/src/main/doc/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/Decompiler/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/Decompiler/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Features/Decompiler/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Features/Decompiler/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/analysis/DecompilerFunctionAnalyzer.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/analysis/DecompilerFunctionAnalyzer.java
index c7866df832..912faa9022 100644
--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/analysis/DecompilerFunctionAnalyzer.java
+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/analysis/DecompilerFunctionAnalyzer.java
@@ -110,7 +110,7 @@ public class DecompilerFunctionAnalyzer extends AbstractAnalyzer {
@Override
public void registerOptions(Options options, Program program) {
HelpLocation helpLocation = new HelpLocation("AutoAnalysisPlugin",
- "Auto_Analysis_Option_Instruction" + getAnalysisType());
+ "Decompiler_Parameter_ID_Analyzer");
options.registerOption(OPTION_NAME_CLEAR_LEVEL, SourceType.ANALYSIS, helpLocation,
OPTION_DESCRIPTION_CLEAR_LEVEL);
diff --git a/Ghidra/Features/FileFormats/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/FileFormats/src/main/help/help/shared/Frontpage.css
index 4c4f708c53..b8471669f4 100644
--- a/Ghidra/Features/FileFormats/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Features/FileFormats/src/main/help/help/shared/Frontpage.css
@@ -24,13 +24,13 @@
*/
-body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px;} /* some padding to improve readability */
+body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 10px; } /* some padding to improve readability */
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
-h4 { margin-left: 10px; font-family:times new roman; font-size:14pt; font-style:italic; }
-
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
+h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
+
/*
P tag code. Most of the help files nest P tags inside of blockquote tags (the was the
way it had been done in the beginning). The net effect is that the text is indented. In
@@ -40,12 +40,25 @@ h4 { margin-left: 10px; font-family:times new roman; font-size:14pt; font-style:
*/
p { margin-left: 40px; font-family:times new roman; font-size:14pt; }
blockquote p { margin-left: 10px; }
+
p.providedbyplugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
p.ProvidedByPlugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
p.relatedtopic { color:#800080; margin-left: 10px; font-size:14pt; }
p.RelatedTopic { color:#800080; margin-left: 10px; font-size:14pt; }
-
+/*
+ We wish for a tables to have space between it and the preceding element, so that text
+ is not too close to the top of the table. Also, nest the table a bit so that it is clear
+ the table relates to the preceding text.
+*/
+table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/FunctionGraph/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/FunctionGraph/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Features/FunctionGraph/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Features/FunctionGraph/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/FunctionID/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/FunctionID/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Features/FunctionID/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Features/FunctionID/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/GnuDemangler/ghidra_scripts/DemangleElfWithOptionScript.java b/Ghidra/Features/GnuDemangler/ghidra_scripts/DemangleElfWithOptionScript.java
index d355b97543..c4e4988054 100644
--- a/Ghidra/Features/GnuDemangler/ghidra_scripts/DemangleElfWithOptionScript.java
+++ b/Ghidra/Features/GnuDemangler/ghidra_scripts/DemangleElfWithOptionScript.java
@@ -19,17 +19,10 @@
//
//@category Examples.Demangler
-import java.io.*;
-
import ghidra.app.script.GhidraScript;
import ghidra.app.util.demangler.DemangledObject;
-import ghidra.app.util.demangler.DemanglerOptions;
-import ghidra.app.util.demangler.gnu.GnuDemanglerNativeProcess;
-import ghidra.app.util.demangler.gnu.GnuDemanglerParser;
-import ghidra.app.util.opinion.ElfLoader;
-import ghidra.app.util.opinion.MachoLoader;
-import ghidra.framework.*;
-import ghidra.program.model.lang.CompilerSpec;
+import ghidra.app.util.demangler.gnu.GnuDemangler;
+import ghidra.app.util.demangler.gnu.GnuDemanglerOptions;
import ghidra.program.model.symbol.Symbol;
public class DemangleElfWithOptionScript extends GhidraScript {
@@ -37,8 +30,9 @@ public class DemangleElfWithOptionScript extends GhidraScript {
@Override
protected void run() throws Exception {
- String executableFormat = currentProgram.getExecutableFormat();
- if (!canDemangle(executableFormat)) {
+ GnuDemangler demangler = new GnuDemangler();
+ if (!demangler.canDemangle(currentProgram)) {
+ String executableFormat = currentProgram.getExecutableFormat();
println("Cannot use the elf demangling options for executable format: " +
executableFormat);
return;
@@ -55,81 +49,22 @@ public class DemangleElfWithOptionScript extends GhidraScript {
String mangled = symbol.getName();
- Process process = createProcess(executableFormat);
+ GnuDemanglerOptions options = new GnuDemanglerOptions();
+ options.setDoDisassembly(false);
+ options.setDemanglerApplicationArguments("-s auto");
- InputStream in = process.getInputStream();
- OutputStream out = process.getOutputStream();
+ /*
+ // for older formats use the deprecated demangler
+ options.setDemanglerName(GnuDemanglerOptions.GNU_DEMANGLER_V2_24);
+ options.setDemanglerApplicationArguments("-s arm");
+ */
- BufferedReader input = new BufferedReader(new InputStreamReader(in));
- PrintWriter output = new PrintWriter(out);
-
- output.println(mangled);
- output.flush();
- String demangled = input.readLine();
- println("demangled: " + demangled);
-
- GnuDemanglerParser parser = new GnuDemanglerParser(null);
- DemangledObject demangledObject = parser.parse(mangled, demangled);
+ DemangledObject demangledObject = demangler.demangle(mangled, options);
if (demangledObject == null) {
println("Could not demangle: " + mangled);
return;
}
- // TODO change to GnuDemanglerOptions
- DemanglerOptions options = new DemanglerOptions();
- options.setDoDisassembly(false);
- options.setApplySignature(true);
- options.setDemangleOnlyKnownPatterns(true);
-
- if (!demangledObject.applyTo(currentProgram, currentAddress, options, monitor)) {
- println("Failed to apply demangled data for " + mangled);
- }
- println("Succesfully demangled " + mangled + " to " + demangled);
- }
-
- private boolean canDemangle(String executableFormat) {
-
- //check if language is GCC - this is not altogether correct !
- // Objective-C and other non-GCC based symbols may be handled improperly
-
- if (isELF(executableFormat) || isMacho(executableFormat)) {
- return true;
- }
-
- CompilerSpec compilerSpec = currentProgram.getCompilerSpec();
- if (compilerSpec.getCompilerSpecID()
- .getIdAsString()
- .toLowerCase()
- .indexOf("windows") == -1) {
- return true;
- }
- return false;
- }
-
- private boolean isELF(String executableFormat) {
- return executableFormat != null && executableFormat.indexOf(ElfLoader.ELF_NAME) != -1;
- }
-
- private boolean isMacho(String executableFormat) {
- return executableFormat != null && executableFormat.indexOf(MachoLoader.MACH_O_NAME) != -1;
- }
-
- /// TODO this is here because we did not support program arguments. replace this code
- private Process createProcess(String executableName) throws Exception {
-
- String demanglerName = GnuDemanglerNativeProcess.DEMANGLER_GNU;
- OperatingSystem OS = Platform.CURRENT_PLATFORM.getOperatingSystem();
- String demanglerExe =
- (OS == OperatingSystem.WINDOWS) ? demanglerName + ".exe" : demanglerName;
- File commandPath = Application.getOSFile("GnuDemangler", demanglerExe);
-
- //
- // This is where special options are to be passed. Put your own here as necessary.
- //
- String[] command = new String[] { commandPath.getAbsolutePath(), "-s", "arm" };
-
- Process process = Runtime.getRuntime().exec(command);
-
- return process;
+ println("Succesfully demangled " + mangled + " to " + demangledObject);
}
}
diff --git a/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_5_4.java b/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_5_4.java
index d9a3f92902..47af9fb626 100644
--- a/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_5_4.java
+++ b/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_5_4.java
@@ -95,8 +95,9 @@ public class VxWorksSymTab_5_4 extends GhidraScript {
Address vxSymTbl = vxNumSymEntriesAddr.subtract(vxNumSymEntries * SYM_ENTRY_SIZE);
for (int i = 0; i < vxNumSymEntries; i++) {
- if (monitor.isCancelled())
+ if (monitor.isCancelled()) {
return; // check for cancel button
+ }
println("i=" + i); // visual counter
// Extract symbol table entry values
@@ -112,15 +113,19 @@ public class VxWorksSymTab_5_4 extends GhidraScript {
Address a;
String symName;
for (a = symNameAddr; mem.getByte(a) != 0; a = a.add(1)) {
- if (getDataAt(a) != null)
+ if (getDataAt(a) != null) {
removeDataAt(a);
- if (getInstructionAt(a) != null)
+ }
+ if (getInstructionAt(a) != null) {
removeInstructionAt(a);
+ }
}
- if (getDataAt(a) != null)
+ if (getDataAt(a) != null) {
removeDataAt(a);
- if (getInstructionAt(a) != null)
+ }
+ if (getInstructionAt(a) != null) {
removeInstructionAt(a);
+ }
// Turn *symNameAddr into a string and store it in symName
try {
@@ -137,7 +142,7 @@ public class VxWorksSymTab_5_4 extends GhidraScript {
String symDemangledName = null;
try {
// if successful, symDemangledName will be non-NULL
- symDemangledName = demangler.demangle(symName, true).getSignature(false);
+ symDemangledName = demangler.demangle(symName).getSignature(false);
}
catch (DemangledException e) {
// if symName wasn't a mangled name, silently continue
diff --git a/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_6_1.java b/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_6_1.java
index c2804f7d56..a58aafd326 100644
--- a/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_6_1.java
+++ b/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_6_1.java
@@ -138,7 +138,7 @@ public class VxWorksSymTab_6_1 extends GhidraScript {
String symDemangledName = null;
try {
// if successful, symDemangledName will be non-NULL
- symDemangledName = demangler.demangle(symName, true).getSignature(false);
+ symDemangledName = demangler.demangle(symName).getSignature(false);
}
catch (DemangledException e) {
// if symName wasn't a mangled name, silently continue
diff --git a/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_Finder.java b/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_Finder.java
index 6a4a3207e4..4878c8a422 100644
--- a/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_Finder.java
+++ b/Ghidra/Features/GnuDemangler/ghidra_scripts/VxWorksSymTab_Finder.java
@@ -50,13 +50,7 @@ import ghidra.app.util.demangler.DemangledException;
import ghidra.app.util.demangler.gnu.GnuDemangler;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSet;
-import ghidra.program.model.data.ArrayDataType;
-import ghidra.program.model.data.DataType;
-import ghidra.program.model.data.DataTypeComponent;
-import ghidra.program.model.data.DataTypeConflictHandler;
-import ghidra.program.model.data.DataTypeManager;
-import ghidra.program.model.data.PointerDataType;
-import ghidra.program.model.data.StructureDataType;
+import ghidra.program.model.data.*;
import ghidra.program.model.listing.Data;
import ghidra.program.model.listing.Instruction;
import ghidra.program.model.mem.MemoryBlock;
@@ -143,8 +137,9 @@ public class VxWorksSymTab_Finder extends GhidraScript {
// Add SYMBOL data type to Program DataTypeManager
// (if data type already exists, replace it)
public void createGhidraType() {
- currentProgram.getDataTypeManager().addDataType(dt,
- DataTypeConflictHandler.REPLACE_HANDLER);
+ currentProgram.getDataTypeManager()
+ .addDataType(dt,
+ DataTypeConflictHandler.REPLACE_HANDLER);
}
}
@@ -351,8 +346,7 @@ public class VxWorksSymTab_Finder extends GhidraScript {
}
}
- if (_byte == 0x00)
- {
+ if (_byte == 0x00) {
return true; // Scan stopped at null.
}
return false; // Scan stopped at invalid char.
@@ -657,8 +651,9 @@ public class VxWorksSymTab_Finder extends GhidraScript {
if (demangled != null) {
new DemanglerCmd(addr, mangled).applyTo(currentProgram, monitor);
- currentProgram.getSymbolTable().removeSymbolSpecial(
- getSymbol(mangled, currentProgram.getGlobalNamespace()));
+ currentProgram.getSymbolTable()
+ .removeSymbolSpecial(
+ getSymbol(mangled, currentProgram.getGlobalNamespace()));
}
return;
@@ -772,7 +767,7 @@ public class VxWorksSymTab_Finder extends GhidraScript {
// Demangle symName
String symDemangledName = null;
try {
- symDemangledName = demangler.demangle(symName, true).getSignature(false);
+ symDemangledName = demangler.demangle(symName).getSignature(false);
}
catch (DemangledException e) { // report demangling error
if (!e.isInvalidMangledName()) {
diff --git a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/plugin/core/analysis/GnuDemanglerAnalyzer.java b/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/plugin/core/analysis/GnuDemanglerAnalyzer.java
index 88238bab48..6e34bf7545 100644
--- a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/plugin/core/analysis/GnuDemanglerAnalyzer.java
+++ b/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/plugin/core/analysis/GnuDemanglerAnalyzer.java
@@ -22,11 +22,13 @@ import org.apache.commons.lang3.StringUtils;
import ghidra.app.util.demangler.*;
import ghidra.app.util.demangler.gnu.*;
import ghidra.app.util.importer.MessageLog;
-import ghidra.framework.options.*;
+import ghidra.framework.options.Options;
import ghidra.program.model.listing.Program;
import ghidra.util.HelpLocation;
-import ghidra.util.Msg;
+/**
+ * A version of the demangler analyzer to handle GNU GCC symbols
+ */
public class GnuDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
private static final String NAME = "Demangler GNU";
@@ -35,7 +37,7 @@ public class GnuDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
"the name and apply datatypes to parameters.";
private static final String OPTION_NAME_DEMANGLE_USE_KNOWN_PATTERNS =
- "Only Demangle Known Mangled Symbols";
+ "Demangle Only Known Mangled Symbols";
private static final String OPTION_DESCRIPTION_USE_KNOWN_PATTERNS =
"Only demangle symbols that follow known compiler mangling patterns. " +
"Leaving this option off may cause non-mangled symbols to get demangled.";
@@ -44,14 +46,20 @@ public class GnuDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
private static final String OPTION_DESCRIPTION_APPLY_SIGNATURE =
"Apply any recovered function signature, in addition to the function name";
- // note: we use 'Z' as a trick to be below the other options
- private static final String OPTION_NAME_GNU_DEMANGLER = "Z GNU Demangler";
+ static final String OPTION_NAME_USE_DEPRECATED_DEMANGLER = "Use Deprecated Demangler";
+ private static final String OPTION_DESCRIPTION_DEPRECATED_DEMANGLER =
+ "Signals to use the deprecated demangler when the modern demangler cannot demangle a " +
+ "given string";
+
+ private static final String OPTION_NAME_DEMANGLER_PARAMETERS =
+ "Use External Demangler Options";
+ private static final String OPTION_DESCRIPTION_DEMANGLER_PARAMETERS =
+ "Signals to use pass the given parameters to the demangler program";
private boolean doSignatureEnabled = true;
private boolean demangleOnlyKnownPatterns = false;
- private GnuDemanglerOptionsPropertyEditor gnuOptionsEditor =
- new GnuDemanglerOptionsPropertyEditor();
- private GnuDemanglerWrappedOption gnuWrappedOptions;
+ private boolean useDeprecatedDemangler = false;
+ private String demanglerParameters = "";
private GnuDemangler demangler = new GnuDemangler();
@@ -67,28 +75,20 @@ public class GnuDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
@Override
public void registerOptions(Options options, Program program) {
- options.registerOption(OPTION_NAME_APPLY_SIGNATURE, doSignatureEnabled, null,
- OPTION_DESCRIPTION_APPLY_SIGNATURE);
-
- options.registerOption(OPTION_NAME_DEMANGLE_USE_KNOWN_PATTERNS, false, null,
- OPTION_DESCRIPTION_USE_KNOWN_PATTERNS);
-
- options.registerOptionsEditor(null);
HelpLocation help = new HelpLocation("AutoAnalysisPlugin", "Demangler_Analyzer");
- options.registerOption(OPTION_NAME_GNU_DEMANGLER, OptionType.CUSTOM_TYPE,
- new GnuDemanglerWrappedOption(), help, "Advanced GNU demangler options",
- gnuOptionsEditor);
+ options.registerOption(OPTION_NAME_APPLY_SIGNATURE, doSignatureEnabled, help,
+ OPTION_DESCRIPTION_APPLY_SIGNATURE);
- CustomOption customOption = options.getCustomOption(OPTION_NAME_GNU_DEMANGLER,
- new GnuDemanglerWrappedOption());
- if (!(customOption instanceof GnuDemanglerWrappedOption)) {
- customOption = new GnuDemanglerWrappedOption();
- Msg.debug(this, "Unexpected custom option type for GNU Demangler: " +
- customOption.getClass());
- }
- gnuWrappedOptions = (GnuDemanglerWrappedOption) customOption;
+ options.registerOption(OPTION_NAME_DEMANGLE_USE_KNOWN_PATTERNS, demangleOnlyKnownPatterns,
+ help,
+ OPTION_DESCRIPTION_USE_KNOWN_PATTERNS);
+ options.registerOption(OPTION_NAME_USE_DEPRECATED_DEMANGLER, useDeprecatedDemangler, help,
+ OPTION_DESCRIPTION_DEPRECATED_DEMANGLER);
+
+ options.registerOption(OPTION_NAME_DEMANGLER_PARAMETERS, demanglerParameters, help,
+ OPTION_DESCRIPTION_DEMANGLER_PARAMETERS);
}
@Override
@@ -97,9 +97,11 @@ public class GnuDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
demangleOnlyKnownPatterns =
options.getBoolean(OPTION_NAME_DEMANGLE_USE_KNOWN_PATTERNS, demangleOnlyKnownPatterns);
- gnuWrappedOptions =
- (GnuDemanglerWrappedOption) options.getCustomOption(OPTION_NAME_GNU_DEMANGLER,
- new GnuDemanglerWrappedOption());
+ useDeprecatedDemangler =
+ options.getBoolean(OPTION_NAME_USE_DEPRECATED_DEMANGLER, useDeprecatedDemangler);
+
+ demanglerParameters =
+ options.getString(OPTION_NAME_DEMANGLER_PARAMETERS, demanglerParameters);
}
@Override
@@ -109,15 +111,7 @@ public class GnuDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
options.setDoDisassembly(true);
options.setApplySignature(doSignatureEnabled);
options.setDemangleOnlyKnownPatterns(demangleOnlyKnownPatterns);
-
- options.setUseDeprecatedDemangler(gnuWrappedOptions.useDeprecatedDemangler());
-
- String text = null;
- if (gnuWrappedOptions.useDemanglerParameters()) {
- text = gnuWrappedOptions.getDemanglerParametersText();
- }
- options.setDemanglerApplicationArguments(text);
-
+ options.setDemanglerApplicationArguments(demanglerParameters);
return options;
}
@@ -144,7 +138,7 @@ public class GnuDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
log.appendException(e);
}
- if (options.useDeprecatedDemangler()) {
+ if (useDeprecatedDemangler) {
// see if the options work in the deprecated demangler
GnuDemanglerOptions deprecatedOptions = options.withDeprecatedDemangler();
String deprecatedName = deprecatedOptions.getDemanglerName();
@@ -176,7 +170,7 @@ public class GnuDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
demangled = demangler.demangle(mangled, options);
}
catch (DemangledException e) {
- if (!options.useDeprecatedDemangler()) {
+ if (!useDeprecatedDemangler) {
throw e; // let our parent handle this
}
}
@@ -185,7 +179,7 @@ public class GnuDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
return demangled;
}
- if (options.useDeprecatedDemangler()) {
+ if (useDeprecatedDemangler) {
GnuDemanglerOptions newOptions = options.withDeprecatedDemangler();
demangled = demangler.demangle(mangled, newOptions);
}
diff --git a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/plugin/core/analysis/GnuDemanglerOptionsPropertyEditor.java b/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/plugin/core/analysis/GnuDemanglerOptionsPropertyEditor.java
deleted file mode 100644
index 51731b3709..0000000000
--- a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/plugin/core/analysis/GnuDemanglerOptionsPropertyEditor.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/* ###
- * IP: GHIDRA
- *
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package ghidra.app.plugin.core.analysis;
-
-import java.awt.Component;
-import java.awt.Container;
-import java.beans.PropertyEditorSupport;
-import java.util.Objects;
-
-import javax.swing.*;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-import docking.widgets.checkbox.GCheckBox;
-import ghidra.framework.options.CustomOptionsEditor;
-import ghidra.util.layout.HorizontalLayout;
-import ghidra.util.layout.VerticalLayout;
-
-public class GnuDemanglerOptionsPropertyEditor extends PropertyEditorSupport
- implements CustomOptionsEditor {
-
- private static final String USE_DEPRECATED_DEMANGLER = "Use Deprecated Demangler";
- private static final String USE_DEMANGLER_PARAMETERS = "Use Demangler Program Parameters";
-
- private static final String USE_DEPRECATED_DEMANGLER_TOOLTIP =
- "Signals to use the deprecated demangler when the modern demangler cannot demangle a " +
- "given string";
- private static final String USE_DEMANGLER_PARAMETERS_TOOLTIP =
- "Signals to use pass the given parameters to the demangler program";
-
- private static final String[] NAMES =
- { USE_DEPRECATED_DEMANGLER, USE_DEMANGLER_PARAMETERS };
-
- private static final String[] DESCRIPTIONS = { USE_DEPRECATED_DEMANGLER_TOOLTIP,
- USE_DEMANGLER_PARAMETERS_TOOLTIP };
-
- private GnuDemanglerWrappedOption wrappedOption;
-
- private Component editorComponent;
-
- private GCheckBox useDeprecatedDemanglerBox;
- private GCheckBox useDemanglerParametersBox;
- private JTextField demanglerParametersTextField;
-
- public GnuDemanglerOptionsPropertyEditor() {
- editorComponent = buildEditor();
- }
-
- private Component buildEditor() {
-
- // we want to have a panel with our options so that we may group them together
- JPanel panel = new JPanel(new VerticalLayout(3));
-
- useDeprecatedDemanglerBox = new GCheckBox(USE_DEPRECATED_DEMANGLER);
- useDeprecatedDemanglerBox.setSelected(false);
- useDeprecatedDemanglerBox.setToolTipText(USE_DEPRECATED_DEMANGLER_TOOLTIP);
- useDeprecatedDemanglerBox.addItemListener(e -> firePropertyChange());
- panel.add(useDeprecatedDemanglerBox);
-
- createParameterComponent(panel);
-
- return panel;
- }
-
- private void createParameterComponent(Container parent) {
-
- JPanel textFieldPanel = new JPanel(new HorizontalLayout(0));
- JTextField textField = new JTextField(15);
- useDemanglerParametersBox = new GCheckBox(USE_DEMANGLER_PARAMETERS);
- useDemanglerParametersBox.setToolTipText(USE_DEMANGLER_PARAMETERS_TOOLTIP);
- useDemanglerParametersBox.addItemListener(e -> {
- textField.setEnabled(useDemanglerParametersBox.isSelected());
- firePropertyChange();
- });
-
- textField.getDocument().addDocumentListener(new DocumentListener() {
- @Override
- public void changedUpdate(DocumentEvent e) {
- firePropertyChange();
- }
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- firePropertyChange();
- }
-
- @Override
- public void removeUpdate(DocumentEvent e) {
- firePropertyChange();
- }
- });
-
- textField.setEnabled(false);
-
- textFieldPanel.add(useDemanglerParametersBox);
- textFieldPanel.add(Box.createHorizontalStrut(10));
- textFieldPanel.add(textField);
-
- parent.add(textFieldPanel);
-
- demanglerParametersTextField = textField;
- }
-
- @Override
- public void setValue(Object value) {
-
- if (!(value instanceof GnuDemanglerWrappedOption)) {
- return;
- }
-
- wrappedOption = (GnuDemanglerWrappedOption) value;
- setLocalValues(wrappedOption);
- firePropertyChange();
- }
-
- private void setLocalValues(GnuDemanglerWrappedOption newOption) {
-
- if (newOption.useDeprecatedDemangler() != useDeprecatedDemanglerBox.isSelected()) {
- useDeprecatedDemanglerBox.setSelected(newOption.useDeprecatedDemangler());
- }
-
- if (newOption.useDemanglerParameters() != useDemanglerParametersBox.isSelected()) {
- useDemanglerParametersBox.setSelected(newOption.useDemanglerParameters());
- }
-
- String newText = newOption.getDemanglerParametersText();
- String currentText = demanglerParametersTextField.getText();
- if (!Objects.equals(newText, currentText)) {
- demanglerParametersTextField.setText(newText);
- }
- }
-
- @Override
- public Object getValue() {
- return cloneNamespaceValues();
- }
-
- private GnuDemanglerWrappedOption cloneNamespaceValues() {
-
- GnuDemanglerWrappedOption newOption = new GnuDemanglerWrappedOption();
- newOption.setUseDeprecatedDemangler(useDeprecatedDemanglerBox.isSelected());
- newOption.setUseDemanglerParameters(useDemanglerParametersBox.isSelected());
- newOption.setDemanglerParametersText(demanglerParametersTextField.getText());
- return newOption;
- }
-
- @Override
- public String[] getOptionNames() {
- return NAMES;
- }
-
- @Override
- public String[] getOptionDescriptions() {
- return DESCRIPTIONS;
- }
-
- @Override
- public Component getCustomEditor() {
- return editorComponent;
- }
-
- @Override
- public boolean supportsCustomEditor() {
- return true;
- }
-}
diff --git a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/plugin/core/analysis/GnuDemanglerWrappedOption.java b/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/plugin/core/analysis/GnuDemanglerWrappedOption.java
deleted file mode 100644
index 502f906e13..0000000000
--- a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/plugin/core/analysis/GnuDemanglerWrappedOption.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/* ###
- * IP: GHIDRA
- *
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package ghidra.app.plugin.core.analysis;
-
-import java.util.Objects;
-
-import ghidra.framework.options.CustomOption;
-import ghidra.framework.options.SaveState;
-
-/**
- * A simple java bean adapted to the {@link CustomOption} interface. The public
- * getters and setters are self-documenting.
- */
-public class GnuDemanglerWrappedOption implements CustomOption {
-
- private static final String USE_DEPRECATED_DEMANGLER = "USE_DEPRECATED_DEMANGLER";
- private static final String USE_DEMANGLER_PARAMETERS = "USE_DEMANGLER_PARAMETERS";
- private static final String DEMANGLER_PARAMETERS = "DEMANGLER_PARAMETERS";
-
- private boolean useDeprecatedDemangler = false;
- private boolean useDemanglerParameters = false;
- private String demanglerParametersText = null;
-
- public void setUseDeprecatedDemangler(boolean doUse) {
- this.useDeprecatedDemangler = doUse;
- }
-
- public boolean useDeprecatedDemangler() {
- return useDeprecatedDemangler;
- }
-
- public void setDemanglerParametersText(String text) {
- this.demanglerParametersText = text;
- }
-
- public String getDemanglerParametersText() {
- return demanglerParametersText;
- }
-
- public void setUseDemanglerParameters(boolean doUse) {
- this.useDemanglerParameters = doUse;
- }
-
- public boolean useDemanglerParameters() {
- return useDemanglerParameters;
- }
-
- @Override
- public void readState(SaveState state) {
- useDeprecatedDemangler =
- state.getBoolean(USE_DEPRECATED_DEMANGLER, useDemanglerParameters);
- useDemanglerParameters =
- state.getBoolean(USE_DEPRECATED_DEMANGLER, useDemanglerParameters);
- demanglerParametersText =
- state.getString(DEMANGLER_PARAMETERS, demanglerParametersText);
- }
-
- @Override
- public void writeState(SaveState state) {
- state.putBoolean(USE_DEPRECATED_DEMANGLER, useDeprecatedDemangler);
- state.putBoolean(USE_DEMANGLER_PARAMETERS, useDemanglerParameters);
- state.putString(USE_DEMANGLER_PARAMETERS, demanglerParametersText);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result +
- ((demanglerParametersText == null) ? 0 : demanglerParametersText.hashCode());
- result = prime * result + (useDemanglerParameters ? 1231 : 1237);
- result = prime * result + (useDeprecatedDemangler ? 1231 : 1237);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- GnuDemanglerWrappedOption other = (GnuDemanglerWrappedOption) obj;
- if (!Objects.equals(demanglerParametersText, other.demanglerParametersText)) {
- return false;
- }
-
- if (useDemanglerParameters != other.useDemanglerParameters) {
- return false;
- }
- if (useDeprecatedDemangler != other.useDeprecatedDemangler) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- //@formatter:off
- return "{\n" +
- "\tuseDeprecatedDemangler: " + useDeprecatedDemangler + ",\n" +
- "\tuseDemanglerParameters: " + useDemanglerParameters + ",\n" +
- "\tdemanglerParametersText: " + demanglerParametersText + ",\n" +
- "}";
- //@formatter:on
- }
-}
diff --git a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemangler.java b/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemangler.java
index b612071096..452e8c2acc 100644
--- a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemangler.java
+++ b/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemangler.java
@@ -60,6 +60,7 @@ public class GnuDemangler implements Demangler {
}
@Override
+ @Deprecated(since = "9.2", forRemoval = true)
public DemangledObject demangle(String mangled, boolean demangleOnlyKnownPatterns)
throws DemangledException {
GnuDemanglerOptions options = new GnuDemanglerOptions();
diff --git a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemanglerNativeProcess.java b/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemanglerNativeProcess.java
index a058be8526..a5dcf6e56d 100644
--- a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemanglerNativeProcess.java
+++ b/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemanglerNativeProcess.java
@@ -27,6 +27,11 @@ import org.apache.commons.lang3.StringUtils;
import ghidra.framework.Application;
import ghidra.framework.Platform;
+/**
+ * A class that allows for the reuse of native demangler executable processes. This class will
+ * cache the process by name and by any arguments passed to the process when started. Once
+ * successfully started, the process will persist
+ */
public class GnuDemanglerNativeProcess {
public static final String DEMANGLER_GNU = GnuDemanglerOptions.GNU_DEMANGLER_DEFAULT;
@@ -42,21 +47,35 @@ public class GnuDemanglerNativeProcess {
private BufferedReader reader;
private PrintWriter writer;
- // TODO docme
+ /**
+ * Gets the default GNU demangler native process
+ * @return the process
+ * @throws IOException if the process cannot be started
+ */
public static synchronized GnuDemanglerNativeProcess getDemanglerNativeProcess()
throws IOException {
return getDemanglerNativeProcess(DEMANGLER_GNU);
}
- // TODO docme
+ /**
+ * Gets the default GNU demangler native process
+ * @param name the specific executable name to launch
+ * @return the process
+ * @throws IOException if the process cannot be started
+ */
public static synchronized GnuDemanglerNativeProcess getDemanglerNativeProcess(String name)
throws IOException {
return getDemanglerNativeProcess(name, DEFAULT_NATIVE_OPTIONS);
}
- // TODO docme
- // TODO we should probably age-off all demanglers by access time
+ /**
+ * Gets the default GNU demangler native process
+ * @param name the specific executable name to launch
+ * @param nativeOptions the arguments string to pass to the native demangler
+ * @return the process
+ * @throws IOException if the process cannot be started
+ */
public static synchronized GnuDemanglerNativeProcess getDemanglerNativeProcess(String name,
String nativeOptions)
throws IOException {
@@ -66,15 +85,18 @@ public class GnuDemanglerNativeProcess {
options = DEFAULT_NATIVE_OPTIONS;
}
- String key = name + nativeOptions;
+ String key = getKey(name, options);
GnuDemanglerNativeProcess nativeProcess = processesByName.get(key);
if (nativeProcess == null) {
nativeProcess = new GnuDemanglerNativeProcess(name, options);
- processesByName.put(key, nativeProcess);
}
return nativeProcess;
}
+ private static String getKey(String name, String options) {
+ return name + ' ' + options;
+ }
+
private GnuDemanglerNativeProcess(String applicationName, String options) throws IOException {
this.applicationName = applicationName;
this.options = options;
@@ -95,7 +117,6 @@ public class GnuDemanglerNativeProcess {
catch (IOException e) {
dispose();
if (!restart) {
- processesByName.remove(applicationName);
throw new IOException("Demangler process is not running.", e);
}
createProcess();
@@ -109,7 +130,11 @@ public class GnuDemanglerNativeProcess {
return reader.readLine();
}
- private void dispose() {
+ public void dispose() {
+
+ String key = getKey(applicationName, options);
+ processesByName.remove(key);
+
try {
if (process != null) {
process.destroy();
@@ -139,6 +164,8 @@ public class GnuDemanglerNativeProcess {
checkForError(command);
isDisposed = false;
+ String key = getKey(applicationName, options);
+ processesByName.put(key, this);
}
private String[] buildCommand() throws FileNotFoundException {
diff --git a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemanglerOptions.java b/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemanglerOptions.java
index abf44c2379..1bfc65e8a0 100644
--- a/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemanglerOptions.java
+++ b/Ghidra/Features/GnuDemangler/src/main/java/ghidra/app/util/demangler/gnu/GnuDemanglerOptions.java
@@ -15,12 +15,19 @@
*/
package ghidra.app.util.demangler.gnu;
-import org.apache.commons.lang3.StringUtils;
-
import ghidra.app.util.demangler.DemanglerOptions;
+/**
+ * GNU demangler options
+ */
public class GnuDemanglerOptions extends DemanglerOptions {
+ /*
+ Note!
+ If you update the demangler versions, then you also must update the help (search the
+ html files for the old version strings).
+ */
+
/**
* Version 2.24 of the GNU demangler. This version supports older formats and older bugs.
*/
@@ -38,7 +45,6 @@ public class GnuDemanglerOptions extends DemanglerOptions {
private String demanglerName = GNU_DEMANGLER_DEFAULT;
private String demanglerApplicationArguments;
- private boolean useDeprecatedDemangler;
public GnuDemanglerOptions() {
// use default values
@@ -51,48 +57,47 @@ public class GnuDemanglerOptions extends DemanglerOptions {
GnuDemanglerOptions gCopy = (GnuDemanglerOptions) copy;
demanglerName = gCopy.demanglerName;
demanglerApplicationArguments = gCopy.demanglerApplicationArguments;
- useDeprecatedDemangler = gCopy.useDeprecatedDemangler;
}
}
- // TODO docme
+ /**
+ * Returns the external demangler executable name to be used for demangling. The
+ * default value is {@link #GNU_DEMANGLER_DEFAULT}.
+ * @return the name
+ */
public String getDemanglerName() {
return demanglerName;
}
- // TODO docme
- // TODO should we validate and or log a message it the name is unknown?
+ /**
+ * Sets the external demangler executable name to be used for demangling
+ * @param name the name
+ */
public void setDemanglerName(String name) {
this.demanglerName = name;
}
- // TODO docme
+ /**
+ * Returns the current arguments to be passed to the external demangler executable
+ * @return the arguments
+ */
public String getDemanglerApplicationArguments() {
return demanglerApplicationArguments;
}
- // TODO docme
+ /**
+ * Sets the arguments to be passed to the external demangler executable
+ * @param args the arguments
+ */
public void setDemanglerApplicationArguments(String args) {
this.demanglerApplicationArguments = args;
}
- // TODO docme
- // TODO mabye rename to hasNativeApplicationOptions()
- public boolean hasDemanglerApplicationArguments() {
- return !StringUtils.isBlank(demanglerApplicationArguments);
- }
-
- // TODO docme
- public void setUseDeprecatedDemangler(boolean doUse) {
- this.useDeprecatedDemangler = doUse;
- }
-
- // TODO docme
- public boolean useDeprecatedDemangler() {
- return useDeprecatedDemangler;
- }
-
- // TODO docme
+ /**
+ * A convenience method to copy the state of this options object, changing the
+ * demangler executable name to the deprecated demangler
+ * @return the new options
+ */
public GnuDemanglerOptions withDeprecatedDemangler() {
GnuDemanglerOptions newOptions = new GnuDemanglerOptions(this);
newOptions.setDemanglerName(GNU_DEMANGLER_V2_24);
@@ -107,7 +112,6 @@ public class GnuDemanglerOptions extends DemanglerOptions {
"\tapplySignature: " + applySignature() + ",\n" +
"\tdemangleOnlyKnownPatterns: " + demangleOnlyKnownPatterns() + ",\n" +
"\tdemanglerName: " + demanglerName + ",\n" +
- "\tuseDeprecatedDemangler: " + useDeprecatedDemangler + ",\n" +
"\tdemanglerApplicationArguments: " + demanglerApplicationArguments + ",\n" +
"}";
//@formatter:on
diff --git a/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/plugin/core/analysis/GnuDemanglerAnalyzerTest.java b/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/plugin/core/analysis/GnuDemanglerAnalyzerTest.java
new file mode 100644
index 0000000000..476bf0e5cb
--- /dev/null
+++ b/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/plugin/core/analysis/GnuDemanglerAnalyzerTest.java
@@ -0,0 +1,130 @@
+/* ###
+ * IP: GHIDRA
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ghidra.app.plugin.core.analysis;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import ghidra.app.cmd.label.AddLabelCmd;
+import ghidra.app.util.importer.MessageLog;
+import ghidra.framework.options.Options;
+import ghidra.program.database.ProgramBuilder;
+import ghidra.program.database.ProgramDB;
+import ghidra.program.model.address.Address;
+import ghidra.program.model.listing.Program;
+import ghidra.program.model.symbol.SourceType;
+import ghidra.test.AbstractGhidraHeadlessIntegrationTest;
+import ghidra.test.ToyProgramBuilder;
+import ghidra.util.Msg;
+import ghidra.util.exception.RollbackException;
+import ghidra.util.task.TaskMonitor;
+
+public class GnuDemanglerAnalyzerTest extends AbstractGhidraHeadlessIntegrationTest {
+
+ private GnuDemanglerAnalyzer analyzer = new GnuDemanglerAnalyzer();
+ private ProgramDB program;
+
+ @Before
+ public void setUp() throws Exception {
+
+ ProgramBuilder builder = new ToyProgramBuilder("test", true);
+ builder.createMemory(".text", "0x0100", 0x100);
+ program = builder.getProgram();
+ registerOptions();
+ }
+
+ @Test
+ public void testDeprectedDemangledString() throws Exception {
+
+ //
+ // The below demangles to MsoDAL::VertFrame::__dt( (void))
+ // note the (void) syntax
+ //
+ // from program Microsoft Entourage
+ //
+ String mangled = "__dt__Q26MsoDAL9VertFrameFv";
+
+ Address addr = addr("0x110");
+ createSymbol(addr, mangled);
+
+ setOption(GnuDemanglerAnalyzer.OPTION_NAME_USE_DEPRECATED_DEMANGLER, true);
+
+ MessageLog log = new MessageLog();
+ analyzer.added(program, program.getMemory(), TaskMonitor.DUMMY, log);
+ }
+
+ private void setOption(String optionNameUseDeprecatedDemangler, boolean b) {
+
+ Options options = program.getOptions("Analyzers");
+
+ for (String name : options.getOptionNames()) {
+
+ if (name.contains("Demangler GNU")) {
+ Msg.out("found it: " + name);
+ }
+ else {
+ Msg.out("no it: " + name);
+ }
+ }
+ }
+
+ private void createSymbol(Address addr, String mangled) {
+
+ AddLabelCmd cmd = new AddLabelCmd(addr, mangled, SourceType.ANALYSIS);
+ int txId = program.startTransaction(cmd.getName());
+ boolean commit = true;
+ try {
+ boolean status = cmd.applyTo(program);
+ program.flushEvents();
+
+ if (!status) {
+ fail("Could not apply command: " + cmd.getStatusMsg());
+ }
+ }
+ catch (RollbackException e) {
+ commit = false;
+ throw e;
+ }
+ finally {
+ program.endTransaction(txId, commit);
+ }
+ }
+
+ @Test
+ public void testDeprectedDemangledString_WithArguments_Valid() {
+
+ fail();
+ }
+
+ @Test
+ public void testDeprectedDemangledString_WithArguments_Invalid() {
+
+ fail();
+ }
+
+ private Address addr(String addr) {
+ return program.getAddressFactory().getAddress(addr);
+ }
+
+ private void registerOptions() {
+ Options options = program.getOptions(Program.ANALYSIS_PROPERTIES);
+
+ Options analyzerOptions = options.getOptions(analyzer.getName());
+ analyzer.registerOptions(analyzerOptions, program);
+ }
+}
diff --git a/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/GnuDemanglerParserTest.java b/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/GnuDemanglerParserTest.java
index 5424c41c98..ec7bceda67 100644
--- a/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/GnuDemanglerParserTest.java
+++ b/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/GnuDemanglerParserTest.java
@@ -1130,7 +1130,7 @@ public class GnuDemanglerParserTest extends AbstractGenericTest {
String mangled = "uv__dup";
GnuDemangler demangler = new GnuDemangler();
- DemangledObject res = demangler.demangle(mangled, true);
+ DemangledObject res = demangler.demangle(mangled);
assertNull(res);
}
diff --git a/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/gnu/GnuDemanglerTest.java b/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/gnu/GnuDemanglerTest.java
index 902c64e59d..32874d1ece 100644
--- a/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/gnu/GnuDemanglerTest.java
+++ b/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/gnu/GnuDemanglerTest.java
@@ -23,7 +23,8 @@ import org.junit.Before;
import org.junit.Test;
import generic.test.AbstractGenericTest;
-import ghidra.app.util.demangler.*;
+import ghidra.app.util.demangler.DemangledException;
+import ghidra.app.util.demangler.DemangledObject;
import ghidra.program.database.ProgramDB;
import ghidra.program.model.address.Address;
import ghidra.program.model.data.TerminatedStringDataType;
@@ -54,7 +55,7 @@ public class GnuDemanglerTest extends AbstractGenericTest {
demangler.canDemangle(program);// this perform initialization
// this throws an exception with the bug in place
- demangler.demangle(mangled, true);
+ demangler.demangle(mangled);
}
@Test
@@ -65,8 +66,10 @@ public class GnuDemanglerTest extends AbstractGenericTest {
GnuDemangler demangler = new GnuDemangler();
demangler.canDemangle(program);// this perform initialization
+ GnuDemanglerOptions options = new GnuDemanglerOptions();
+ options.setDemangleOnlyKnownPatterns(false);
try {
- demangler.demangle(mangled, false);
+ demangler.demangle(mangled, options);
fail("Demangle should have failed attempting to demangle a non-mangled string");
}
catch (DemangledException e) {
@@ -82,7 +85,7 @@ public class GnuDemanglerTest extends AbstractGenericTest {
GnuDemangler demangler = new GnuDemangler();
demangler.canDemangle(program);// this perform initialization
- DemangledObject result = demangler.demangle(mangled, true);
+ DemangledObject result = demangler.demangle(mangled);
assertNull("Demangle did not skip a name that does not match a known mangled pattern",
result);
}
@@ -99,13 +102,13 @@ public class GnuDemanglerTest extends AbstractGenericTest {
symbolTable.createLabel(addr("01001000"), mangled, SourceType.IMPORTED);
GnuDemangler demangler = new GnuDemangler();
- DemangledObject obj = demangler.demangle(mangled, true);
+ DemangledObject obj = demangler.demangle(mangled);
assertNotNull(obj);
//assertEquals("typeinfo for AP_HAL::HAL::Callbacks", obj.getSignature(false));
assertTrue(
- obj.applyTo(program, addr("01001000"), new DemanglerOptions(), TaskMonitor.DUMMY));
+ obj.applyTo(program, addr("01001000"), new GnuDemanglerOptions(), TaskMonitor.DUMMY));
Symbol s = symbolTable.getPrimarySymbol(addr("01001000"));
assertNotNull(s);
@@ -132,13 +135,13 @@ public class GnuDemanglerTest extends AbstractGenericTest {
symbolTable.createLabel(addr("01001000"), mangled, SourceType.IMPORTED);
GnuDemangler demangler = new GnuDemangler();
- DemangledObject obj = demangler.demangle(mangled, true);
+ DemangledObject obj = demangler.demangle(mangled);
assertNotNull(obj);
assertEquals("typeinfo name for AP_HAL::HAL::Callbacks", obj.getSignature(false));
assertTrue(
- obj.applyTo(program, addr("01001000"), new DemanglerOptions(), TaskMonitor.DUMMY));
+ obj.applyTo(program, addr("01001000"), new GnuDemanglerOptions(), TaskMonitor.DUMMY));
Symbol s = symbolTable.getPrimarySymbol(addr("01001000"));
assertNotNull(s);
diff --git a/Ghidra/Features/GraphFunctionCalls/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/GraphFunctionCalls/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Features/GraphFunctionCalls/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Features/GraphFunctionCalls/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/MicrosoftDemangler/developer_scripts/MicrosoftDemanglerScript.java b/Ghidra/Features/MicrosoftDemangler/developer_scripts/MicrosoftDemanglerScript.java
index 3d4e81fb7e..f975186c91 100644
--- a/Ghidra/Features/MicrosoftDemangler/developer_scripts/MicrosoftDemanglerScript.java
+++ b/Ghidra/Features/MicrosoftDemangler/developer_scripts/MicrosoftDemanglerScript.java
@@ -94,7 +94,7 @@ public class MicrosoftDemanglerScript extends GhidraScript {
}
private void demangle(String mangled) throws Exception {
- DemangledObject demangled = demangler.demangle(mangled, true);
+ DemangledObject demangled = demangler.demangle(mangled);
printf("magled %s\ndemangled %s", mangled, demangled);
}
}
diff --git a/Ghidra/Features/MicrosoftDemangler/src/main/java/ghidra/app/plugin/core/analysis/MicrosoftDemanglerAnalyzer.java b/Ghidra/Features/MicrosoftDemangler/src/main/java/ghidra/app/plugin/core/analysis/MicrosoftDemanglerAnalyzer.java
index c98ceb23ca..f191e0cb96 100644
--- a/Ghidra/Features/MicrosoftDemangler/src/main/java/ghidra/app/plugin/core/analysis/MicrosoftDemanglerAnalyzer.java
+++ b/Ghidra/Features/MicrosoftDemangler/src/main/java/ghidra/app/plugin/core/analysis/MicrosoftDemanglerAnalyzer.java
@@ -21,6 +21,9 @@ import ghidra.app.util.importer.MessageLog;
import ghidra.framework.options.Options;
import ghidra.program.model.listing.Program;
+/**
+ * A version of the demangler analyzer to handle microsoft symbols
+ */
public class MicrosoftDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
private static final String NAME = "Demangler Microsoft";
diff --git a/Ghidra/Features/MicrosoftDemangler/src/main/java/ghidra/app/util/demangler/microsoft/MicrosoftDemangler.java b/Ghidra/Features/MicrosoftDemangler/src/main/java/ghidra/app/util/demangler/microsoft/MicrosoftDemangler.java
index 201dbfa52e..41bb8536dc 100644
--- a/Ghidra/Features/MicrosoftDemangler/src/main/java/ghidra/app/util/demangler/microsoft/MicrosoftDemangler.java
+++ b/Ghidra/Features/MicrosoftDemangler/src/main/java/ghidra/app/util/demangler/microsoft/MicrosoftDemangler.java
@@ -39,6 +39,7 @@ public class MicrosoftDemangler implements Demangler {
}
@Override
+ @Deprecated(since = "9.2", forRemoval = true)
public DemangledObject demangle(String mangled, boolean demangleOnlyKnownPatterns)
throws DemangledException {
try {
@@ -82,36 +83,4 @@ public class MicrosoftDemangler implements Demangler {
throw gde;
}
}
-
-// /**
-// * This represents an odd symbol that looks mangled, but we don't know what to do with. It
-// * is of the form:
-// * ?BobsStuffIO@344text__@@U_text@@?W
-// *
-// * where the last character is preceded by a special character, such as ?, *, -, etc
-// */
-// private static Pattern INVALID_TRAILING_CHARS_PATTERN = Pattern.compile(".*@@[?*`%~+/-][A-Z]");
-
-// private boolean isMangled(String mangled) {
-// int atpos = mangled.indexOf("@");
-// boolean isMangled = mangled.charAt(0) == '?' && atpos != -1;
-//
-// if (!isMangled) {
-// return false;
-// }
-//
-// if (mangled.endsWith("~")) {
-// return false;
-// }
-//
-// //
-// // Now check for some odd things that we've seen.
-// //
-// Matcher matcher = INVALID_TRAILING_CHARS_PATTERN.matcher(mangled);
-// if (matcher.matches()) {
-// return false;
-// }
-//
-// return true;
-// }
}
diff --git a/Ghidra/Features/MicrosoftDemangler/src/test/java/ghidra/app/util/demangler/microsoft/MicrosoftDemanglerTest.java b/Ghidra/Features/MicrosoftDemangler/src/test/java/ghidra/app/util/demangler/microsoft/MicrosoftDemanglerTest.java
index 79c5b440be..023233c13c 100644
--- a/Ghidra/Features/MicrosoftDemangler/src/test/java/ghidra/app/util/demangler/microsoft/MicrosoftDemanglerTest.java
+++ b/Ghidra/Features/MicrosoftDemangler/src/test/java/ghidra/app/util/demangler/microsoft/MicrosoftDemanglerTest.java
@@ -33,10 +33,6 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
private ProgramDB program;
- public MicrosoftDemanglerTest() {
- super();
- }
-
@Before
public void setUp() throws Exception {
ToyProgramBuilder builder = new ToyProgramBuilder("test", true);
@@ -49,7 +45,7 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
String mangled = "?Te@NS1@BobsStuff@@0QAY0BAA@$$CBIA";
MicrosoftDemangler demangler = new MicrosoftDemangler();
- DemangledObject demangledObject = demangler.demangle(mangled, true);
+ DemangledObject demangledObject = demangler.demangle(mangled);
int txID = program.startTransaction("Test");
@@ -67,7 +63,7 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
String mangled = "??0_LocaleUpdate@@QAE@PAUlocaleinfo_struct@@@Z";
MicrosoftDemangler demangler = new MicrosoftDemangler();
- DemangledObject demangledObj = demangler.demangle(mangled, true);
+ DemangledObject demangledObj = demangler.demangle(mangled);
assertNotNull(demangledObj);
}
@@ -78,7 +74,7 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
MicrosoftDemangler demangler = new MicrosoftDemangler();
DemangledObject demangledObj = null;
try {
- demangledObj = demangler.demangle(mangled, true);
+ demangledObj = demangler.demangle(mangled);
}
catch (DemangledException e) {
// Expected
@@ -94,7 +90,7 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
MicrosoftDemangler demangler = new MicrosoftDemangler();
DemangledObject demangledObj = null;
try {
- demangledObj = demangler.demangle(mangled, true);
+ demangledObj = demangler.demangle(mangled);
}
catch (DemangledException e) {
// Expected
@@ -110,7 +106,7 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
MicrosoftDemangler demangler = new MicrosoftDemangler();
DemangledObject demangledObj = null;
try {
- demangledObj = demangler.demangle(mangled, true);
+ demangledObj = demangler.demangle(mangled);
}
catch (DemangledException e) {
// Expected
@@ -126,7 +122,7 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
MicrosoftDemangler demangler = new MicrosoftDemangler();
DemangledObject demangledObj = null;
try {
- demangledObj = demangler.demangle(mangled, true);
+ demangledObj = demangler.demangle(mangled);
}
catch (DemangledException e) {
// Expected
@@ -142,7 +138,7 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
MicrosoftDemangler demangler = new MicrosoftDemangler();
DemangledObject demangledObj = null;
try {
- demangledObj = demangler.demangle(mangled, true);
+ demangledObj = demangler.demangle(mangled);
}
catch (DemangledException e) {
// Expected
@@ -158,7 +154,7 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
MicrosoftDemangler demangler = new MicrosoftDemangler();
DemangledObject demangledObj = null;
try {
- demangledObj = demangler.demangle(mangled, true);
+ demangledObj = demangler.demangle(mangled);
}
catch (DemangledException e) {
// Expected
@@ -174,7 +170,7 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
MicrosoftDemangler demangler = new MicrosoftDemangler();
DemangledObject demangledObj = null;
try {
- demangledObj = demangler.demangle(mangled, true);
+ demangledObj = demangler.demangle(mangled);
}
catch (DemangledException e) {
// Expected
@@ -190,7 +186,7 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
MicrosoftDemangler demangler = new MicrosoftDemangler();
DemangledObject demangledObj = null;
try {
- demangledObj = demangler.demangle(mangled, true);
+ demangledObj = demangler.demangle(mangled);
}
catch (DemangledException e) {
// Expected
@@ -206,7 +202,7 @@ public class MicrosoftDemanglerTest extends AbstractGenericTest {
MicrosoftDemangler demangler = new MicrosoftDemangler();
DemangledObject demangledObj = null;
try {
- demangledObj = demangler.demangle(mangled, true);
+ demangledObj = demangler.demangle(mangled);
}
catch (DemangledException e) {
// Expected
diff --git a/Ghidra/Features/PDB/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/PDB/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Features/PDB/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Features/PDB/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/ProgramDiff/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/ProgramDiff/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Features/ProgramDiff/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Features/ProgramDiff/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/Python/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/Python/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Features/Python/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Features/Python/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/SourceCodeLookup/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/SourceCodeLookup/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Features/SourceCodeLookup/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Features/SourceCodeLookup/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Features/VersionTracking/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/VersionTracking/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/Ghidra/Features/VersionTracking/src/main/help/help/shared/Frontpage.css
+++ b/Ghidra/Features/VersionTracking/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/CustomOptionComponent.java b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/CustomOptionComponent.java
index c55e2be6e8..75ac057733 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/CustomOptionComponent.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/CustomOptionComponent.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,25 +15,29 @@
*/
package docking.options.editor;
-import ghidra.framework.options.EditorState;
-
import java.awt.Dimension;
+import ghidra.framework.options.EditorState;
+import ghidra.util.layout.HorizontalLayout;
+
/**
* A custom OptionComponent that controls it's own display using the editor component of the
* given EditorState.
*/
public class CustomOptionComponent extends GenericOptionsComponent {
- protected CustomOptionComponent( EditorState editorState ) {
- super( editorState );
+ protected CustomOptionComponent(EditorState editorState) {
+ super(editorState);
- // this class is designed to let the editor component handle the display and editing
- add( editorState.getEditorComponent() );
- }
+ // this layout allows us to easily left-align the single component in this container
+ setLayout(new HorizontalLayout(0));
- @Override
- protected Dimension getPreferredAlignmentSize() {
- return new Dimension( 0, 0 );
- }
+ // this class is designed to let the editor component handle the display and editing
+ add(editorState.getEditorComponent());
+ }
+
+ @Override
+ protected Dimension getPreferredAlignmentSize() {
+ return new Dimension(0, 0);
+ }
}
diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/util/demangler/gnu/GnuDemanglerIntegrationTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/util/demangler/gnu/GnuDemanglerIntegrationTest.java
index c439821a3b..67de329e85 100644
--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/util/demangler/gnu/GnuDemanglerIntegrationTest.java
+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/util/demangler/gnu/GnuDemanglerIntegrationTest.java
@@ -21,7 +21,8 @@ import org.junit.Before;
import org.junit.Test;
import ghidra.app.cmd.label.DemanglerCmd;
-import ghidra.app.util.demangler.*;
+import ghidra.app.util.demangler.DemangledException;
+import ghidra.app.util.demangler.DemangledObject;
import ghidra.program.database.ProgramDB;
import ghidra.program.model.address.Address;
import ghidra.test.AbstractGhidraHeadlessIntegrationTest;
@@ -58,13 +59,13 @@ public class GnuDemanglerIntegrationTest extends AbstractGhidraHeadlessIntegrati
GnuDemangler demangler = new GnuDemangler();
demangler.canDemangle(program);// this perform initialization
- DemangledObject result = demangler.demangle(mangled, false);
+ GnuDemanglerOptions options = new GnuDemanglerOptions();
+ options.setDemangleOnlyKnownPatterns(false);
+ DemangledObject result = demangler.demangle(mangled, options);
assertNotNull(result);
assertEquals("undefined MyNamespace::MyFunction($ParamNamespace::paramName *)",
result.getSignature(false));
- DemanglerOptions options = new DemanglerOptions();
- options.setDemangleOnlyKnownPatterns(false);
DemanglerCmd cmd = new DemanglerCmd(addr("01001000"), mangled, options);
// this used to trigger an exception
diff --git a/GhidraBuild/Skeleton/src/main/help/help/shared/Frontpage.css b/GhidraBuild/Skeleton/src/main/help/help/shared/Frontpage.css
index 452bf6e6b5..b8471669f4 100644
--- a/GhidraBuild/Skeleton/src/main/help/help/shared/Frontpage.css
+++ b/GhidraBuild/Skeleton/src/main/help/help/shared/Frontpage.css
@@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
/*
@@ -55,4 +55,10 @@ table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
diff --git a/GhidraDocs/languages/html/Frontpage.css b/GhidraDocs/languages/html/Frontpage.css
index 4c4f708c53..b8471669f4 100644
--- a/GhidraDocs/languages/html/Frontpage.css
+++ b/GhidraDocs/languages/html/Frontpage.css
@@ -24,13 +24,13 @@
*/
-body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px;} /* some padding to improve readability */
+body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 10px; } /* some padding to improve readability */
li { font-family:times new roman; font-size:14pt; }
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
-h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
-h4 { margin-left: 10px; font-family:times new roman; font-size:14pt; font-style:italic; }
-
+h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; }
+h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
+
/*
P tag code. Most of the help files nest P tags inside of blockquote tags (the was the
way it had been done in the beginning). The net effect is that the text is indented. In
@@ -40,12 +40,25 @@ h4 { margin-left: 10px; font-family:times new roman; font-size:14pt; font-style:
*/
p { margin-left: 40px; font-family:times new roman; font-size:14pt; }
blockquote p { margin-left: 10px; }
+
p.providedbyplugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
p.ProvidedByPlugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
p.relatedtopic { color:#800080; margin-left: 10px; font-size:14pt; }
p.RelatedTopic { color:#800080; margin-left: 10px; font-size:14pt; }
-
+/*
+ We wish for a tables to have space between it and the preceding element, so that text
+ is not too close to the top of the table. Also, nest the table a bit so that it is clear
+ the table relates to the preceding text.
+*/
+table { margin-left: 20px; margin-top: 10px; width: 80%;}
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
-code { color: black; font-family: courier new; font-size: 14pt; }
+
+/*
+ Code-like formatting for things such as file system paths and proper names of classes,
+ methods, etc. To apply this to a file path, use this syntax:
+ ...
+*/
+code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
+code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }