Merge remote-tracking branch

'origin/GP-3260_ghidra1_ElfMipsRelocs--SQUASHED' (Closes #5160)

Conflicts:
	Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/extension/datatype/finder/DecompilerReference.java
This commit is contained in:
Ryan Kurtz 2023-03-28 07:29:26 -04:00
commit d0e28a7036
12 changed files with 271 additions and 245 deletions

View file

@ -18,6 +18,7 @@ package ghidra.program.database.references;
import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Program;
import ghidra.program.model.symbol.*;
import ghidra.util.NumericUtilities;
class OffsetReferenceDB extends MemReferenceDB implements OffsetReference {
@ -58,7 +59,8 @@ class OffsetReferenceDB extends MemReferenceDB implements OffsetReference {
@Override
public String toString() {
return super.toString() + " Offset: 0x" + Long.toHexString(offsetOrShift);
String offsetStr = NumericUtilities.toSignedHexString(offsetOrShift);
return super.toString() + " Offset: " + offsetStr;
}
}

View file

@ -114,7 +114,12 @@ public class ComponentOffsetSettingsDefinition
public String getAttributeSpecification(Settings settings) {
if (hasValue(settings)) {
long offset = getValue(settings);
return "offset(0x" + Long.toHexString(offset) + ")";
String sign = "";
if (offset < 0) {
offset = -offset;
sign = "-";
}
return "offset(" + sign + "0x" + Long.toHexString(offset) + ")";
}
return null;
}

View file

@ -184,6 +184,16 @@ public class Relocation {
return bytes;
}
/**
* Returns the number of original instruction bytes affected by applied relocation.
*
* @return number of original instruction bytes affected by relocation if it was successfully applied
* (i.e., {@link Status#APPLIED}, {@link Status#APPLIED_OTHER}), otherwise null may be returned.
*/
public int getLength() {
return bytes != null ? bytes.length : 0;
}
/**
* The name of the symbol being relocated or <code>null</code> if there is no symbol name.
*