mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
273fe030cb
10 changed files with 161 additions and 147 deletions
|
@ -773,7 +773,7 @@ public abstract class PcodeEmit {
|
|||
}
|
||||
}
|
||||
for (int i = 0; i < isize; ++i) {
|
||||
VarnodeData v = in[0];
|
||||
VarnodeData v = in[i];
|
||||
if (v.space.equals(overlayspace)) {
|
||||
v.space = ((OverlayAddressSpace) v.space).getOverlayedSpace();
|
||||
}
|
||||
|
|
|
@ -545,7 +545,7 @@ class EnumDB extends DataTypeDB implements Enum {
|
|||
if (subValue != 0) {
|
||||
String part = getName(subValue);
|
||||
if (part == null) {
|
||||
part = getStringForNoMatchingValue(subValue);
|
||||
part = Long.toHexString(subValue).toUpperCase() + 'h';
|
||||
}
|
||||
if (buf.length() != 0) {
|
||||
buf.append(" | ");
|
||||
|
@ -563,19 +563,6 @@ class EnumDB extends DataTypeDB implements Enum {
|
|||
return bitGroups;
|
||||
}
|
||||
|
||||
private String getStringForNoMatchingValue(long value) {
|
||||
String valueName;
|
||||
String valueStr;
|
||||
if (value < 0 || value >= 32) {
|
||||
valueStr = "0x" + Long.toHexString(value);
|
||||
}
|
||||
else {
|
||||
valueStr = Long.toString(value);
|
||||
}
|
||||
valueName = "" + valueStr;
|
||||
return valueName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEquivalent(DataType dt) {
|
||||
if (dt == this) {
|
||||
|
|
|
@ -342,7 +342,7 @@ public class EnumDataType extends GenericDataType implements Enum {
|
|||
if (subValue != 0) {
|
||||
String part = getName(subValue);
|
||||
if (part == null) {
|
||||
part = getStringForNoMatchingValue(subValue);
|
||||
part = Long.toHexString(subValue).toUpperCase() + 'h';
|
||||
}
|
||||
if (buf.length() != 0) {
|
||||
buf.append(" | ");
|
||||
|
@ -360,19 +360,6 @@ public class EnumDataType extends GenericDataType implements Enum {
|
|||
return bitGroups;
|
||||
}
|
||||
|
||||
private String getStringForNoMatchingValue(long value) {
|
||||
String valueName;
|
||||
String valueStr;
|
||||
if (value < 0 || value >= 32) {
|
||||
valueStr = "0x" + Long.toHexString(value);
|
||||
}
|
||||
else {
|
||||
valueStr = Long.toString(value);
|
||||
}
|
||||
valueName = "" + valueStr;
|
||||
return valueName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEquivalent(DataType dt) {
|
||||
if (dt == this) {
|
||||
|
|
|
@ -24,12 +24,12 @@ import java.util.*;
|
|||
public class EnumValuePartitioner {
|
||||
|
||||
private static void merge(List<BitGroup> list, BitGroup bitGroup) {
|
||||
Iterator<BitGroup> iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BitGroup next = iterator.next();
|
||||
Iterator<BitGroup> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
BitGroup next = it.next();
|
||||
if (bitGroup.intersects(next)) {
|
||||
bitGroup.merge(next);
|
||||
iterator.remove();
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
list.add(bitGroup);
|
||||
|
@ -43,15 +43,18 @@ public class EnumValuePartitioner {
|
|||
*/
|
||||
public static List<BitGroup> partition(long[] values, int size) {
|
||||
List<BitGroup> list = new LinkedList<>();
|
||||
long totalMask = 0;
|
||||
long usedBits = 0;
|
||||
for (long value : values) {
|
||||
totalMask |= value;
|
||||
usedBits |= value;
|
||||
BitGroup bitGroup = new BitGroup(value);
|
||||
merge(list, bitGroup);
|
||||
}
|
||||
|
||||
// now create a BitGroup for all bits not accounted for
|
||||
long enumMask = ~(-1 << (size * 8));
|
||||
list.add(new BitGroup(~totalMask & enumMask));
|
||||
int bits = size * 8;
|
||||
long allEnumBits = ~(-1L << bits);
|
||||
long unusedBits = ~usedBits;
|
||||
list.add(new BitGroup(unusedBits & allEnumBits));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ParameterDefinitionImpl implements ParameterDefinition {
|
|||
* <ul>
|
||||
* <li>Function definition datatype</li>
|
||||
* <li>An unsized/zero-element array</li>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* @param dataType datatype to be checked. If null specified the DEFAULT datatype will be returned.
|
||||
* @param dtMgr target datatype manager (null permitted which will adopt default data organization)
|
||||
* @param voidOK true if checking return datatype and void is allow, else false.
|
||||
|
@ -159,7 +159,7 @@ public class ParameterDefinitionImpl implements ParameterDefinition {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return dataType.getName() + " " + name;
|
||||
return dataType.getName() + " " + (name == null ? "" : name);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue