Merge remote-tracking branch 'origin/GP-5492_ghizard_PdbReader_modify_and_bring_method_records_into_alignment'

This commit is contained in:
Ryan Kurtz 2025-03-18 10:59:07 -04:00
commit c187f26cfc
7 changed files with 40 additions and 25 deletions

View file

@ -4,9 +4,9 @@
* 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.
@ -154,6 +154,14 @@ public abstract class AbstractMemberFunctionMsType extends AbstractMsType {
return pdb.getTypeRecord(thisPointerRecordNumber);
}
/**
* Returns the "this" adjuster
* @return the adjuster
*/
public int getThisAdjuster() {
return thisAdjuster;
}
@Override
public void emit(StringBuilder builder, Bind bind) {
if (bind.ordinal() < Bind.PROC.ordinal()) {

View file

@ -4,9 +4,9 @@
* 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.
@ -75,7 +75,7 @@ public abstract class AbstractMethodRecordMs extends AbstractParsableItem {
builder.append(attributes);
builder.append(": ");
builder.append(pdb.getTypeRecord(procedureRecordNumber));
if (attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO) {
if (optionalOffset != -1) {
builder.append(",");
builder.append(optionalOffset);
}

View file

@ -4,9 +4,9 @@
* 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.
@ -49,7 +49,8 @@ public abstract class AbstractOneMethodMsType extends AbstractMsType implements
offsetInVFTableIfIntroVirtual = reader.parseUnsignedIntVal();
}
else {
offsetInVFTableIfIntroVirtual = 0;
// 20250310: changed this from 0 to -1 to match "MethodRecord" types
offsetInVFTableIfIntroVirtual = -1;
}
name = reader.parseString(pdb, strType);
reader.skipPadding();
@ -92,8 +93,10 @@ public abstract class AbstractOneMethodMsType extends AbstractMsType implements
builder.append(attributes);
builder.append(": ");
builder.append(pdb.getTypeRecord(procedureTypeRecordNumber));
builder.append(",");
builder.append(offsetInVFTableIfIntroVirtual);
if (offsetInVFTableIfIntroVirtual != -1) {
builder.append(",");
builder.append(offsetInVFTableIfIntroVirtual);
}
builder.append(">");
}

View file

@ -4,9 +4,9 @@
* 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.
@ -63,15 +63,16 @@ public abstract class AbstractVirtualBaseClassMsType extends AbstractMsType impl
/**
* Returns the offset of the base base pointer within the class.
* @return the offset;
* @return the offset
*/
public BigInteger getBasePointerOffset() {
return virtualBasePointerOffsetFromAddressPoint;
}
/**
* Returns the virtual base offset from VB table.
* @return the offset;
* Returns the virtual base offset from VB table. This seems more like an "index" into
* an integer array having values such as 1, 2, 3
* @return the offset
*/
public BigInteger getBaseOffsetFromVbt() {
return virtualBaseOffsetFromVBTable;

View file

@ -4,9 +4,9 @@
* 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.
@ -35,7 +35,10 @@ public class MethodRecord16Ms extends AbstractMethodRecordMs {
super(pdb, reader);
attributes = new ClassFieldMsAttributes(reader);
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();
}
else {

View file

@ -4,9 +4,9 @@
* 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.
@ -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
// 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.
if ((attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO) ||
(attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO_PURE)) {
if (attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO ||
attributes.getProperty() == ClassFieldMsAttributes.Property.INTRO_PURE) {
optionalOffset = reader.parseUnsignedIntVal();
}
else {

View file

@ -2180,7 +2180,7 @@ public class TypesTest extends AbstractGenericTest {
AbstractMsType type = TypeParser.parse(pdb, reader);
assertEquals(type instanceof OneMethod16MsType, true);
String result = type.toString().trim();
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType,0>", result);
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType>", result);
}
@Test
@ -2204,7 +2204,7 @@ public class TypesTest extends AbstractGenericTest {
AbstractMsType type = TypeParser.parse(pdb, reader);
assertEquals(type instanceof OneMethodStMsType, true);
String result = type.toString().trim();
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType,0>", result);
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType>", result);
}
@Test
@ -2228,7 +2228,7 @@ public class TypesTest extends AbstractGenericTest {
AbstractMsType type = TypeParser.parse(pdb, reader);
assertEquals(type instanceof OneMethodMsType, true);
String result = type.toString().trim();
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType,0>", result);
assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType>", result);
}
@Test