mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
4129d08611
18 changed files with 215 additions and 264 deletions
|
@ -20,9 +20,8 @@ import javax.swing.JComponent;
|
|||
import docking.widgets.fieldpanel.field.Field;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.plugin.core.hover.AbstractDataTypeHover;
|
||||
import ghidra.app.plugin.core.hover.AbstractConfigurableHover;
|
||||
import ghidra.app.util.ToolTipUtils;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.data.*;
|
||||
|
@ -33,7 +32,7 @@ import ghidra.program.util.*;
|
|||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.UniversalID;
|
||||
|
||||
public class DataTypeListingHover extends AbstractDataTypeHover implements ListingHoverService {
|
||||
public class DataTypeListingHover extends AbstractConfigurableHover implements ListingHoverService {
|
||||
|
||||
private static final String NAME = "Data Type Display";
|
||||
private static final String DESCRIPTION =
|
||||
|
@ -41,23 +40,23 @@ public class DataTypeListingHover extends AbstractDataTypeHover implements Listi
|
|||
"when the mouse hovers over a data type.";
|
||||
private static final int PRIORITY = 20;
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
public DataTypeListingHover(PluginTool tool) {
|
||||
super(tool, PRIORITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeOptions() {
|
||||
options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_POPUPS);
|
||||
options.registerOption(NAME, true, null, DESCRIPTION);
|
||||
setOptions(options, NAME);
|
||||
options.addOptionsChangeListener(this);
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptions(Options options, String name) {
|
||||
enabled = options.getBoolean(NAME, true);
|
||||
protected String getDescription() {
|
||||
return DESCRIPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOptionsCategory() {
|
||||
return GhidraOptions.CATEGORY_BROWSER_POPUPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,6 @@ import docking.widgets.fieldpanel.field.Field;
|
|||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.plugin.core.hover.AbstractConfigurableHover;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.symbol.*;
|
||||
|
@ -43,25 +42,23 @@ public class FunctionNameListingHover extends AbstractConfigurableHover
|
|||
"when displaying namespaces.";
|
||||
private static final int PRIORITY = 20;
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
public FunctionNameListingHover(PluginTool tool) {
|
||||
super(tool, PRIORITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeOptions() {
|
||||
options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_POPUPS);
|
||||
options.registerOption(NAME, true, null, DESCRIPTION);
|
||||
setOptions(options, NAME);
|
||||
options.addOptionsChangeListener(this);
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptions(Options options, String optionName) {
|
||||
if (optionName.equals(NAME)) {
|
||||
enabled = options.getBoolean(NAME, true);
|
||||
}
|
||||
protected String getDescription() {
|
||||
return DESCRIPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOptionsCategory() {
|
||||
return GhidraOptions.CATEGORY_BROWSER_POPUPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,6 @@ import docking.widgets.fieldpanel.field.Field;
|
|||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.plugin.core.hover.AbstractConfigurableHover;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.database.mem.AddressSourceInfo;
|
||||
import ghidra.program.model.address.*;
|
||||
|
@ -59,18 +58,18 @@ public class ProgramAddressRelationshipListingHover extends AbstractConfigurable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initializeOptions() {
|
||||
options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_POPUPS);
|
||||
options.registerOption(NAME, true, null, DESCRIPTION);
|
||||
setOptions(options, NAME);
|
||||
options.addOptionsChangeListener(this);
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptions(Options options, String optionName) {
|
||||
if (optionName.equals(NAME)) {
|
||||
enabled = options.getBoolean(NAME, true);
|
||||
}
|
||||
protected String getDescription() {
|
||||
return DESCRIPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOptionsCategory() {
|
||||
return GhidraOptions.CATEGORY_BROWSER_POPUPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,14 +18,11 @@ package ghidra.app.plugin.core.codebrowser.hover;
|
|||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.plugin.core.hover.AbstractReferenceHover;
|
||||
import ghidra.app.services.CodeFormatService;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
public class ReferenceListingHover extends AbstractReferenceHover implements ListingHoverService {
|
||||
|
||||
protected static final String NAME = "Reference Code Viewer";
|
||||
private static final String NAME = "Reference Code Viewer";
|
||||
|
||||
private static final String DESCRIPTION =
|
||||
"Shows \"referred to\" code and data within the listing.";
|
||||
|
@ -41,23 +38,18 @@ public class ReferenceListingHover extends AbstractReferenceHover implements Lis
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initializeOptions() {
|
||||
options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_POPUPS);
|
||||
|
||||
options.setOptionsHelpLocation(new HelpLocation(HelpTopics.CODE_BROWSER, "MouseHover"));
|
||||
HelpLocation help = new HelpLocation(HelpTopics.CODE_BROWSER, "ReferenceHover");
|
||||
options.getOptions(NAME).setOptionsHelpLocation(help);
|
||||
|
||||
options.registerOption(NAME, true, help, DESCRIPTION);
|
||||
|
||||
options.registerOption(NAME + Options.DELIMITER + "Dialog Height", 400, help,
|
||||
"Height of the popup window");
|
||||
options.registerOption(NAME + Options.DELIMITER + "Dialog Width", 600, help,
|
||||
"Width of the popup window");
|
||||
|
||||
setOptions(options, NAME);
|
||||
options.addOptionsChangeListener(this);
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDescription() {
|
||||
return DESCRIPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOptionsCategory() {
|
||||
return GhidraOptions.CATEGORY_BROWSER_POPUPS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import docking.widgets.fieldpanel.field.Field;
|
|||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.plugin.core.hover.AbstractScalarOperandHover;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.lang.InstructionPrototype;
|
||||
|
@ -47,18 +46,18 @@ public class ScalarOperandListingHover extends AbstractScalarOperandHover
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initializeOptions() {
|
||||
options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_POPUPS);
|
||||
options.registerOption(NAME, true, null, DESCRIPTION);
|
||||
setOptions(options, NAME);
|
||||
options.addOptionsChangeListener(this);
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptions(Options options, String optionName) {
|
||||
if (optionName.equals(NAME)) {
|
||||
enabled = options.getBoolean(NAME, true);
|
||||
}
|
||||
protected String getDescription() {
|
||||
return DESCRIPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOptionsCategory() {
|
||||
return GhidraOptions.CATEGORY_BROWSER_POPUPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,15 +21,12 @@ import javax.swing.JToolTip;
|
|||
import docking.widgets.fieldpanel.field.Field;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.plugin.core.hover.AbstractTruncatedTextHover;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.app.plugin.core.hover.AbstractConfigurableHover;
|
||||
import ghidra.app.util.viewer.field.ListingTextField;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
/**
|
||||
* A hover service to show tool tip text for hovering over a truncated field, containing a "...",
|
||||
|
@ -38,18 +35,34 @@ import ghidra.util.HelpLocation;
|
|||
* This provides the hover capability for the TruncatedTextHoverPlugin and can
|
||||
* also be used to directly provide this hover capability to a listing.
|
||||
*/
|
||||
public class TruncatedTextListingHover extends AbstractTruncatedTextHover
|
||||
public class TruncatedTextListingHover extends AbstractConfigurableHover
|
||||
implements ListingHoverService {
|
||||
|
||||
private static final String NAME = "Truncated Text Display";
|
||||
private static final String DESCRIPTION =
|
||||
"Toggle whether truncated text is displayed in a tooltip " +
|
||||
"when the mouse hovers over a field that is truncated.";
|
||||
private static final int POPUP_PRIORITY = 10;
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
public TruncatedTextListingHover(PluginTool tool) {
|
||||
super(tool, POPUP_PRIORITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDescription() {
|
||||
return DESCRIPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOptionsCategory() {
|
||||
return GhidraOptions.CATEGORY_BROWSER_POPUPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getHoverComponent(Program program, ProgramLocation programLocation,
|
||||
FieldLocation fieldLocation, Field field) {
|
||||
|
@ -68,21 +81,4 @@ public class TruncatedTextListingHover extends AbstractTruncatedTextHover
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeOptions() {
|
||||
options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_POPUPS);
|
||||
options.setOptionsHelpLocation(new HelpLocation(HelpTopics.CODE_BROWSER, "MouseHover"));
|
||||
options.registerOption(NAME, true,
|
||||
new HelpLocation(HelpTopics.CODE_BROWSER, "TruncatedTextPopup"),
|
||||
"Toggle whether truncated text is displayed in a tooltip " +
|
||||
"when the mouse hovers over a field that is truncated.");
|
||||
setOptions(options, NAME);
|
||||
options.addOptionsChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptions(Options options, String name) {
|
||||
enabled = options.getBoolean(NAME, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,13 +15,15 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.hover;
|
||||
|
||||
import ghidra.framework.options.ToolOptions;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.util.Disposable;
|
||||
|
||||
/**
|
||||
* A listing or decompiler hover that employs some degree of configurability.
|
||||
*/
|
||||
public abstract class AbstractConfigurableHover extends AbstractHover implements ConfigurableHover {
|
||||
public abstract class AbstractConfigurableHover extends AbstractHover
|
||||
implements Disposable, OptionsChangeListener {
|
||||
|
||||
protected ToolOptions options;
|
||||
|
||||
|
@ -30,6 +32,12 @@ public abstract class AbstractConfigurableHover extends AbstractHover implements
|
|||
initializeOptions();
|
||||
}
|
||||
|
||||
protected abstract String getName();
|
||||
|
||||
protected abstract String getDescription();
|
||||
|
||||
protected abstract String getOptionsCategory();
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (options != null) {
|
||||
|
@ -39,8 +47,24 @@ public abstract class AbstractConfigurableHover extends AbstractHover implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions theOptions, String optionName, Object oldValue, Object newValue) {
|
||||
public void optionsChanged(ToolOptions theOptions, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
setOptions(theOptions, optionName);
|
||||
}
|
||||
|
||||
public void initializeOptions() {
|
||||
options = tool.getOptions(getOptionsCategory());
|
||||
|
||||
String hoverName = getName();
|
||||
options.registerOption(hoverName, true, null, getDescription());
|
||||
setOptions(options, hoverName);
|
||||
options.addOptionsChangeListener(this);
|
||||
}
|
||||
|
||||
public void setOptions(Options options, String optionName) {
|
||||
String hoverName = getName();
|
||||
if (optionName.equals(hoverName)) {
|
||||
enabled = options.getBoolean(hoverName, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,32 +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.hover;
|
||||
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
|
||||
/**
|
||||
* A hover service to show tool tip text for hovering over data types.
|
||||
* The tooltip shows a preview of the data type.
|
||||
* This provides the hover capability for the DataTypeHoverPlugin and can
|
||||
* also be used to directly provide this hover capability to a listing.
|
||||
*/
|
||||
public abstract class AbstractDataTypeHover extends AbstractConfigurableHover {
|
||||
|
||||
public AbstractDataTypeHover(PluginTool tool, int priority) {
|
||||
super(tool, priority);
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.hover;
|
||||
|
||||
import static ghidra.util.HTMLUtilities.HTML;
|
||||
import static ghidra.util.HTMLUtilities.*;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
|
@ -35,6 +35,7 @@ import ghidra.program.model.listing.*;
|
|||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.bean.opteditor.OptionsVetoException;
|
||||
|
||||
/**
|
||||
|
@ -42,15 +43,14 @@ import ghidra.util.bean.opteditor.OptionsVetoException;
|
|||
*/
|
||||
public abstract class AbstractReferenceHover extends AbstractConfigurableHover {
|
||||
|
||||
public static final int WINDOW_OFFSET = 50;
|
||||
private static final int WINDOW_OFFSET = 50;
|
||||
private static final Color BACKGROUND_COLOR = new Color(255, 255, 230);
|
||||
|
||||
protected static final Color BACKGROUND_COLOR = new Color(255, 255, 230);
|
||||
|
||||
protected CodeFormatService codeFormatService;
|
||||
protected ListingPanel panel;
|
||||
protected JToolTip toolTip;
|
||||
protected ProgramLocation previewLocation;
|
||||
protected GoToHelper gotoHelper;
|
||||
private CodeFormatService codeFormatService;
|
||||
private ListingPanel panel;
|
||||
private JToolTip toolTip;
|
||||
private ProgramLocation previewLocation;
|
||||
private GoToHelper gotoHelper;
|
||||
|
||||
public AbstractReferenceHover(PluginTool tool, int priority) {
|
||||
this(tool, null, priority);
|
||||
|
@ -82,23 +82,55 @@ public abstract class AbstractReferenceHover extends AbstractConfigurableHover {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setOptions(Options options, String name) {
|
||||
enabled = options.getBoolean(name, true);
|
||||
int dialogWidth = options.getInt(name + Options.DELIMITER + "Dialog Width", 600);
|
||||
if (dialogWidth <= 0) {
|
||||
throw new OptionsVetoException(
|
||||
"Reference Code Viewer Dialog Width must be greater than 0");
|
||||
public void initializeOptions() {
|
||||
|
||||
options = tool.getOptions(getOptionsCategory());
|
||||
|
||||
options.setOptionsHelpLocation(new HelpLocation(HelpTopics.CODE_BROWSER, "MouseHover"));
|
||||
HelpLocation help = new HelpLocation(HelpTopics.CODE_BROWSER, "ReferenceHover");
|
||||
|
||||
String hoverName = getName();
|
||||
options.getOptions(hoverName).setOptionsHelpLocation(help);
|
||||
options.registerOption(hoverName, true, null, getDescription());
|
||||
|
||||
options.registerOption(hoverName + Options.DELIMITER + "Dialog Height", 400, help,
|
||||
"Height of the popup window");
|
||||
options.registerOption(hoverName + Options.DELIMITER + "Dialog Width", 600, help,
|
||||
"Width of the popup window");
|
||||
|
||||
setOptions(options, hoverName);
|
||||
options.addOptionsChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptions(Options options, String optionName) {
|
||||
|
||||
String hoverName = getName();
|
||||
if (optionName.equals(hoverName)) {
|
||||
enabled = options.getBoolean(hoverName, true);
|
||||
return;
|
||||
}
|
||||
|
||||
int dialogHeight = options.getInt(name + Options.DELIMITER + "Dialog Height", 400);
|
||||
if (dialogHeight <= 0) {
|
||||
throw new OptionsVetoException(
|
||||
"Reference Code Viewer Dialog Height must be greater than 0");
|
||||
}
|
||||
String widthOptionName = optionName + Options.DELIMITER + "Dialog Width";
|
||||
String heightOptionName = optionName + Options.DELIMITER + "Dialog Height";
|
||||
|
||||
Dimension d = new Dimension(dialogWidth, dialogHeight);
|
||||
if (panel != null) {
|
||||
panel.setPreferredSize(d);
|
||||
if (optionName.equals(widthOptionName) ||
|
||||
optionName.equals(heightOptionName)) {
|
||||
int dialogWidth = options.getInt(widthOptionName, 600);
|
||||
if (dialogWidth <= 0) {
|
||||
throw new OptionsVetoException(
|
||||
"Reference Code Viewer Dialog Width must be greater than 0");
|
||||
}
|
||||
int dialogHeight = options.getInt(heightOptionName, 400);
|
||||
if (dialogHeight <= 0) {
|
||||
throw new OptionsVetoException(
|
||||
"Reference Code Viewer Dialog Height must be greater than 0");
|
||||
}
|
||||
|
||||
Dimension d = new Dimension(dialogWidth, dialogHeight);
|
||||
if (panel != null) {
|
||||
panel.setPreferredSize(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -131,14 +131,14 @@ public abstract class AbstractScalarOperandHover extends AbstractConfigurableHov
|
|||
if (localHTMLText.length() > 0) {
|
||||
htmlText.append("<hr>");
|
||||
htmlText.append("<table width=\"100%\">") //
|
||||
.append(localHTMLText) //
|
||||
.append("</table>");
|
||||
.append(localHTMLText) //
|
||||
.append("</table>");
|
||||
}
|
||||
}
|
||||
|
||||
private String appendCharDataTypeFormattedHTML(String prevCharVal, DataType charDt,
|
||||
ByteMemBufferImpl charMemBuffer, StringBuilder htmlText) {
|
||||
// appends a HTML table row to the stringbuilder with the scalar displayed as the
|
||||
// appends a HTML table row to the string builder with the scalar displayed as the
|
||||
// specified data type, only if its a value that hasn't already been added to the buffer.
|
||||
|
||||
if (charMemBuffer.getLength() >= charDt.getLength()) {
|
||||
|
@ -155,11 +155,11 @@ public abstract class AbstractScalarOperandHover extends AbstractConfigurableHov
|
|||
|| hasEncodingError(charVal);
|
||||
if (!shouldSkip) {
|
||||
htmlText.append("<tr><td>") //
|
||||
.append(charDt.getName()) //
|
||||
.append(isArray ? "[]" : "");
|
||||
.append(charDt.getName()) //
|
||||
.append(isArray ? "[]" : "");
|
||||
htmlText.append("</td><td>") //
|
||||
.append(HTMLUtilities.friendlyEncodeHTML(charRep)) //
|
||||
.append("</td></tr>");
|
||||
.append(HTMLUtilities.friendlyEncodeHTML(charRep)) //
|
||||
.append("</td></tr>");
|
||||
prevCharVal = charVal;
|
||||
}
|
||||
}
|
||||
|
@ -213,8 +213,9 @@ public abstract class AbstractScalarOperandHover extends AbstractConfigurableHov
|
|||
}
|
||||
|
||||
private boolean hasEncodingError(String s) {
|
||||
return s.codePoints().anyMatch(
|
||||
codePoint -> codePoint == StringUtilities.UNICODE_REPLACEMENT);
|
||||
return s.codePoints()
|
||||
.anyMatch(
|
||||
codePoint -> codePoint == StringUtilities.UNICODE_REPLACEMENT);
|
||||
}
|
||||
|
||||
private ByteMemBufferImpl getScalarOperandAsMemBuffer(Address addr, Scalar scalar,
|
||||
|
|
|
@ -1,25 +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.hover;
|
||||
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
|
||||
public abstract class AbstractTruncatedTextHover extends AbstractConfigurableHover {
|
||||
|
||||
public AbstractTruncatedTextHover(PluginTool tool, int priority) {
|
||||
super(tool, priority);
|
||||
}
|
||||
}
|
|
@ -1,28 +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.hover;
|
||||
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.options.OptionsChangeListener;
|
||||
import ghidra.util.Disposable;
|
||||
|
||||
public interface ConfigurableHover extends OptionsChangeListener, Disposable {
|
||||
|
||||
public void initializeOptions();
|
||||
|
||||
public void setOptions(Options options, String optionName);
|
||||
|
||||
}
|
|
@ -22,9 +22,8 @@ import docking.widgets.fieldpanel.support.FieldLocation;
|
|||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.decompiler.*;
|
||||
import ghidra.app.decompiler.component.ClangTextField;
|
||||
import ghidra.app.plugin.core.hover.AbstractDataTypeHover;
|
||||
import ghidra.app.plugin.core.hover.AbstractConfigurableHover;
|
||||
import ghidra.app.util.ToolTipUtils;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.program.model.listing.Program;
|
||||
|
@ -32,7 +31,7 @@ import ghidra.program.model.pcode.HighVariable;
|
|||
import ghidra.program.model.pcode.Varnode;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
|
||||
public class DataTypeDecompilerHover extends AbstractDataTypeHover
|
||||
public class DataTypeDecompilerHover extends AbstractConfigurableHover
|
||||
implements DecompilerHoverService {
|
||||
|
||||
private static final String NAME = "Data Type Display";
|
||||
|
@ -45,18 +44,18 @@ public class DataTypeDecompilerHover extends AbstractDataTypeHover
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initializeOptions() {
|
||||
options = tool.getOptions(GhidraOptions.CATEGORY_DECOMPILER_POPUPS);
|
||||
options.registerOption(NAME, true, null, DESCRIPTION);
|
||||
setOptions(options, NAME);
|
||||
options.addOptionsChangeListener(this);
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptions(Options options, String optionName) {
|
||||
if (optionName.equals(NAME)) {
|
||||
enabled = options.getBoolean(NAME, true);
|
||||
}
|
||||
protected String getDescription() {
|
||||
return DESCRIPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOptionsCategory() {
|
||||
return GhidraOptions.CATEGORY_DECOMPILER_POPUPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,7 +26,6 @@ import ghidra.app.decompiler.*;
|
|||
import ghidra.app.decompiler.component.ClangTextField;
|
||||
import ghidra.app.plugin.core.hover.AbstractConfigurableHover;
|
||||
import ghidra.app.util.ToolTipUtils;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.data.AbstractIntegerDataType;
|
||||
|
@ -55,18 +54,18 @@ public class FunctionSignatureDecompilerHover extends AbstractConfigurableHover
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initializeOptions() {
|
||||
options = tool.getOptions(GhidraOptions.CATEGORY_DECOMPILER_POPUPS);
|
||||
options.registerOption(NAME, true, null, DESCRIPTION);
|
||||
setOptions(options, NAME);
|
||||
options.addOptionsChangeListener(this);
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptions(Options options, String optionName) {
|
||||
if (optionName.equals(NAME)) {
|
||||
enabled = options.getBoolean(NAME, true);
|
||||
}
|
||||
protected String getDescription() {
|
||||
return DESCRIPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOptionsCategory() {
|
||||
return GhidraOptions.CATEGORY_DECOMPILER_POPUPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,20 +21,16 @@ import docking.widgets.fieldpanel.field.Field;
|
|||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.plugin.core.hover.AbstractReferenceHover;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
public class ReferenceDecompilerHover extends AbstractReferenceHover
|
||||
implements DecompilerHoverService {
|
||||
|
||||
protected static final String NAME = "Decompiler Reference Viewer";
|
||||
|
||||
private static final String NAME = "Decompiler Reference Viewer";
|
||||
private static final String DESCRIPTION =
|
||||
"Shows \"referred to\" code and data from the decompiler.";
|
||||
|
||||
|
@ -45,22 +41,18 @@ public class ReferenceDecompilerHover extends AbstractReferenceHover
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initializeOptions() {
|
||||
options = tool.getOptions(GhidraOptions.CATEGORY_DECOMPILER_POPUPS);
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
options.setOptionsHelpLocation(new HelpLocation(HelpTopics.CODE_BROWSER, "MouseHover"));
|
||||
HelpLocation help = new HelpLocation(HelpTopics.CODE_BROWSER, "ReferenceHover");
|
||||
options.getOptions(NAME).setOptionsHelpLocation(help);
|
||||
@Override
|
||||
protected String getDescription() {
|
||||
return DESCRIPTION;
|
||||
}
|
||||
|
||||
options.registerOption(NAME, true, null, DESCRIPTION);
|
||||
|
||||
options.registerOption(NAME + Options.DELIMITER + "Dialog Height", 400, help,
|
||||
"Height of the popup window");
|
||||
options.registerOption(NAME + Options.DELIMITER + "Dialog Width", 600, help,
|
||||
"Width of the popup window");
|
||||
|
||||
setOptions(options, NAME);
|
||||
options.addOptionsChangeListener(this);
|
||||
@Override
|
||||
protected String getOptionsCategory() {
|
||||
return GhidraOptions.CATEGORY_DECOMPILER_POPUPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import ghidra.app.decompiler.ClangToken;
|
|||
import ghidra.app.decompiler.ClangVariableToken;
|
||||
import ghidra.app.decompiler.component.ClangTextField;
|
||||
import ghidra.app.plugin.core.hover.AbstractScalarOperandHover;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.data.AbstractIntegerDataType;
|
||||
|
@ -39,8 +38,8 @@ public class ScalarValueDecompilerHover extends AbstractScalarOperandHover
|
|||
|
||||
private static final int PRIORITY = 20;
|
||||
|
||||
protected static final String NAME = "Scalar Operand Display";
|
||||
protected static final String DESCRIPTION =
|
||||
private static final String NAME = "Scalar Operand Display";
|
||||
private static final String DESCRIPTION =
|
||||
"Scalars are shown as 1-, 2-, 4-, and 8-byte values, each in decimal, hexadecimal, and " +
|
||||
"as ASCII character sequences.";
|
||||
|
||||
|
@ -49,18 +48,18 @@ public class ScalarValueDecompilerHover extends AbstractScalarOperandHover
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initializeOptions() {
|
||||
options = tool.getOptions(GhidraOptions.CATEGORY_DECOMPILER_POPUPS);
|
||||
options.registerOption(NAME, true, null, DESCRIPTION);
|
||||
setOptions(options, NAME);
|
||||
options.addOptionsChangeListener(this);
|
||||
protected String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptions(Options options, String optionName) {
|
||||
if (optionName.equals(NAME)) {
|
||||
enabled = options.getBoolean(NAME, true);
|
||||
}
|
||||
protected String getDescription() {
|
||||
return DESCRIPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOptionsCategory() {
|
||||
return GhidraOptions.CATEGORY_DECOMPILER_POPUPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -403,11 +403,12 @@ public class PointerDataType extends BuiltIn implements Pointer {
|
|||
try {
|
||||
switch (dataLen) {
|
||||
case 2: // near pointer
|
||||
offset = (int) buf.getVarLengthUnsignedInt(0, dataLen);
|
||||
offset = buf.getUnsignedShort(0);
|
||||
break;
|
||||
case 4: // far pointer
|
||||
segment = buf.getUnsignedShort(0);
|
||||
offset = buf.getUnsignedShort(2);
|
||||
long value = buf.getUnsignedInt(0);
|
||||
segment = (int) (value >> 16);
|
||||
offset = (int) (value & 0xffff);
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
|
|
|
@ -184,6 +184,13 @@ define pcodeop special2;
|
|||
Status = Status | 1;
|
||||
}
|
||||
|
||||
# MIPS R3000 and prior only, replaced with ERET in R4000 and later
|
||||
# 0100 0010 0000 0000 0000 0000 0001 0000
|
||||
:rfe is $(AMODE) & prime=0x10 & fct=0x10 & bit25=1 & copfill=0 {
|
||||
local currentStatus = Status;
|
||||
Status = (currentStatus & 0xfffffff0) | ((currentStatus & 0x3c) >> 2);
|
||||
}
|
||||
|
||||
# 0100 0010 0000 0000 0000 0000 0001 1000
|
||||
:eret is $(AMODE) & prime=0x10 & fct=0x18 & bit25=1 & copfill=0 {
|
||||
return[EPC];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue