mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
Merge remote-tracking branch 'origin/GT-3514-dragonmacher-find-uses-exception'
This commit is contained in:
commit
c236edea6e
4 changed files with 28 additions and 20 deletions
|
@ -24,6 +24,8 @@ import java.util.*;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import docking.widgets.fieldpanel.field.FieldElement;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import docking.widgets.fieldpanel.support.Highlight;
|
||||
|
@ -450,16 +452,14 @@ public class ListingHighlightProvider
|
|||
text = StringUtilities.findWord(text, pos, UNDERSCORE_AND_PERIOD_OK);
|
||||
}
|
||||
|
||||
if (text != null) {
|
||||
text = text.trim();
|
||||
if (text.length() == 0) {
|
||||
if (StringUtils.isBlank(text)) {
|
||||
text = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (text != null) {
|
||||
else {
|
||||
text = text.trim();
|
||||
currentHighlightPattern = Pattern.compile(text, Pattern.LITERAL);
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,8 @@ public class LocationReferencesPlugin extends Plugin
|
|||
private void displayProviderForLocation(ProgramLocation location, Navigatable navigatable) {
|
||||
LocationDescriptor locationDescriptor = getLocationDescriptor(location);
|
||||
if (locationDescriptor == null) {
|
||||
throw new IllegalArgumentException("Unable to display provider - unknown location");
|
||||
throw new IllegalArgumentException(
|
||||
"Unable to display provider - unknown location: " + location);
|
||||
}
|
||||
|
||||
LocationReferencesProvider provider = findProvider(locationDescriptor, navigatable);
|
||||
|
|
|
@ -711,16 +711,9 @@ public final class ReferenceUtils {
|
|||
return null;
|
||||
}
|
||||
|
||||
List<Object> objects = variableOffset.getObjects();
|
||||
Object object = objects.get((int) variableOffset.getOffset());
|
||||
if (!(object instanceof LabelString)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Variable variable = variableOffset.getVariable();
|
||||
DataType type = variable.getDataType();
|
||||
LabelString label = (LabelString) object;
|
||||
String string = label.toString();
|
||||
String string = variableOffset.getDataTypeDisplayText();
|
||||
GenericDataTypeLocationDescriptor descriptor =
|
||||
createGenericDataTypeLocationDescriptor(program, type, string);
|
||||
return descriptor;
|
||||
|
|
|
@ -120,16 +120,22 @@ public class VariableOffset {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get list of markup objects
|
||||
* @return list of markup objects
|
||||
* Returns the data type access portion of this variable offset as a string
|
||||
* @return the text
|
||||
*/
|
||||
public List<Object> getObjects() {
|
||||
public String getDataTypeDisplayText() {
|
||||
List<Object> objects = getObjects(false);
|
||||
LabelString labelString = (LabelString) objects.get(0);
|
||||
return labelString.toString();
|
||||
}
|
||||
|
||||
private List<Object> getObjects(boolean showScalarAdjustment) {
|
||||
|
||||
DataType dt = variable.getDataType();
|
||||
StringBuffer name = new StringBuffer(variable.getName());
|
||||
|
||||
long scalarAdjustment = 0;
|
||||
if (includeScalarAdjustment && (replacedElement instanceof Scalar)) {
|
||||
if (showScalarAdjustment && (replacedElement instanceof Scalar)) {
|
||||
Scalar s = (Scalar) replacedElement;
|
||||
scalarAdjustment = variable.isStackVariable() ? s.getSignedValue() : s.getValue();
|
||||
scalarAdjustment -= offset;
|
||||
|
@ -214,6 +220,14 @@ public class VariableOffset {
|
|||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of markup objects
|
||||
* @return list of markup objects
|
||||
*/
|
||||
public List<Object> getObjects() {
|
||||
return getObjects(includeScalarAdjustment);
|
||||
}
|
||||
|
||||
public Variable getVariable() {
|
||||
return variable;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue