mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 09:55:01 +08:00
Merge remote-tracking branch 'origin/GP-5492_ghizard_PdbReader_modify_and_bring_method_records_into_alignment'
This commit is contained in:
+8
@@ -154,6 +154,14 @@ public abstract class AbstractMemberFunctionMsType extends AbstractMsType {
|
|||||||
return pdb.getTypeRecord(thisPointerRecordNumber);
|
return pdb.getTypeRecord(thisPointerRecordNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the "this" adjuster
|
||||||
|
* @return the adjuster
|
||||||
|
*/
|
||||||
|
public int getThisAdjuster() {
|
||||||
|
return thisAdjuster;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void emit(StringBuilder builder, Bind bind) {
|
public void emit(StringBuilder builder, Bind bind) {
|
||||||
if (bind.ordinal() < Bind.PROC.ordinal()) {
|
if (bind.ordinal() < Bind.PROC.ordinal()) {
|
||||||
|
|||||||
+1
-1
@@ -75,7 +75,7 @@ public abstract class AbstractMethodRecordMs extends AbstractParsableItem {
|
|||||||
builder.append(attributes);
|
builder.append(attributes);
|
||||||
builder.append(": ");
|
builder.append(": ");
|
||||||
builder.append(pdb.getTypeRecord(procedureRecordNumber));
|
builder.append(pdb.getTypeRecord(procedureRecordNumber));
|
||||||
if (attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO) {
|
if (optionalOffset != -1) {
|
||||||
builder.append(",");
|
builder.append(",");
|
||||||
builder.append(optionalOffset);
|
builder.append(optionalOffset);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -49,7 +49,8 @@ public abstract class AbstractOneMethodMsType extends AbstractMsType implements
|
|||||||
offsetInVFTableIfIntroVirtual = reader.parseUnsignedIntVal();
|
offsetInVFTableIfIntroVirtual = reader.parseUnsignedIntVal();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
offsetInVFTableIfIntroVirtual = 0;
|
// 20250310: changed this from 0 to -1 to match "MethodRecord" types
|
||||||
|
offsetInVFTableIfIntroVirtual = -1;
|
||||||
}
|
}
|
||||||
name = reader.parseString(pdb, strType);
|
name = reader.parseString(pdb, strType);
|
||||||
reader.skipPadding();
|
reader.skipPadding();
|
||||||
@@ -92,8 +93,10 @@ public abstract class AbstractOneMethodMsType extends AbstractMsType implements
|
|||||||
builder.append(attributes);
|
builder.append(attributes);
|
||||||
builder.append(": ");
|
builder.append(": ");
|
||||||
builder.append(pdb.getTypeRecord(procedureTypeRecordNumber));
|
builder.append(pdb.getTypeRecord(procedureTypeRecordNumber));
|
||||||
builder.append(",");
|
if (offsetInVFTableIfIntroVirtual != -1) {
|
||||||
builder.append(offsetInVFTableIfIntroVirtual);
|
builder.append(",");
|
||||||
|
builder.append(offsetInVFTableIfIntroVirtual);
|
||||||
|
}
|
||||||
builder.append(">");
|
builder.append(">");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -63,15 +63,16 @@ public abstract class AbstractVirtualBaseClassMsType extends AbstractMsType impl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the offset of the base base pointer within the class.
|
* Returns the offset of the base base pointer within the class.
|
||||||
* @return the offset;
|
* @return the offset
|
||||||
*/
|
*/
|
||||||
public BigInteger getBasePointerOffset() {
|
public BigInteger getBasePointerOffset() {
|
||||||
return virtualBasePointerOffsetFromAddressPoint;
|
return virtualBasePointerOffsetFromAddressPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the virtual base offset from VB table.
|
* Returns the virtual base offset from VB table. This seems more like an "index" into
|
||||||
* @return the offset;
|
* an integer array having values such as 1, 2, 3
|
||||||
|
* @return the offset
|
||||||
*/
|
*/
|
||||||
public BigInteger getBaseOffsetFromVbt() {
|
public BigInteger getBaseOffsetFromVbt() {
|
||||||
return virtualBaseOffsetFromVBTable;
|
return virtualBaseOffsetFromVBTable;
|
||||||
|
|||||||
+4
-1
@@ -35,7 +35,10 @@ public class MethodRecord16Ms extends AbstractMethodRecordMs {
|
|||||||
super(pdb, reader);
|
super(pdb, reader);
|
||||||
attributes = new ClassFieldMsAttributes(reader);
|
attributes = new ClassFieldMsAttributes(reader);
|
||||||
procedureRecordNumber = RecordNumber.parse(pdb, reader, RecordCategory.TYPE, 16);
|
procedureRecordNumber = RecordNumber.parse(pdb, reader, RecordCategory.TYPE, 16);
|
||||||
if (attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO) {
|
// See comment in MethodRecordMs... we are adding INTRO_PURE as it might also occur, and
|
||||||
|
// there should be no harm on doing this
|
||||||
|
if (attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO ||
|
||||||
|
attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO_PURE) {
|
||||||
optionalOffset = reader.parseUnsignedIntVal();
|
optionalOffset = reader.parseUnsignedIntVal();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+2
-2
@@ -39,8 +39,8 @@ public class MethodRecordMs extends AbstractMethodRecordMs {
|
|||||||
// API says optional offset "if intro virtual" but we have seen it for 6=<intro.pure>, so
|
// API says optional offset "if intro virtual" but we have seen it for 6=<intro.pure>, so
|
||||||
// it could be that we need to also include 2=virtual here; i.e., each 2, 4, and 6
|
// it could be that we need to also include 2=virtual here; i.e., each 2, 4, and 6
|
||||||
// (virtual, <intro>, and <intro,pure>) could have this optional field.
|
// (virtual, <intro>, and <intro,pure>) could have this optional field.
|
||||||
if ((attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO) ||
|
if (attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO ||
|
||||||
(attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO_PURE)) {
|
attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO_PURE) {
|
||||||
optionalOffset = reader.parseUnsignedIntVal();
|
optionalOffset = reader.parseUnsignedIntVal();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+3
-3
@@ -2180,7 +2180,7 @@ public class TypesTest extends AbstractGenericTest {
|
|||||||
AbstractMsType type = TypeParser.parse(pdb, reader);
|
AbstractMsType type = TypeParser.parse(pdb, reader);
|
||||||
assertEquals(type instanceof OneMethod16MsType, true);
|
assertEquals(type instanceof OneMethod16MsType, true);
|
||||||
String result = type.toString().trim();
|
String result = type.toString().trim();
|
||||||
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType,0>", result);
|
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType>", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -2204,7 +2204,7 @@ public class TypesTest extends AbstractGenericTest {
|
|||||||
AbstractMsType type = TypeParser.parse(pdb, reader);
|
AbstractMsType type = TypeParser.parse(pdb, reader);
|
||||||
assertEquals(type instanceof OneMethodStMsType, true);
|
assertEquals(type instanceof OneMethodStMsType, true);
|
||||||
String result = type.toString().trim();
|
String result = type.toString().trim();
|
||||||
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType,0>", result);
|
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType>", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -2228,7 +2228,7 @@ public class TypesTest extends AbstractGenericTest {
|
|||||||
AbstractMsType type = TypeParser.parse(pdb, reader);
|
AbstractMsType type = TypeParser.parse(pdb, reader);
|
||||||
assertEquals(type instanceof OneMethodMsType, true);
|
assertEquals(type instanceof OneMethodMsType, true);
|
||||||
String result = type.toString().trim();
|
String result = type.toString().trim();
|
||||||
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType,0>", result);
|
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType>", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user