Ghidra is a software reverse engineering (SRE) framework
GT_2731 Add data types (had to add some symbols and Dummy)
ghizardcd956920e78b
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/AbstractOffset.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/AbstractOffset.javanew file mode 100644index 0000000000..b863173298--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/AbstractOffset.java@@ -0,0 +1,52 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.*;++/**+ * Abstract class for PDB Offset values. Extensions control the size of the value that+ * needs deserialized.+ */+public abstract class AbstractOffset extends AbstractParsableItem {++ //==============================================================================================+ // Internals+ //==============================================================================================+ protected long offsetVal;++ //==============================================================================================+ // API+ //==============================================================================================+ /**+ * Returns the offset value.+ * @return Offset value.+ */+ public long get() {+ return offsetVal;+ }++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ /**+ * Parses the offset value from the {@link PdbByteReader}.+ * @param reader {@link PdbByteReader}.+ * @throws PdbException Upon not enough data left to parse.+ */+ public abstract void parse(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/AbstractString.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/AbstractString.javanew file mode 100644index 0000000000..2bccc6c75b--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/AbstractString.java@@ -0,0 +1,57 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.*;++/**+ * Abstract class for PDB Strings. Extensions control what String encoding is allowed and how+ * the String is deserialized.+ */+public abstract class AbstractString extends AbstractParsableItem {++ //==============================================================================================+ // Internals+ //==============================================================================================+ protected String string = "";++ //==============================================================================================+ // API+ //==============================================================================================+ /**+ * Returns the string value.+ * @return {@link String} value.+ */+ public String get() {+ return string;+ }++ @Override+ public void emit(StringBuilder builder) {+ builder.append(string);+ }++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ /**+ * Parses the string from the {@link PdbByteReader}.+ * @param reader {@link PdbByteReader}.+ * @throws PdbException upon error parsing the string.+ */+ public abstract void parse(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/AbstractTypeIndex.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/AbstractTypeIndex.javanew file mode 100644index 0000000000..21fc53a1b5--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/AbstractTypeIndex.java@@ -0,0 +1,52 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.*;++/**+ * Abstract class for PDB Type Index values. Extensions control the size of the value that+ * needs deserialized.+ */+public abstract class AbstractTypeIndex extends AbstractParsableItem {++ //==============================================================================================+ // Internals+ //==============================================================================================+ protected int indexVal;++ //==============================================================================================+ // API+ //==============================================================================================+ /**+ * Returns the index value.+ * @return The value of the index.+ */+ public int get() {+ return indexVal;+ }++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ /**+ * Parses the index value from the {@link PdbByteReader}.+ * @param reader {@link PdbByteReader} from which to read the value.+ * @throws PdbException Upon not enough data left to parse.+ */+ public abstract void parse(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/Offset16.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/Offset16.javanew file mode 100644index 0000000000..b62b1295b1--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/Offset16.java@@ -0,0 +1,35 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;++/**+ * Class extending {@link AbstractOffset} that has has its value serialized as a 2-byte unsigned+ * short.+ */+public class Offset16 extends AbstractOffset {++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ @Override+ public void parse(PdbByteReader reader) throws PdbException {+ offsetVal = reader.parseUnsignedShortVal();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/Offset32.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/Offset32.javanew file mode 100644index 0000000000..fef5deff43--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/Offset32.java@@ -0,0 +1,35 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;++/**+ * Class extending {@link AbstractOffset} that has has its value serialized as a 4-byte unsigned+ * int.+ */+public class Offset32 extends AbstractOffset {++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ @Override+ public void parse(PdbByteReader reader) throws PdbException {+ offsetVal = reader.parseUnsignedIntVal();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringNt.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringNt.javanew file mode 100644index 0000000000..84aef09c04--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringNt.java@@ -0,0 +1,34 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;++/**+ * Class extending {@link AbstractString} that has a normal string encoding with a null terminator.+ */+public class StringNt extends AbstractString {++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ @Override+ public void parse(PdbByteReader reader) throws PdbException {+ string = reader.parseNullTerminatedString();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringSt.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringSt.javanew file mode 100644index 0000000000..31d924d946--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringSt.java@@ -0,0 +1,35 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;++/**+ * Class extending {@link AbstractString} that has a normal string encoding with a byte-prefix+ * string length.+ */+public class StringSt extends AbstractString {++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ @Override+ public void parse(PdbByteReader reader) throws PdbException {+ string = reader.parseByteLengthPrefixedString();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringUtf8Nt.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringUtf8Nt.javanew file mode 100644index 0000000000..831376330f--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringUtf8Nt.java@@ -0,0 +1,34 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;++/**+ * Class extending {@link AbstractString} that has a UTF-8 String encoding with a null terminator.+ */+public class StringUtf8Nt extends AbstractString {++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ @Override+ public void parse(PdbByteReader reader) throws PdbException {+ string = reader.parseNullTerminatedUtf8String();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringUtf8St.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringUtf8St.javanew file mode 100644index 0000000000..225b5be509--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringUtf8St.java@@ -0,0 +1,35 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;++/**+ * Class extending {@link AbstractString} that has a UTF-8 String encoding with a byte-prefix+ * string length.+ */+public class StringUtf8St extends AbstractString {++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ @Override+ public void parse(PdbByteReader reader) throws PdbException {+ string = reader.parseByteLengthPrefixedUtf8String();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringWcharNt.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringWcharNt.javanew file mode 100644index 0000000000..4a38d6d636--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/StringWcharNt.java@@ -0,0 +1,35 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;++/**+ * Class extending {@link AbstractString} that has a Wide Character String encoding with a null+ * terminator (wide null).+ */+public class StringWcharNt extends AbstractString {++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ @Override+ public void parse(PdbByteReader reader) throws PdbException {+ string = reader.parseNullTerminatedWcharString();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/TypeIndex16.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/TypeIndex16.javanew file mode 100644index 0000000000..8109ff262c--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/TypeIndex16.java@@ -0,0 +1,35 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;++/**+ * Class extending {@link AbstractTypeIndex} that has has its value serialized as a 2-byte unsigned+ * short.+ */+public class TypeIndex16 extends AbstractTypeIndex {++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ @Override+ public void parse(PdbByteReader reader) throws PdbException {+ indexVal = reader.parseUnsignedShortVal();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/TypeIndex32.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/TypeIndex32.javanew file mode 100644index 0000000000..95145cb1ee--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/TypeIndex32.java@@ -0,0 +1,38 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;++/**+ * Class extending {@link AbstractTypeIndex} that has has its value serialized as a 4-byte int.+ * <P>+ * In reality, it should probably be a 4-byte unsigned int, but we would have to store this+ * value in a java long, and java indexes by integers instead of longs, so we made this+ * concession.+ */+public class TypeIndex32 extends AbstractTypeIndex {++ //==============================================================================================+ // Abstract Methods+ //==============================================================================================+ @Override+ public void parse(PdbByteReader reader) throws PdbException {+ indexVal = reader.parseInt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/TypeParser.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/TypeParser.javaindex 870b69146c..382836f80e 100644--- a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/TypeParser.java+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/TypeParser.java@@ -255,411 +255,411 @@ public class TypeParser {AbstractMsType type = null;switch (dataTypeId) {-// // 0x0000 block-// case Modifier16MsType.PDB_ID:-// type = new Modifier16MsType(pdb, reader);-// //System.out.println(type.toString());-// //System.out.flush();-// break;-// case Pointer16MsType.PDB_ID:-// type = new Pointer16MsType(pdb, reader);-// break;-// case Array16MsType.PDB_ID:-// type = new Array16MsType(pdb, reader);-// break;-// case Class16MsType.PDB_ID:-// type = new Class16MsType(pdb, reader);-// break;-// case Structure16MsType.PDB_ID:-// type = new Structure16MsType(pdb, reader);-// break;-// case Union16MsType.PDB_ID:-// type = new Union16MsType(pdb, reader);-// break;-// case Enum16MsType.PDB_ID:-// type = new Enum16MsType(pdb, reader);-// break;-// case Procedure16MsType.PDB_ID:-// type = new Procedure16MsType(pdb, reader);-// break;-// case MemberFunction16MsType.PDB_ID:-// type = new MemberFunction16MsType(pdb, reader);-// break;-// case VtShapeMsType.PDB_ID:-// type = new VtShapeMsType(pdb, reader);-// break;-// case Cobol016MsType.PDB_ID:-// type = new Cobol016MsType(pdb, reader);-// break;-// case Cobol1MsType.PDB_ID:-// type = new Cobol1MsType(pdb, reader);-// break;-// case BasicArray16MsType.PDB_ID:-// type = new BasicArray16MsType(pdb, reader);-// break;-// case LabelMsType.PDB_ID:-// type = new LabelMsType(pdb, reader);-// break;-// case NullMsType.PDB_ID:-// type = new NullMsType(pdb, reader);-// break;-// case NotTranMsType.PDB_ID:-// type = new NotTranMsType(pdb, reader);-// break;-// case DimensionedArray16MsType.PDB_ID:-// type = new DimensionedArray16MsType(pdb, reader);-// break;-// case VirtualFunctionTablePath16MsType.PDB_ID:-// type = new VirtualFunctionTablePath16MsType(pdb, reader);-// break;-// case PrecompiledType16MsType.PDB_ID:-// type = new PrecompiledType16MsType(pdb, reader);-// break;-// case EndPrecompiledTypeMsType.PDB_ID:-// type = new EndPrecompiledTypeMsType(pdb, reader);-// break;-// case OemDefinableString16MsType.PDB_ID:-// type = new OemDefinableString16MsType(pdb, reader);-// break;-// case TypeServerStMsType.PDB_ID:-// type = new TypeServerStMsType(pdb, reader);-// break;-//-// // 0x0200 block-// case Skip16MsType.PDB_ID:-// type = new Skip16MsType(pdb, reader);-// break;-// case ArgumentsList16MsType.PDB_ID:-// type = new ArgumentsList16MsType(pdb, reader);-// break;-// case DefaultArguments16MsType.PDB_ID:-// type = new DefaultArguments16MsType(pdb, reader);-// break;-// case ListMsType.PDB_ID:-// type = new ListMsType(pdb, reader);-// break;-// case FieldList16MsType.PDB_ID:-// type = new FieldList16MsType(pdb, reader);-// break;-// case DerivedClassList16MsType.PDB_ID:-// type = new DerivedClassList16MsType(pdb, reader);-// break;-// case Bitfield16MsType.PDB_ID:-// type = new Bitfield16MsType(pdb, reader);-// break;-// case MethodList16MsType.PDB_ID:-// type = new MethodList16MsType(pdb, reader);-// break;-// case DimensionedArrayConstBoundsUpper16MsType.PDB_ID:-// type = new DimensionedArrayConstBoundsUpper16MsType(pdb, reader);-// break;-// case DimensionedArrayConstBoundsLowerUpper16MsType.PDB_ID:-// type = new DimensionedArrayConstBoundsLowerUpper16MsType(pdb, reader);-// break;-// case DimensionedArrayVarBoundsUpper16MsType.PDB_ID:-// type = new DimensionedArrayVarBoundsUpper16MsType(pdb, reader);-// break;-// case DimensionedArrayVarBoundsLowerUpper16MsType.PDB_ID:-// type = new DimensionedArrayVarBoundsLowerUpper16MsType(pdb, reader);-// break;-// case ReferencedSymbolMsType.PDB_ID:-// type = new ReferencedSymbolMsType(pdb, reader);-// break;-//-// // 0x400 block-// case BaseClass16MsType.PDB_ID:-// type = new BaseClass16MsType(pdb, reader);-// break;-// case VirtualBaseClass16MsType.PDB_ID:-// type = new VirtualBaseClass16MsType(pdb, reader);-// break;-// case IndirectVirtualBaseClass16MsType.PDB_ID:-// type = new IndirectVirtualBaseClass16MsType(pdb, reader);-// break;-// case EnumerateStMsType.PDB_ID:-// type = new EnumerateStMsType(pdb, reader);-// break;-// case FriendFunction16MsType.PDB_ID:-// type = new FriendFunction16MsType(pdb, reader);-// break;-// case Index16MsType.PDB_ID:-// type = new Index16MsType(pdb, reader);-// break;-// case Member16MsType.PDB_ID:-// type = new Member16MsType(pdb, reader);-// break;-// case StaticMember16MsType.PDB_ID:-// type = new StaticMember16MsType(pdb, reader);-// break;-// case OverloadedMethod16MsType.PDB_ID:-// type = new OverloadedMethod16MsType(pdb, reader);-// break;-// case NestedType16MsType.PDB_ID:-// type = new NestedType16MsType(pdb, reader);-// break;-// case VirtualFunctionTablePointer16MsType.PDB_ID:-// type = new VirtualFunctionTablePointer16MsType(pdb, reader);-// break;-// case FriendClass16MsType.PDB_ID:-// type = new FriendClass16MsType(pdb, reader);-// break;-// case OneMethod16MsType.PDB_ID:-// type = new OneMethod16MsType(pdb, reader);-// break;-// case VirtualFunctionTablePointerWithOffset16MsType.PDB_ID:-// type = new VirtualFunctionTablePointerWithOffset16MsType(pdb, reader);-// break;-//-// // 0x1000 block-// case ModifierMsType.PDB_ID:-// type = new ModifierMsType(pdb, reader);-// break;-// case PointerMsType.PDB_ID:-// type = new PointerMsType(pdb, reader);-// break;-// case ArrayStMsType.PDB_ID:-// type = new ArrayStMsType(pdb, reader);-// break;-// case ClassStMsType.PDB_ID:-// type = new ClassStMsType(pdb, reader);-// break;-// case StructureStMsType.PDB_ID:-// type = new StructureStMsType(pdb, reader);-// break;-// case UnionStMsType.PDB_ID:-// type = new UnionStMsType(pdb, reader);-// break;-// case EnumStMsType.PDB_ID:-// type = new EnumStMsType(pdb, reader);-// break;-// case ProcedureMsType.PDB_ID:-// type = new ProcedureMsType(pdb, reader);-// break;-// case MemberFunctionMsType.PDB_ID:-// type = new MemberFunctionMsType(pdb, reader);-// break;-// case Cobol0MsType.PDB_ID:-// type = new Cobol0MsType(pdb, reader);-// break;-// case BasicArrayMsType.PDB_ID:-// type = new BasicArrayMsType(pdb, reader);-// break;-// case DimensionedArrayStMsType.PDB_ID:-// type = new DimensionedArrayStMsType(pdb, reader);-// break;-// case VirtualFunctionTablePathMsType.PDB_ID:-// type = new VirtualFunctionTablePathMsType(pdb, reader);-// break;-// case PrecompiledTypeStMsType.PDB_ID:-// type = new PrecompiledTypeStMsType(pdb, reader);-// break;-// case OemDefinableStringMsType.PDB_ID:-// type = new OemDefinableStringMsType(pdb, reader);-// break;-// case AliasStMsType.PDB_ID:-// type = new AliasStMsType(pdb, reader);-// break;-// case OemDefinableString2MsType.PDB_ID:-// type = new OemDefinableString2MsType(pdb, reader);-// break;-//-// // 0x1200 block-// case SkipMsType.PDB_ID:-// type = new SkipMsType(pdb, reader);-// break;-// case ArgumentsListMsType.PDB_ID:-// type = new ArgumentsListMsType(pdb, reader);-// break;-// case DefaultArgumentsStMsType.PDB_ID:-// type = new DefaultArgumentsStMsType(pdb, reader);-// break;-// case FieldListMsType.PDB_ID:-// type = new FieldListMsType(pdb, reader);-// break;-// case DerivedClassListMsType.PDB_ID:-// type = new DerivedClassListMsType(pdb, reader);-// break;-// case BitfieldMsType.PDB_ID:-// type = new BitfieldMsType(pdb, reader);-// break;-// case MethodListMsType.PDB_ID:-// type = new MethodListMsType(pdb, reader);-// break;-// case DimensionedArrayConstBoundsUpperMsType.PDB_ID:-// type = new DimensionedArrayConstBoundsUpperMsType(pdb, reader);-// break;-// case DimensionedArrayConstBoundsLowerUpperMsType.PDB_ID:-// type = new DimensionedArrayConstBoundsLowerUpperMsType(pdb, reader);-// break;-// case DimensionedArrayVarBoundsUpperMsType.PDB_ID:-// type = new DimensionedArrayVarBoundsUpperMsType(pdb, reader);-// break;-// case DimensionedArrayVarBoundsLowerUpperMsType.PDB_ID:-// type = new DimensionedArrayVarBoundsLowerUpperMsType(pdb, reader);-// break;-//-// // 0x1400 block-// case BaseClassMsType.PDB_ID:-// type = new BaseClassMsType(pdb, reader);-// break;-// case VirtualBaseClassMsType.PDB_ID:-// type = new VirtualBaseClassMsType(pdb, reader);-// break;-// case IndirectVirtualBaseClassMsType.PDB_ID:-// type = new IndirectVirtualBaseClassMsType(pdb, reader);-// break;-// case FriendFunctionStMsType.PDB_ID:-// type = new FriendFunctionStMsType(pdb, reader);-// break;-// case IndexMsType.PDB_ID:-// type = new IndexMsType(pdb, reader);-// break;-// case MemberStMsType.PDB_ID:-// type = new MemberStMsType(pdb, reader);-// break;-// case StaticMemberStMsType.PDB_ID:-// type = new StaticMemberStMsType(pdb, reader);-// break;-// case OverloadedMethodStMsType.PDB_ID:-// type = new OverloadedMethodStMsType(pdb, reader);-// break;-// case NestedTypeStMsType.PDB_ID:-// type = new NestedTypeStMsType(pdb, reader);-// break;-// case VirtualFunctionTablePointerMsType.PDB_ID:-// type = new VirtualFunctionTablePointerMsType(pdb, reader);-// break;-// case FriendClassMsType.PDB_ID:-// type = new FriendClassMsType(pdb, reader);-// break;-// case OneMethodStMsType.PDB_ID:-// type = new OneMethodStMsType(pdb, reader);-// break;-// case VirtualFunctionTablePointerWithOffsetMsType.PDB_ID:-// type = new VirtualFunctionTablePointerWithOffsetMsType(pdb, reader);-// break;-// case NestedTypeExtStMsType.PDB_ID:-// type = new NestedTypeExtStMsType(pdb, reader);-// break;-// case MemberModifyStMsType.PDB_ID:-// type = new MemberModifyStMsType(pdb, reader);-// break;-// case ManagedStMsType.PDB_ID:-// type = new ManagedStMsType(pdb, reader);-// break;-//-// // 0x1500 block-// case TypeServerMsType.PDB_ID:-// type = new TypeServerMsType(pdb, reader);-// break;-// case EnumerateMsType.PDB_ID:-// type = new EnumerateMsType(pdb, reader);-// break;-// case ArrayMsType.PDB_ID:-// type = new ArrayMsType(pdb, reader);-// break;-// case ClassMsType.PDB_ID:-// type = new ClassMsType(pdb, reader);-// break;-// case StructureMsType.PDB_ID:-// type = new StructureMsType(pdb, reader);-// break;-// case UnionMsType.PDB_ID:-// type = new UnionMsType(pdb, reader);-// break;-// case EnumMsType.PDB_ID:-// type = new EnumMsType(pdb, reader);-// break;-// case DimensionedArrayMsType.PDB_ID:-// type = new DimensionedArrayMsType(pdb, reader);-// break;-// case PrecompiledTypeMsType.PDB_ID:-// type = new PrecompiledTypeMsType(pdb, reader);-// break;-// case AliasMsType.PDB_ID:-// type = new AliasMsType(pdb, reader);-// break;-// case DefaultArgumentsMsType.PDB_ID:-// type = new DefaultArgumentsMsType(pdb, reader);-// break;-// case FriendFunctionMsType.PDB_ID:-// type = new FriendFunctionMsType(pdb, reader);-// break;-// case MemberMsType.PDB_ID:-// type = new MemberMsType(pdb, reader);-// break;-// case StaticMemberMsType.PDB_ID:-// type = new StaticMemberMsType(pdb, reader);-// break;-// case OverloadedMethodMsType.PDB_ID:-// type = new OverloadedMethodMsType(pdb, reader);-// break;-// case NestedTypeMsType.PDB_ID:-// type = new NestedTypeMsType(pdb, reader);-// break;-// case OneMethodMsType.PDB_ID:-// type = new OneMethodMsType(pdb, reader);-// break;-// case NestedTypeExtMsType.PDB_ID:-// type = new NestedTypeExtMsType(pdb, reader);-// break;-// case MemberModifyMsType.PDB_ID:-// type = new MemberModifyMsType(pdb, reader);-// break;-// case ManagedMsType.PDB_ID:-// type = new ManagedMsType(pdb, reader);-// break;-// case TypeServer2MsType.PDB_ID:-// type = new TypeServer2MsType(pdb, reader);-// break;-// case StridedArrayMsType.PDB_ID:-// type = new StridedArrayMsType(pdb, reader);-// break;-// case HighLevelShaderLanguageMsType.PDB_ID:-// type = new HighLevelShaderLanguageMsType(pdb, reader);-// break;-// case ModifierExMsType.PDB_ID:-// type = new ModifierExMsType(pdb, reader);-// break;-// case InterfaceMsType.PDB_ID:-// type = new InterfaceMsType(pdb, reader);-// break;-// case BaseInterfaceMsType.PDB_ID:-// type = new BaseInterfaceMsType(pdb, reader);-// break;-// case VectorMsType.PDB_ID:-// type = new VectorMsType(pdb, reader);-// break;-// case MatrixMsType.PDB_ID:-// type = new MatrixMsType(pdb, reader);-// break;-// case VirtualFunctionTableMsType.PDB_ID:-// type = new VirtualFunctionTableMsType(pdb, reader);-// break;-//-// // 0x1600 block-// case FunctionIdMsType.PDB_ID:-// type = new FunctionIdMsType(pdb, reader);-// break;-// case MemberFunctionIdMsType.PDB_ID:-// type = new MemberFunctionIdMsType(pdb, reader);-// break;-// case BuildInfoMsType.PDB_ID:-// type = new BuildInfoMsType(pdb, reader);-// break;-// case SubstringListMsType.PDB_ID:-// type = new SubstringListMsType(pdb, reader);-// break;-// case StringIdMsType.PDB_ID:-// type = new StringIdMsType(pdb, reader);-// break;-// case UserDefinedTypeSourceAndLineMsType.PDB_ID:-// type = new UserDefinedTypeSourceAndLineMsType(pdb, reader);-// break;-// case UserDefinedTypeModuleSourceAndLineMsType.PDB_ID:-// type = new UserDefinedTypeModuleSourceAndLineMsType(pdb, reader);-// //TODO: more work-// break;+ // 0x0000 block+ case Modifier16MsType.PDB_ID:+ type = new Modifier16MsType(pdb, reader);+ //System.out.println(type.toString());+ //System.out.flush();+ break;+ case Pointer16MsType.PDB_ID:+ type = new Pointer16MsType(pdb, reader);+ break;+ case Array16MsType.PDB_ID:+ type = new Array16MsType(pdb, reader);+ break;+ case Class16MsType.PDB_ID:+ type = new Class16MsType(pdb, reader);+ break;+ case Structure16MsType.PDB_ID:+ type = new Structure16MsType(pdb, reader);+ break;+ case Union16MsType.PDB_ID:+ type = new Union16MsType(pdb, reader);+ break;+ case Enum16MsType.PDB_ID:+ type = new Enum16MsType(pdb, reader);+ break;+ case Procedure16MsType.PDB_ID:+ type = new Procedure16MsType(pdb, reader);+ break;+ case MemberFunction16MsType.PDB_ID:+ type = new MemberFunction16MsType(pdb, reader);+ break;+ case VtShapeMsType.PDB_ID:+ type = new VtShapeMsType(pdb, reader);+ break;+ case Cobol016MsType.PDB_ID:+ type = new Cobol016MsType(pdb, reader);+ break;+ case Cobol1MsType.PDB_ID:+ type = new Cobol1MsType(pdb, reader);+ break;+ case BasicArray16MsType.PDB_ID:+ type = new BasicArray16MsType(pdb, reader);+ break;+ case LabelMsType.PDB_ID:+ type = new LabelMsType(pdb, reader);+ break;+ case NullMsType.PDB_ID:+ type = new NullMsType(pdb, reader);+ break;+ case NotTranMsType.PDB_ID:+ type = new NotTranMsType(pdb, reader);+ break;+ case DimensionedArray16MsType.PDB_ID:+ type = new DimensionedArray16MsType(pdb, reader);+ break;+ case VirtualFunctionTablePath16MsType.PDB_ID:+ type = new VirtualFunctionTablePath16MsType(pdb, reader);+ break;+ case PrecompiledType16MsType.PDB_ID:+ type = new PrecompiledType16MsType(pdb, reader);+ break;+ case EndPrecompiledTypeMsType.PDB_ID:+ type = new EndPrecompiledTypeMsType(pdb, reader);+ break;+ case OemDefinableString16MsType.PDB_ID:+ type = new OemDefinableString16MsType(pdb, reader);+ break;+ case TypeServerStMsType.PDB_ID:+ type = new TypeServerStMsType(pdb, reader);+ break;++ // 0x0200 block+ case Skip16MsType.PDB_ID:+ type = new Skip16MsType(pdb, reader);+ break;+ case ArgumentsList16MsType.PDB_ID:+ type = new ArgumentsList16MsType(pdb, reader);+ break;+ case DefaultArguments16MsType.PDB_ID:+ type = new DefaultArguments16MsType(pdb, reader);+ break;+ case ListMsType.PDB_ID:+ type = new ListMsType(pdb, reader);+ break;+ case FieldList16MsType.PDB_ID:+ type = new FieldList16MsType(pdb, reader);+ break;+ case DerivedClassList16MsType.PDB_ID:+ type = new DerivedClassList16MsType(pdb, reader);+ break;+ case Bitfield16MsType.PDB_ID:+ type = new Bitfield16MsType(pdb, reader);+ break;+ case MethodList16MsType.PDB_ID:+ type = new MethodList16MsType(pdb, reader);+ break;+ case DimensionedArrayConstBoundsUpper16MsType.PDB_ID:+ type = new DimensionedArrayConstBoundsUpper16MsType(pdb, reader);+ break;+ case DimensionedArrayConstBoundsLowerUpper16MsType.PDB_ID:+ type = new DimensionedArrayConstBoundsLowerUpper16MsType(pdb, reader);+ break;+ case DimensionedArrayVarBoundsUpper16MsType.PDB_ID:+ type = new DimensionedArrayVarBoundsUpper16MsType(pdb, reader);+ break;+ case DimensionedArrayVarBoundsLowerUpper16MsType.PDB_ID:+ type = new DimensionedArrayVarBoundsLowerUpper16MsType(pdb, reader);+ break;+ case ReferencedSymbolMsType.PDB_ID:+ type = new ReferencedSymbolMsType(pdb, reader);+ break;++ // 0x400 block+ case BaseClass16MsType.PDB_ID:+ type = new BaseClass16MsType(pdb, reader);+ break;+ case VirtualBaseClass16MsType.PDB_ID:+ type = new VirtualBaseClass16MsType(pdb, reader);+ break;+ case IndirectVirtualBaseClass16MsType.PDB_ID:+ type = new IndirectVirtualBaseClass16MsType(pdb, reader);+ break;+ case EnumerateStMsType.PDB_ID:+ type = new EnumerateStMsType(pdb, reader);+ break;+ case FriendFunction16MsType.PDB_ID:+ type = new FriendFunction16MsType(pdb, reader);+ break;+ case Index16MsType.PDB_ID:+ type = new Index16MsType(pdb, reader);+ break;+ case Member16MsType.PDB_ID:+ type = new Member16MsType(pdb, reader);+ break;+ case StaticMember16MsType.PDB_ID:+ type = new StaticMember16MsType(pdb, reader);+ break;+ case OverloadedMethod16MsType.PDB_ID:+ type = new OverloadedMethod16MsType(pdb, reader);+ break;+ case NestedType16MsType.PDB_ID:+ type = new NestedType16MsType(pdb, reader);+ break;+ case VirtualFunctionTablePointer16MsType.PDB_ID:+ type = new VirtualFunctionTablePointer16MsType(pdb, reader);+ break;+ case FriendClass16MsType.PDB_ID:+ type = new FriendClass16MsType(pdb, reader);+ break;+ case OneMethod16MsType.PDB_ID:+ type = new OneMethod16MsType(pdb, reader);+ break;+ case VirtualFunctionTablePointerWithOffset16MsType.PDB_ID:+ type = new VirtualFunctionTablePointerWithOffset16MsType(pdb, reader);+ break;++ // 0x1000 block+ case ModifierMsType.PDB_ID:+ type = new ModifierMsType(pdb, reader);+ break;+ case PointerMsType.PDB_ID:+ type = new PointerMsType(pdb, reader);+ break;+ case ArrayStMsType.PDB_ID:+ type = new ArrayStMsType(pdb, reader);+ break;+ case ClassStMsType.PDB_ID:+ type = new ClassStMsType(pdb, reader);+ break;+ case StructureStMsType.PDB_ID:+ type = new StructureStMsType(pdb, reader);+ break;+ case UnionStMsType.PDB_ID:+ type = new UnionStMsType(pdb, reader);+ break;+ case EnumStMsType.PDB_ID:+ type = new EnumStMsType(pdb, reader);+ break;+ case ProcedureMsType.PDB_ID:+ type = new ProcedureMsType(pdb, reader);+ break;+ case MemberFunctionMsType.PDB_ID:+ type = new MemberFunctionMsType(pdb, reader);+ break;+ case Cobol0MsType.PDB_ID:+ type = new Cobol0MsType(pdb, reader);+ break;+ case BasicArrayMsType.PDB_ID:+ type = new BasicArrayMsType(pdb, reader);+ break;+ case DimensionedArrayStMsType.PDB_ID:+ type = new DimensionedArrayStMsType(pdb, reader);+ break;+ case VirtualFunctionTablePathMsType.PDB_ID:+ type = new VirtualFunctionTablePathMsType(pdb, reader);+ break;+ case PrecompiledTypeStMsType.PDB_ID:+ type = new PrecompiledTypeStMsType(pdb, reader);+ break;+ case OemDefinableStringMsType.PDB_ID:+ type = new OemDefinableStringMsType(pdb, reader);+ break;+ case AliasStMsType.PDB_ID:+ type = new AliasStMsType(pdb, reader);+ break;+ case OemDefinableString2MsType.PDB_ID:+ type = new OemDefinableString2MsType(pdb, reader);+ break;++ // 0x1200 block+ case SkipMsType.PDB_ID:+ type = new SkipMsType(pdb, reader);+ break;+ case ArgumentsListMsType.PDB_ID:+ type = new ArgumentsListMsType(pdb, reader);+ break;+ case DefaultArgumentsStMsType.PDB_ID:+ type = new DefaultArgumentsStMsType(pdb, reader);+ break;+ case FieldListMsType.PDB_ID:+ type = new FieldListMsType(pdb, reader);+ break;+ case DerivedClassListMsType.PDB_ID:+ type = new DerivedClassListMsType(pdb, reader);+ break;+ case BitfieldMsType.PDB_ID:+ type = new BitfieldMsType(pdb, reader);+ break;+ case MethodListMsType.PDB_ID:+ type = new MethodListMsType(pdb, reader);+ break;+ case DimensionedArrayConstBoundsUpperMsType.PDB_ID:+ type = new DimensionedArrayConstBoundsUpperMsType(pdb, reader);+ break;+ case DimensionedArrayConstBoundsLowerUpperMsType.PDB_ID:+ type = new DimensionedArrayConstBoundsLowerUpperMsType(pdb, reader);+ break;+ case DimensionedArrayVarBoundsUpperMsType.PDB_ID:+ type = new DimensionedArrayVarBoundsUpperMsType(pdb, reader);+ break;+ case DimensionedArrayVarBoundsLowerUpperMsType.PDB_ID:+ type = new DimensionedArrayVarBoundsLowerUpperMsType(pdb, reader);+ break;++ // 0x1400 block+ case BaseClassMsType.PDB_ID:+ type = new BaseClassMsType(pdb, reader);+ break;+ case VirtualBaseClassMsType.PDB_ID:+ type = new VirtualBaseClassMsType(pdb, reader);+ break;+ case IndirectVirtualBaseClassMsType.PDB_ID:+ type = new IndirectVirtualBaseClassMsType(pdb, reader);+ break;+ case FriendFunctionStMsType.PDB_ID:+ type = new FriendFunctionStMsType(pdb, reader);+ break;+ case IndexMsType.PDB_ID:+ type = new IndexMsType(pdb, reader);+ break;+ case MemberStMsType.PDB_ID:+ type = new MemberStMsType(pdb, reader);+ break;+ case StaticMemberStMsType.PDB_ID:+ type = new StaticMemberStMsType(pdb, reader);+ break;+ case OverloadedMethodStMsType.PDB_ID:+ type = new OverloadedMethodStMsType(pdb, reader);+ break;+ case NestedTypeStMsType.PDB_ID:+ type = new NestedTypeStMsType(pdb, reader);+ break;+ case VirtualFunctionTablePointerMsType.PDB_ID:+ type = new VirtualFunctionTablePointerMsType(pdb, reader);+ break;+ case FriendClassMsType.PDB_ID:+ type = new FriendClassMsType(pdb, reader);+ break;+ case OneMethodStMsType.PDB_ID:+ type = new OneMethodStMsType(pdb, reader);+ break;+ case VirtualFunctionTablePointerWithOffsetMsType.PDB_ID:+ type = new VirtualFunctionTablePointerWithOffsetMsType(pdb, reader);+ break;+ case NestedTypeExtStMsType.PDB_ID:+ type = new NestedTypeExtStMsType(pdb, reader);+ break;+ case MemberModifyStMsType.PDB_ID:+ type = new MemberModifyStMsType(pdb, reader);+ break;+ case ManagedStMsType.PDB_ID:+ type = new ManagedStMsType(pdb, reader);+ break;++ // 0x1500 block+ case TypeServerMsType.PDB_ID:+ type = new TypeServerMsType(pdb, reader);+ break;+ case EnumerateMsType.PDB_ID:+ type = new EnumerateMsType(pdb, reader);+ break;+ case ArrayMsType.PDB_ID:+ type = new ArrayMsType(pdb, reader);+ break;+ case ClassMsType.PDB_ID:+ type = new ClassMsType(pdb, reader);+ break;+ case StructureMsType.PDB_ID:+ type = new StructureMsType(pdb, reader);+ break;+ case UnionMsType.PDB_ID:+ type = new UnionMsType(pdb, reader);+ break;+ case EnumMsType.PDB_ID:+ type = new EnumMsType(pdb, reader);+ break;+ case DimensionedArrayMsType.PDB_ID:+ type = new DimensionedArrayMsType(pdb, reader);+ break;+ case PrecompiledTypeMsType.PDB_ID:+ type = new PrecompiledTypeMsType(pdb, reader);+ break;+ case AliasMsType.PDB_ID:+ type = new AliasMsType(pdb, reader);+ break;+ case DefaultArgumentsMsType.PDB_ID:+ type = new DefaultArgumentsMsType(pdb, reader);+ break;+ case FriendFunctionMsType.PDB_ID:+ type = new FriendFunctionMsType(pdb, reader);+ break;+ case MemberMsType.PDB_ID:+ type = new MemberMsType(pdb, reader);+ break;+ case StaticMemberMsType.PDB_ID:+ type = new StaticMemberMsType(pdb, reader);+ break;+ case OverloadedMethodMsType.PDB_ID:+ type = new OverloadedMethodMsType(pdb, reader);+ break;+ case NestedTypeMsType.PDB_ID:+ type = new NestedTypeMsType(pdb, reader);+ break;+ case OneMethodMsType.PDB_ID:+ type = new OneMethodMsType(pdb, reader);+ break;+ case NestedTypeExtMsType.PDB_ID:+ type = new NestedTypeExtMsType(pdb, reader);+ break;+ case MemberModifyMsType.PDB_ID:+ type = new MemberModifyMsType(pdb, reader);+ break;+ case ManagedMsType.PDB_ID:+ type = new ManagedMsType(pdb, reader);+ break;+ case TypeServer2MsType.PDB_ID:+ type = new TypeServer2MsType(pdb, reader);+ break;+ case StridedArrayMsType.PDB_ID:+ type = new StridedArrayMsType(pdb, reader);+ break;+ case HighLevelShaderLanguageMsType.PDB_ID:+ type = new HighLevelShaderLanguageMsType(pdb, reader);+ break;+ case ModifierExMsType.PDB_ID:+ type = new ModifierExMsType(pdb, reader);+ break;+ case InterfaceMsType.PDB_ID:+ type = new InterfaceMsType(pdb, reader);+ break;+ case BaseInterfaceMsType.PDB_ID:+ type = new BaseInterfaceMsType(pdb, reader);+ break;+ case VectorMsType.PDB_ID:+ type = new VectorMsType(pdb, reader);+ break;+ case MatrixMsType.PDB_ID:+ type = new MatrixMsType(pdb, reader);+ break;+ case VirtualFunctionTableMsType.PDB_ID:+ type = new VirtualFunctionTableMsType(pdb, reader);+ break;++ // 0x1600 block+ case FunctionIdMsType.PDB_ID:+ type = new FunctionIdMsType(pdb, reader);+ break;+ case MemberFunctionIdMsType.PDB_ID:+ type = new MemberFunctionIdMsType(pdb, reader);+ break;+ case BuildInfoMsType.PDB_ID:+ type = new BuildInfoMsType(pdb, reader);+ break;+ case SubstringListMsType.PDB_ID:+ type = new SubstringListMsType(pdb, reader);+ break;+ case StringIdMsType.PDB_ID:+ type = new StringIdMsType(pdb, reader);+ break;+ case UserDefinedTypeSourceAndLineMsType.PDB_ID:+ type = new UserDefinedTypeSourceAndLineMsType(pdb, reader);+ break;+ case UserDefinedTypeModuleSourceAndLineMsType.PDB_ID:+ type = new UserDefinedTypeModuleSourceAndLineMsType(pdb, reader);+ //TODO: more work+ break;// This should never happen (unless we missed something// or MSFT has added new in a version we do not handle.diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/symbol/AbstractRegisterMsSymbol.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/symbol/AbstractRegisterMsSymbol.javanew file mode 100644index 0000000000..720591c82d--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/symbol/AbstractRegisterMsSymbol.java@@ -0,0 +1,81 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.symbol;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB symbol types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>+ */+public abstract class AbstractRegisterMsSymbol extends AbstractMsSymbol {++ protected AbstractTypeIndex typeIndex;+ protected RegisterName register;+ protected AbstractString name;++ /**+ * Constructor for this symbol.+ * @param pdb {@link AbstractPdb} to which this symbol belongs.+ * @param reader {@link PdbByteReader} from which this symbol is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractRegisterMsSymbol(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ typeIndex.parse(reader);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, typeIndex.get()));+ pdb.popDependencyStack();+ parseRegister(reader);+ name.parse(reader);+ reader.align4();+ }++ @Override+ public void emit(StringBuilder builder) {+ builder.append(getSymbolTypeName());+ builder.append(": ");+ emitRegisterInformation(builder);+ builder.append(", Type: ");+ builder.append(pdb.getTypeRecord(typeIndex.get()));+ builder.append(", ");+ builder.append(name);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the register field for this symbol.+ * @param reader {@link PdbByteReader} from which the data is parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseRegister(PdbByteReader reader) throws PdbException;++ /**+ * Emits the register information to the {@link StringBuilder}+ * @param builder {@link StringBuilder} to which the data is emitted.+ */+ protected abstract void emitRegisterInformation(StringBuilder builder);++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/symbol/RegisterMsSymbol.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/symbol/RegisterMsSymbol.javanew file mode 100644index 0000000000..56e6bb7363--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/symbol/RegisterMsSymbol.java@@ -0,0 +1,69 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.symbol;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB symbol type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>+ */+public class RegisterMsSymbol extends AbstractRegisterMsSymbol {++ public static final int PDB_ID = 0x1106;++ /**+ * Constructor for this symbol.+ * @param pdb {@link AbstractPdb} to which this symbol belongs.+ * @param reader {@link PdbByteReader} from which this symbol is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public RegisterMsSymbol(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex32();+ name = new StringUtf8Nt();+ }++ @Override+ protected void parseRegister(PdbByteReader reader) throws PdbException {+ register = new RegisterName(pdb, reader.parseUnsignedShortVal());+ }++ @Override+ protected void emitRegisterInformation(StringBuilder builder) {+ register.emit(builder);+ }++ @Override+ protected String getSymbolTypeName() {+ return "REGISTER";+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/symbol/RegisterName.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/symbol/RegisterName.javanew file mode 100644index 0000000000..403ab61821--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/symbol/RegisterName.java@@ -0,0 +1,922 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.symbol;++import java.util.HashMap;+import java.util.Map;++import ghidra.pdb.AbstractParsableItem;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * Register Name component for certain PDB symbols.+ * <P>+ * Class describes the function return method.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>+ */+public class RegisterName extends AbstractParsableItem {++ private static final String regX86[] = { "None", "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",+ "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "eax", "ecx", "edx", "ebx", "esp", "ebp",+ "esi", "edi", "es", "cs", "ss", "ds", "fs", "gs", "ip", "flags", "eip", "eflags", "???",+ "???", "???", "???", "???", "temp", "temph", "quote", "pcdr3", "pcdr4", "pcdr5", "pcdr6",+ "pcdr7", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???",+ "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???",+ "???", "???", "???", "???", "???", "???", "???", "cr0", "cr1", "cr2", "cr3", "cr4", "???",+ "???", "???", "???", "???", "dr0", "dr1", "dr2", "dr3", "dr4", "dr5", "dr6", "dr7", "???",+ "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "gdtr", "gdtl",+ "idtr", "idtl", "ldtr", "tr", "???", "???", "???", "???", "???", "???", "???", "???", "???",+ "???", "???", "???", "st(0)", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)",+ "ctrl", "stat", "tag", "fpip", "fpcs", "fpdo", "fpds", "fpeip", "fped0" };++ private static final String regAmd64[] = { "None", "al", "cl", "dl", "bl", "ah", "ch", "dh",+ "bh", "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "eax", "ecx", "edx", "ebx", "esp",+ "ebp", "esi", "edi", "es", "cs", "ss", "ds", "fs", "gs", "flags", "rip", "eflags", "???",+ "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???",+ "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???",+ "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???",+ "???", "???", "???", "???", "???", "???", "cr0", "cr1", "cr2", "cr3", "cr4", "???", "???",+ "???", "cr8", "???", "dr0", "dr0", "dr0", "dr0", "dr0", "dr0", "dr0", "dr0", "dr0", "dr0",+ "dr0", "dr0", "dr0", "dr0", "dr0", "dr0", "???", "???", "???", "???", "gdtr", "gdtl",+ "idtr", "idtl", "ldtr", "tr", "???", "???", "???", "???", "???", "???", "???", "???", "???",+ "???", "???", "???", "st(0)", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)",+ "ctrl", "stat", "tag", "fpip", "fpcs", "fpdo", "fpds", "isem", "fpeip", "fped0", "mm0",+ "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4",+ "xmm5", "xmm6", "xmm7", "xmm0_0", "xmm0_1", "xmm0_2", "xmm0_3", "xmm0_0", "xmm0_1",+ "xmm0_2", "xmm0_3", "xmm1_0", "xmm1_1", "xmm1_2", "xmm1_3", "xmm2_0", "xmm2_1", "xmm2_2",+ "xmm2_3", "xmm3_0", "xmm3_1", "xmm3_2", "xmm3_3", "xmm4_0", "xmm4_1", "xmm4_2", "xmm4_3",+ "xmm5_0", "xmm5_1", "xmm5_2", "xmm5_3", "xmm6_0", "xmm6_1", "xmm6_2", "xmm6_3", "xmm7_0",+ "xmm7_1", "xmm7_2", "xmm7_3", "xmm0l", "xmm1l", "xmm2l", "xmm3l", "xmm4l", "xmm5l", "xmm6l",+ "xmm7l", "xmm0l", "xmm1h", "xmm2h", "xmm3h", "xmm4h", "xmm5h", "xmm6h", "xmm7h", "???",+ "mxcsr", "???", "???", "???", "???", "???", "???", "???", "???", "emm0l", "emm1l", "emm2l",+ "emm3l", "emm4l", "emm5l", "emm6l", "emm7l", "emm0h", "emm1h", "emm2h", "emm3h", "emm4h",+ "emm5h", "emm6h", "emm7h", "mm00", "mm01", "mm10", "mm11", "mm20", "mm21", "mm30", "mm31",+ "mm40", "mm41", "mm50", "mm51", "mm60", "mm61", "mm70", "mm71", "xmm8", "xmm9", "xmm10",+ "xmm11", "xmm12", "xmm13", "xmm14", "xmm15", "xmm8_0", "xmm8_1", "xmm8_2", "xmm8_3",+ "xmm9_0", "xmm9_1", "xmm9_2", "xmm9_3", "xmm10_0", "xmm10_1", "xmm10_2", "xmm10_3",+ "xmm11_0", "xmm11_1", "xmm11_2", "xmm11_3", "xmm12_0", "xmm12_1", "xmm12_2", "xmm12_3",+ "xmm13_0", "xmm13_1", "xmm13_2", "xmm13_3", "xmm14_0", "xmm14_1", "xmm14_2", "xmm14_3",+ "xmm15_0", "xmm15_1", "xmm15_2", "xmm15_3", "xmm8l", "xmm9l", "xmm10l", "xmm11l", "xmm12l",+ "xmm13l", "xmm14l", "xmm15l", "xmm8h", "xmm9h", "xmm10h", "xmm11h", "xmm12h", "xmm13h",+ "xmm14h", "xmm15h", "emm8l", "emm9l", "emm10l", "emm11l", "emm12l", "emm13l", "emm14l",+ "emm15l", "emm8h", "emm9h", "emm10h", "emm11h", "emm12h", "emm13h", "emm14h", "emm15h",+ "sil", "dil", "bpl", "spl", "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "fbp", "rsp", "r8",+ "r9", "r10", "r11", "r12", "r13", "r14", "r15", "r8b", "r9b", "r10b", "r11b", "r12b",+ "r13b", "r14b", "r15b", "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w", "r8d",+ "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d" };++ private static final String regMips[] = { "None", "???", "???", "???", "???", "???", "???",+ "???", "???", "???", "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", "t0", "t1", "t2",+ "t3", "t4", "t5", "t6", "t7", "s0", "s1", "t2", "s3", "s4", "s5", "s6", "s7", "t8", "t9",+ "k0", "k1", "gp", "sp", "s8", "ra", "lo", "hi", "???", "???", "???", "???", "???", "???",+ "Fir", "Psr", "???", "???", "???", "???", "???", "???", "???", "???", "$f0", "$f1", "$f2",+ "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", "$f9", "$f10", "$f11", "$f12", "$f13", "$f14",+ "$f15", "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23", "$f24", "$f25",+ "$f26", "$f27", "$f28", "$f29", "$f30", "$f31", "Fsr" };++ // Indices 41-48 are actually:+ // R68_MMUSR030, R68_MMUSR, R68_URP, R68_DTT0, R68_DTT1, R68_ITT0, R68_ITT1+ private static final String reg68k[] = { "CCR", "SR", "SUP", "MSP", "SFC", "DFC", "CACR", "VBR",+ "CARR", "ISP", "PC", "???", "FPCR", "FPSR", "FPIAR", "???", "FPO", "FP1", "FP2", "FP3",+ "FP4", "FP5", "FP6", "FP7", "???", "???", "???", "???", "???", "???", "???", "???", "???",+ "???", "???", "PSR", "PCSR", "VAL", "CRP", "SRP", "DRP", "TC", "AC", "SCC", "CAL", "TT0",+ "TT1", "???", "BAD0", "BAD1", "BAD2", "BAD3", "BAD4", "BAD5", "BAD6", "BAD7", "BAC0",+ "BAC1", "BAC2", "BAC3", "BAC4", "BAC5", "BAC6", "BAC7", };++ private static final String regAlpha[] = { "None", "???", "???", "???", "???", "???", "???",+ "???", "???", "???", "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", "$f9",+ "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", "$f16", "$f17", "$f18", "$f19", "$f20",+ "$f21", "$f22", "$f23", "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31",+ "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t7", "t7", "s0", "s1", "s2", "s3", "s4", "s5",+ "fp", "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9", "t10", "t11", "ra", "t12", "at", "gp",+ "sp", "zero", "Fpcr", "Fir", "Psr", "FltFsr" };++ private static final String regPpc[] =+ { "None", "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12",+ "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "r24",+ "r25", "r26", "r27", "r28", "r29", "r30", "r31", "cr", "cr0", "cr1", "cr2", "cr3",+ "cr4", "cr5", "cr6", "cr7", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9",+ "f10", "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21",+ "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", "Fpscr", "Msr" };++ private static final String regSh[] = { "None", "???", "???", "???", "???", "???", "???", "???",+ "???", "???", "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11",+ "r12", "r13", "fp", "sp", "???", "???", "???", "???", "???", "???", "???", "???", "???",+ "???", "???", "???", "gbr", "pr", "mach", "macl", "???", "???", "???", "???", "???", "???",+ "???", "???", "pc", "sr", "???", "???", "???", "???", "???", "???", "???", "???", "bara",+ "basra", "bamra", "bbra", "barb", "basrb", "bamrb", "bbr", "bdrb", "bdmrb", "brcr" };++ private static final Map<Integer, String> regIa64Map = new HashMap<>();+ static {+ regIa64Map.put(0, "None");+ // Branch Registers+ regIa64Map.put(512, "br0");+ regIa64Map.put(513, "br1");+ regIa64Map.put(514, "br2");+ regIa64Map.put(515, "br3");+ regIa64Map.put(516, "br4");+ regIa64Map.put(517, "br5");+ regIa64Map.put(518, "br6");+ regIa64Map.put(519, "br7");+ // Predicate Registers+ regIa64Map.put(704, "");+ regIa64Map.put(705, "");+ regIa64Map.put(706, "");+ regIa64Map.put(707, "");+ regIa64Map.put(708, "");+ regIa64Map.put(709, "");+ regIa64Map.put(710, "");+ regIa64Map.put(711, "");+ regIa64Map.put(712, "");+ regIa64Map.put(713, "");+ regIa64Map.put(714, "");+ regIa64Map.put(715, "");+ regIa64Map.put(716, "");+ regIa64Map.put(717, "");+ regIa64Map.put(718, "");+ regIa64Map.put(719, "");+ regIa64Map.put(720, "");+ regIa64Map.put(721, "");+ regIa64Map.put(722, "");+ regIa64Map.put(723, "");+ regIa64Map.put(724, "");+ regIa64Map.put(725, "");+ regIa64Map.put(726, "");+ regIa64Map.put(727, "");+ regIa64Map.put(728, "");+ regIa64Map.put(729, "");+ regIa64Map.put(730, "");+ regIa64Map.put(731, "");+ regIa64Map.put(732, "");+ regIa64Map.put(733, "");+ regIa64Map.put(734, "");+ regIa64Map.put(735, "");+ regIa64Map.put(736, "");+ regIa64Map.put(737, "");+ regIa64Map.put(738, "");+ regIa64Map.put(739, "");+ regIa64Map.put(740, "");+ regIa64Map.put(741, "");+ regIa64Map.put(742, "");+ regIa64Map.put(743, "");+ regIa64Map.put(744, "");+ regIa64Map.put(745, "");+ regIa64Map.put(746, "");+ regIa64Map.put(747, "");+ regIa64Map.put(748, "");+ regIa64Map.put(749, "");+ regIa64Map.put(750, "");+ regIa64Map.put(751, "");+ regIa64Map.put(752, "");+ regIa64Map.put(753, "");+ regIa64Map.put(754, "");+ regIa64Map.put(755, "");+ regIa64Map.put(756, "");+ regIa64Map.put(757, "");+ regIa64Map.put(758, "");+ regIa64Map.put(759, "");+ regIa64Map.put(760, "");+ regIa64Map.put(761, "");+ regIa64Map.put(762, "");+ regIa64Map.put(763, "");+ regIa64Map.put(764, "");+ regIa64Map.put(765, "");+ regIa64Map.put(766, "");+ regIa64Map.put(767, "");+ regIa64Map.put(768, "preds");+ // Banked General Registers+ regIa64Map.put(832, "h0");+ regIa64Map.put(833, "h1");+ regIa64Map.put(834, "h2");+ regIa64Map.put(835, "h3");+ regIa64Map.put(836, "h4");+ regIa64Map.put(837, "h5");+ regIa64Map.put(838, "h6");+ regIa64Map.put(839, "h7");+ regIa64Map.put(840, "h8");+ regIa64Map.put(841, "h9");+ regIa64Map.put(842, "h10");+ regIa64Map.put(843, "h11");+ regIa64Map.put(844, "h12");+ regIa64Map.put(845, "h13");+ regIa64Map.put(846, "h14");+ regIa64Map.put(847, "h15");+ // Special Registers+ regIa64Map.put(1016, "ip");+ regIa64Map.put(1017, "umask");+ regIa64Map.put(1018, "cfm");+ regIa64Map.put(1019, "psr");+ // Banked General Registers+ regIa64Map.put(1020, "nats");+ regIa64Map.put(1021, "nats2");+ regIa64Map.put(1022, "nats3");+ // General-Purpose Registers+ // Integer registers+ regIa64Map.put(1023, "r0");++ regIa64Map.put(1024, "r0");+ regIa64Map.put(1025, "r1");+ regIa64Map.put(1026, "r2");+ regIa64Map.put(1027, "r3");+ regIa64Map.put(1028, "r4");+ regIa64Map.put(1029, "r5");+ regIa64Map.put(1030, "r6");+ regIa64Map.put(1031, "r7");+ regIa64Map.put(1032, "r8");+ regIa64Map.put(1033, "r9");+ regIa64Map.put(1034, "r10");+ regIa64Map.put(1035, "r11");+ regIa64Map.put(1036, "r12");+ regIa64Map.put(1037, "r13");+ regIa64Map.put(1038, "r14");+ regIa64Map.put(1039, "r15");+ regIa64Map.put(1040, "r16");+ regIa64Map.put(1041, "r17");+ regIa64Map.put(1042, "r18");+ regIa64Map.put(1043, "r19");+ regIa64Map.put(1044, "r20");+ regIa64Map.put(1045, "r21");+ regIa64Map.put(1046, "r22");+ regIa64Map.put(1047, "r23");+ regIa64Map.put(1048, "r24");+ regIa64Map.put(1049, "r25");+ regIa64Map.put(1050, "r26");+ regIa64Map.put(1051, "r27");+ regIa64Map.put(1052, "r28");+ regIa64Map.put(1053, "r29");+ regIa64Map.put(1054, "r30");+ regIa64Map.put(1055, "r31");+ // Register Stack+ regIa64Map.put(1056, "r32");+ regIa64Map.put(1057, "r33");+ regIa64Map.put(1058, "r34");+ regIa64Map.put(1059, "r35");+ regIa64Map.put(1060, "r36");+ regIa64Map.put(1061, "r37");+ regIa64Map.put(1062, "r38");+ regIa64Map.put(1063, "r39");+ regIa64Map.put(1064, "r40");+ regIa64Map.put(1065, "r41");+ regIa64Map.put(1066, "r42");+ regIa64Map.put(1067, "r43");+ regIa64Map.put(1068, "r44");+ regIa64Map.put(1069, "r45");+ regIa64Map.put(1070, "r46");+ regIa64Map.put(1071, "r47");+ regIa64Map.put(1072, "r48");+ regIa64Map.put(1073, "r49");+ regIa64Map.put(1074, "r50");+ regIa64Map.put(1075, "r51");+ regIa64Map.put(1076, "r52");+ regIa64Map.put(1077, "r53");+ regIa64Map.put(1078, "r54");+ regIa64Map.put(1079, "r55");+ regIa64Map.put(1080, "r56");+ regIa64Map.put(1081, "r57");+ regIa64Map.put(1082, "r58");+ regIa64Map.put(1083, "r59");+ regIa64Map.put(1084, "r60");+ regIa64Map.put(1085, "r61");+ regIa64Map.put(1086, "r62");+ regIa64Map.put(1087, "r63");+ regIa64Map.put(1088, "r64");+ regIa64Map.put(1089, "r65");+ regIa64Map.put(1090, "r66");+ regIa64Map.put(1091, "r67");+ regIa64Map.put(1092, "r68");+ regIa64Map.put(1093, "r69");+ regIa64Map.put(1094, "r70");+ regIa64Map.put(1095, "r71");+ regIa64Map.put(1096, "r72");+ regIa64Map.put(1097, "r73");+ regIa64Map.put(1098, "r74");+ regIa64Map.put(1099, "r75");+ regIa64Map.put(1100, "r76");+ regIa64Map.put(1101, "r77");+ regIa64Map.put(1102, "r78");+ regIa64Map.put(1103, "r79");+ regIa64Map.put(1104, "r80");+ regIa64Map.put(1105, "r81");+ regIa64Map.put(1106, "r82");+ regIa64Map.put(1107, "r83");+ regIa64Map.put(1108, "r84");+ regIa64Map.put(1109, "r85");+ regIa64Map.put(1110, "r86");+ regIa64Map.put(1111, "r87");+ regIa64Map.put(1112, "r88");+ regIa64Map.put(1113, "r89");+ regIa64Map.put(1114, "r90");+ regIa64Map.put(1115, "r91");+ regIa64Map.put(1116, "r92");+ regIa64Map.put(1117, "r93");+ regIa64Map.put(1118, "r94");+ regIa64Map.put(1119, "r95");+ regIa64Map.put(1120, "r96");+ regIa64Map.put(1121, "r97");+ regIa64Map.put(1122, "r98");+ regIa64Map.put(1123, "r99");+ regIa64Map.put(1124, "r100");+ regIa64Map.put(1125, "r101");+ regIa64Map.put(1126, "r102");+ regIa64Map.put(1127, "r103");+ regIa64Map.put(1128, "r104");+ regIa64Map.put(1129, "r105");+ regIa64Map.put(1130, "r106");+ regIa64Map.put(1131, "r107");+ regIa64Map.put(1132, "r108");+ regIa64Map.put(1133, "r109");+ regIa64Map.put(1134, "r110");+ regIa64Map.put(1135, "r111");+ regIa64Map.put(1136, "r112");+ regIa64Map.put(1137, "r113");+ regIa64Map.put(1138, "r114");+ regIa64Map.put(1139, "r115");+ regIa64Map.put(1140, "r116");+ regIa64Map.put(1141, "r117");+ regIa64Map.put(1142, "r118");+ regIa64Map.put(1143, "r119");+ regIa64Map.put(1144, "r120");+ regIa64Map.put(1145, "r121");+ regIa64Map.put(1146, "r122");+ regIa64Map.put(1147, "r123");+ regIa64Map.put(1148, "r124");+ regIa64Map.put(1149, "r125");+ regIa64Map.put(1150, "r126");+ regIa64Map.put(1151, "r127");+ // Floating-Point Registers+ // Low Floating Point Registers+ regIa64Map.put(2048, "f0");+ regIa64Map.put(2049, "f1");+ regIa64Map.put(2050, "f2");+ regIa64Map.put(2051, "f3");+ regIa64Map.put(2052, "f4");+ regIa64Map.put(2053, "f5");+ regIa64Map.put(2054, "f6");+ regIa64Map.put(2055, "f7");+ regIa64Map.put(2056, "f8");+ regIa64Map.put(2057, "f9");+ regIa64Map.put(2058, "f10");+ regIa64Map.put(2059, "f11");+ regIa64Map.put(2060, "f12");+ regIa64Map.put(2061, "f13");+ regIa64Map.put(2062, "f14");+ regIa64Map.put(2063, "f15");+ regIa64Map.put(2064, "f16");+ regIa64Map.put(2065, "f17");+ regIa64Map.put(2066, "f18");+ regIa64Map.put(2067, "f19");+ regIa64Map.put(2068, "f20");+ regIa64Map.put(2069, "f21");+ regIa64Map.put(2070, "f22");+ regIa64Map.put(2071, "f23");+ regIa64Map.put(2072, "f24");+ regIa64Map.put(2073, "f25");+ regIa64Map.put(2074, "f26");+ regIa64Map.put(2075, "f27");+ regIa64Map.put(2076, "f28");+ regIa64Map.put(2077, "f29");+ regIa64Map.put(2078, "f30");+ regIa64Map.put(2079, "f31");+ regIa64Map.put(2080, "f32");+ regIa64Map.put(2081, "f33");+ regIa64Map.put(2082, "f34");+ regIa64Map.put(2083, "f35");+ regIa64Map.put(2084, "f36");+ regIa64Map.put(2085, "f37");+ regIa64Map.put(2086, "f38");+ regIa64Map.put(2087, "f39");+ regIa64Map.put(2088, "f40");+ regIa64Map.put(2089, "f41");+ regIa64Map.put(2090, "f42");+ regIa64Map.put(2091, "f43");+ regIa64Map.put(2092, "f44");+ regIa64Map.put(2093, "f45");+ regIa64Map.put(2094, "f46");+ regIa64Map.put(2095, "f47");+ regIa64Map.put(2096, "f48");+ regIa64Map.put(2097, "f49");+ regIa64Map.put(2098, "f50");+ regIa64Map.put(2099, "f51");+ regIa64Map.put(2100, "f52");+ regIa64Map.put(2101, "f53");+ regIa64Map.put(2102, "f54");+ regIa64Map.put(2103, "f55");+ regIa64Map.put(2104, "f56");+ regIa64Map.put(2105, "f57");+ regIa64Map.put(2106, "f58");+ regIa64Map.put(2107, "f59");+ regIa64Map.put(2108, "f60");+ regIa64Map.put(2109, "f61");+ regIa64Map.put(2110, "f62");+ regIa64Map.put(2111, "f63");+ regIa64Map.put(2112, "f64");+ regIa64Map.put(2113, "f65");+ regIa64Map.put(2114, "f66");+ regIa64Map.put(2115, "f67");+ regIa64Map.put(2116, "f68");+ regIa64Map.put(2117, "f69");+ regIa64Map.put(2118, "f70");+ regIa64Map.put(2119, "f71");+ regIa64Map.put(2120, "f72");+ regIa64Map.put(2121, "f73");+ regIa64Map.put(2122, "f74");+ regIa64Map.put(2123, "f75");+ regIa64Map.put(2124, "f76");+ regIa64Map.put(2125, "f77");+ regIa64Map.put(2126, "f78");+ regIa64Map.put(2127, "f79");+ regIa64Map.put(2128, "f80");+ regIa64Map.put(2129, "f81");+ regIa64Map.put(2130, "f82");+ regIa64Map.put(2131, "f83");+ regIa64Map.put(2132, "f84");+ regIa64Map.put(2133, "f85");+ regIa64Map.put(2134, "f86");+ regIa64Map.put(2135, "f87");+ regIa64Map.put(2136, "f88");+ regIa64Map.put(2137, "f89");+ regIa64Map.put(2138, "f90");+ regIa64Map.put(2139, "f91");+ regIa64Map.put(2140, "f92");+ regIa64Map.put(2141, "f93");+ regIa64Map.put(2142, "f94");+ regIa64Map.put(2143, "f95");+ regIa64Map.put(2144, "f96");+ regIa64Map.put(2145, "f97");+ regIa64Map.put(2146, "f98");+ regIa64Map.put(2147, "f99");+ regIa64Map.put(2148, "f100");+ regIa64Map.put(2149, "f101");+ regIa64Map.put(2150, "f102");+ regIa64Map.put(2151, "f103");+ regIa64Map.put(2152, "f104");+ regIa64Map.put(2153, "f105");+ regIa64Map.put(2154, "f106");+ regIa64Map.put(2155, "f107");+ regIa64Map.put(2156, "f108");+ regIa64Map.put(2157, "f109");+ regIa64Map.put(2158, "f110");+ regIa64Map.put(2159, "f111");+ regIa64Map.put(2160, "f112");+ regIa64Map.put(2161, "f113");+ regIa64Map.put(2162, "f114");+ regIa64Map.put(2163, "f115");+ regIa64Map.put(2164, "f116");+ regIa64Map.put(2165, "f117");+ regIa64Map.put(2166, "f118");+ regIa64Map.put(2167, "f119");+ regIa64Map.put(2168, "f120");+ regIa64Map.put(2169, "f121");+ regIa64Map.put(2170, "f122");+ regIa64Map.put(2171, "f123");+ regIa64Map.put(2172, "f124");+ regIa64Map.put(2173, "f125");+ regIa64Map.put(2174, "f126");+ regIa64Map.put(2175, "f127");+ // Application Registers+ regIa64Map.put(3072, "apkr0");+ regIa64Map.put(3073, "apkr1");+ regIa64Map.put(3074, "apkr2");+ regIa64Map.put(3075, "apkr3");+ regIa64Map.put(3076, "apkr4");+ regIa64Map.put(3077, "apkr5");+ regIa64Map.put(3078, "apkr6");+ regIa64Map.put(3079, "apkr7");+ regIa64Map.put(3080, "ar8");+ regIa64Map.put(3081, "ar9");+ regIa64Map.put(3082, "ar10");+ regIa64Map.put(3083, "ar11");+ regIa64Map.put(3084, "ar12");+ regIa64Map.put(3085, "ar13");+ regIa64Map.put(3086, "ar14");+ regIa64Map.put(3087, "ar15");+ regIa64Map.put(3088, "rsbsc");+ regIa64Map.put(3089, "rsbsp");+ regIa64Map.put(3090, "rsbspstore");+ regIa64Map.put(3091, "rsrnat");+ regIa64Map.put(3092, "r20");+ regIa64Map.put(3093, "stfcr");+ regIa64Map.put(3094, "r22");+ regIa64Map.put(3095, "r23");+ regIa64Map.put(3096, "eflag");+ regIa64Map.put(3097, "csd");+ regIa64Map.put(3098, "ssd");+ regIa64Map.put(3099, "cflg");+ regIa64Map.put(3100, "stfsr");+ regIa64Map.put(3101, "stfir");+ regIa64Map.put(3102, "stfdr");+ regIa64Map.put(3103, "ar31");+ regIa64Map.put(3104, "apccv");+ regIa64Map.put(3105, "ar33");+ regIa64Map.put(3106, "ar34");+ regIa64Map.put(3107, "ar35");+ regIa64Map.put(3108, "apunat");+ regIa64Map.put(3109, "ar37");+ regIa64Map.put(3110, "ar38");+ regIa64Map.put(3111, "ar39");+ regIa64Map.put(3112, "stfpsr");+ regIa64Map.put(3113, "ar41");+ regIa64Map.put(3114, "ar42");+ regIa64Map.put(3115, "ar43");+ regIa64Map.put(3116, "apitc");+ regIa64Map.put(3117, "ar45");+ regIa64Map.put(3118, "ar46");+ regIa64Map.put(3119, "ar47");+ regIa64Map.put(3120, "ar48");+ regIa64Map.put(3121, "ar49");+ regIa64Map.put(3122, "ar50");+ regIa64Map.put(3123, "ar51");+ regIa64Map.put(3124, "ar52");+ regIa64Map.put(3125, "ar53");+ regIa64Map.put(3126, "ar54");+ regIa64Map.put(3127, "ar55");+ regIa64Map.put(3128, "ar56");+ regIa64Map.put(3129, "ar57");+ regIa64Map.put(3130, "ar58");+ regIa64Map.put(3131, "ar59");+ regIa64Map.put(3132, "ar60");+ regIa64Map.put(3133, "ar61");+ regIa64Map.put(3134, "ar62");+ regIa64Map.put(3135, "ar63");+ regIa64Map.put(3136, "rspfs");+ regIa64Map.put(3137, "aplc");+ regIa64Map.put(3138, "apec");+ regIa64Map.put(3139, "ar67");+ regIa64Map.put(3140, "ar68");+ regIa64Map.put(3141, "ar69");+ regIa64Map.put(3142, "ar70");+ regIa64Map.put(3143, "ar71");+ regIa64Map.put(3144, "ar72");+ regIa64Map.put(3145, "ar73");+ regIa64Map.put(3146, "ar74");+ regIa64Map.put(3147, "ar75");+ regIa64Map.put(3148, "ar76");+ regIa64Map.put(3149, "ar77");+ regIa64Map.put(3150, "ar78");+ regIa64Map.put(3151, "ar79");+ regIa64Map.put(3152, "ar80");+ regIa64Map.put(3153, "ar81");+ regIa64Map.put(3154, "ar82");+ regIa64Map.put(3155, "ar83");+ regIa64Map.put(3156, "ar84");+ regIa64Map.put(3157, "ar85");+ regIa64Map.put(3158, "ar86");+ regIa64Map.put(3159, "ar87");+ regIa64Map.put(3160, "ar88");+ regIa64Map.put(3161, "ar89");+ regIa64Map.put(3162, "ar90");+ regIa64Map.put(3163, "ar91");+ regIa64Map.put(3164, "ar92");+ regIa64Map.put(3165, "ar93");+ regIa64Map.put(3166, "ar94");+ regIa64Map.put(3167, "ar95");+ regIa64Map.put(3168, "ar96");+ regIa64Map.put(3169, "ar97");+ regIa64Map.put(3170, "ar98");+ regIa64Map.put(3171, "ar99");+ regIa64Map.put(3172, "ar100");+ regIa64Map.put(3173, "ar101");+ regIa64Map.put(3174, "ar102");+ regIa64Map.put(3175, "ar103");+ regIa64Map.put(3176, "ar104");+ regIa64Map.put(3177, "ar105");+ regIa64Map.put(3178, "ar106");+ regIa64Map.put(3179, "ar107");+ regIa64Map.put(3180, "ar108");+ regIa64Map.put(3181, "ar109");+ regIa64Map.put(3182, "ar110");+ regIa64Map.put(3183, "ar111");+ regIa64Map.put(3184, "ar112");+ regIa64Map.put(3185, "ar113");+ regIa64Map.put(3186, "ar114");+ regIa64Map.put(3187, "ar115");+ regIa64Map.put(3188, "ar116");+ regIa64Map.put(3189, "ar117");+ regIa64Map.put(3190, "ar118");+ regIa64Map.put(3191, "ar119");+ regIa64Map.put(3192, "ar120");+ regIa64Map.put(3193, "ar121");+ regIa64Map.put(3194, "ar122");+ regIa64Map.put(3195, "ar123");+ regIa64Map.put(3196, "ar124");+ regIa64Map.put(3197, "ar125");+ regIa64Map.put(3198, "ar126");+ regIa64Map.put(3199, "ar127");++ regIa64Map.put(3328, "cpuid0");+ regIa64Map.put(3329, "cpuid1");+ regIa64Map.put(3330, "cpuid2");+ regIa64Map.put(3331, "cpuid3");+ regIa64Map.put(3332, "cpuid4");++ regIa64Map.put(4096, "apdcr");+ regIa64Map.put(4097, "apitm");+ regIa64Map.put(4098, "apiva");+ regIa64Map.put(4099, "cr3");+ regIa64Map.put(4100, "cr4");+ regIa64Map.put(4101, "cr5");+ regIa64Map.put(4102, "cr6");+ regIa64Map.put(4103, "cr7");+ regIa64Map.put(4104, "appta");+ regIa64Map.put(4105, "apgpta");+ regIa64Map.put(4106, "cr10");+ regIa64Map.put(4107, "cr11");+ regIa64Map.put(4108, "cr12");+ regIa64Map.put(4109, "cr13");+ regIa64Map.put(4110, "cr14");+ regIa64Map.put(4111, "cr15");+ regIa64Map.put(4112, "stipsr");+ regIa64Map.put(4113, "stisr");+ regIa64Map.put(4114, "cr18");+ regIa64Map.put(4115, "stiip");+ regIa64Map.put(4116, "stifa");+ regIa64Map.put(4117, "stitir");+ regIa64Map.put(4118, "stiipa");+ regIa64Map.put(4119, "stifs");+ regIa64Map.put(4120, "stiim");+ regIa64Map.put(4121, "stiha");+ regIa64Map.put(4122, "cr26");+ regIa64Map.put(4123, "cr27");+ regIa64Map.put(4124, "cr28");+ regIa64Map.put(4125, "cr29");+ regIa64Map.put(4126, "cr30");+ regIa64Map.put(4127, "cr31");+ regIa64Map.put(4128, "cr32");+ regIa64Map.put(4129, "cr33");+ regIa64Map.put(4130, "cr34");+ regIa64Map.put(4131, "cr35");+ regIa64Map.put(4132, "cr36");+ regIa64Map.put(4133, "cr37");+ regIa64Map.put(4134, "cr38");+ regIa64Map.put(4135, "cr39");+ regIa64Map.put(4136, "cr40");+ regIa64Map.put(4137, "cr41");+ regIa64Map.put(4138, "cr42");+ regIa64Map.put(4139, "cr43");+ regIa64Map.put(4140, "cr44");+ regIa64Map.put(4141, "cr45");+ regIa64Map.put(4142, "cr46");+ regIa64Map.put(4143, "cr47");+ regIa64Map.put(4144, "cr48");+ regIa64Map.put(4145, "cr49");+ regIa64Map.put(4146, "cr50");+ regIa64Map.put(4147, "cr51");+ regIa64Map.put(4148, "cr52");+ regIa64Map.put(4149, "cr53");+ regIa64Map.put(4150, "cr54");+ regIa64Map.put(4151, "cr55");+ regIa64Map.put(4152, "cr56");+ regIa64Map.put(4153, "cr57");+ regIa64Map.put(4154, "cr58");+ regIa64Map.put(4155, "cr59");+ regIa64Map.put(4156, "cr60");+ regIa64Map.put(4157, "cr61");+ regIa64Map.put(4158, "cr62");+ regIa64Map.put(4159, "cr63");+ regIa64Map.put(4160, "salid");+ regIa64Map.put(4161, "saivr");+ regIa64Map.put(4162, "satpr");+ regIa64Map.put(4163, "saeoi");+ regIa64Map.put(4164, "sairr0");+ regIa64Map.put(4165, "sairr1");+ regIa64Map.put(4166, "sairr2");+ regIa64Map.put(4167, "sairr3");+ regIa64Map.put(4168, "saitv");+ regIa64Map.put(4169, "sapmv");+ regIa64Map.put(4170, "sacmcv");+ regIa64Map.put(4171, "cr75");+ regIa64Map.put(4172, "cr76");+ regIa64Map.put(4173, "cr77");+ regIa64Map.put(4174, "cr78");+ regIa64Map.put(4175, "cr79");+ regIa64Map.put(4176, "salrr0");+ regIa64Map.put(4177, "salrr1");+ regIa64Map.put(4178, "cr82");+ regIa64Map.put(4179, "cr83");+ regIa64Map.put(4180, "cr84");+ regIa64Map.put(4181, "cr85");+ regIa64Map.put(4182, "cr86");+ regIa64Map.put(4183, "cr87");+ regIa64Map.put(4184, "cr88");+ regIa64Map.put(4185, "cr89");+ regIa64Map.put(4186, "cr90");+ regIa64Map.put(4187, "cr91");+ regIa64Map.put(4188, "cr92");+ regIa64Map.put(4189, "cr93");+ regIa64Map.put(4190, "cr94");+ regIa64Map.put(4191, "cr95");+ regIa64Map.put(4192, "cr96");+ regIa64Map.put(4193, "cr97");+ regIa64Map.put(4194, "cr98");+ regIa64Map.put(4195, "cr99");+ regIa64Map.put(4196, "cr100");+ regIa64Map.put(4197, "cr101");+ regIa64Map.put(4198, "cr102");+ regIa64Map.put(4199, "cr103");+ regIa64Map.put(4200, "cr104");+ regIa64Map.put(4201, "cr105");+ regIa64Map.put(4202, "cr106");+ regIa64Map.put(4203, "cr107");+ regIa64Map.put(4204, "cr108");+ regIa64Map.put(4205, "cr109");+ regIa64Map.put(4206, "cr110");+ regIa64Map.put(4207, "cr111");+ regIa64Map.put(4208, "cr112");+ regIa64Map.put(4209, "cr113");+ regIa64Map.put(4210, "cr114");+ regIa64Map.put(4211, "cr115");+ regIa64Map.put(4212, "cr116");+ regIa64Map.put(4213, "cr117");+ regIa64Map.put(4214, "cr118");+ regIa64Map.put(4215, "cr119");+ regIa64Map.put(4216, "cr120");+ regIa64Map.put(4217, "cr121");+ regIa64Map.put(4218, "cr122");+ regIa64Map.put(4219, "cr123");+ regIa64Map.put(4220, "cr124");+ regIa64Map.put(4221, "cr125");+ regIa64Map.put(4222, "cr126");+ regIa64Map.put(4223, "cr127");++ regIa64Map.put(5120, "pkr0");+ regIa64Map.put(5121, "pkr1");+ regIa64Map.put(5122, "pkr2");+ regIa64Map.put(5123, "pkr3");+ regIa64Map.put(5124, "pkr4");+ regIa64Map.put(5125, "pkr5");+ regIa64Map.put(5126, "pkr6");+ regIa64Map.put(5127, "pkr7");+ regIa64Map.put(5128, "pkr8");+ regIa64Map.put(5129, "pkr9");+ regIa64Map.put(5130, "pkr10");+ regIa64Map.put(5131, "pkr11");+ regIa64Map.put(5132, "pkr12");+ regIa64Map.put(5133, "pkr13");+ regIa64Map.put(5134, "pkr14");+ regIa64Map.put(5135, "pkr15");++ regIa64Map.put(6144, "rr0");+ regIa64Map.put(6145, "rr1");+ regIa64Map.put(6146, "rr2");+ regIa64Map.put(6147, "rr3");+ regIa64Map.put(6148, "rr4");+ regIa64Map.put(6149, "rr5");+ regIa64Map.put(6150, "rr6");+ regIa64Map.put(6151, "rr7");++ regIa64Map.put(7168, "pfd0");+ regIa64Map.put(7169, "pfd1");+ regIa64Map.put(7170, "pfd2");+ regIa64Map.put(7171, "pfd3");+ regIa64Map.put(7172, "pfd4");+ regIa64Map.put(7173, "pfd5");+ regIa64Map.put(7174, "pfd6");+ regIa64Map.put(7175, "pfd7");+ regIa64Map.put(7176, "pfd8");+ regIa64Map.put(7177, "pfd9");+ regIa64Map.put(7178, "pfd10");+ regIa64Map.put(7179, "pfd11");+ regIa64Map.put(7180, "pfd12");+ regIa64Map.put(7181, "pfd13");+ regIa64Map.put(7182, "pfd14");+ regIa64Map.put(7183, "pfd15");+ regIa64Map.put(7184, "pfd16");+ regIa64Map.put(7185, "pfd17");++ regIa64Map.put(7424, "pfc0");+ regIa64Map.put(7425, "pfc1");+ regIa64Map.put(7426, "pfc2");+ regIa64Map.put(7427, "pfc3");+ regIa64Map.put(7428, "pfc4");+ regIa64Map.put(7429, "pfc5");+ regIa64Map.put(7430, "pfc6");+ regIa64Map.put(7431, "pfc7");+ regIa64Map.put(7432, "pfc8");+ regIa64Map.put(7433, "pfc9");+ regIa64Map.put(7434, "pfc10");+ regIa64Map.put(7435, "pfc11");+ regIa64Map.put(7436, "pfc12");+ regIa64Map.put(7437, "pfc13");+ regIa64Map.put(7438, "pfc14");+ regIa64Map.put(7439, "pfc15");++ regIa64Map.put(8192, "tri0");+ regIa64Map.put(8193, "tri1");+ regIa64Map.put(8194, "tri2");+ regIa64Map.put(8195, "tri3");+ regIa64Map.put(8196, "tri4");+ regIa64Map.put(8197, "tri5");+ regIa64Map.put(8198, "tri6");+ regIa64Map.put(8199, "tri7");++ regIa64Map.put(8320, "trd0");+ regIa64Map.put(8321, "trd1");+ regIa64Map.put(8322, "trd2");+ regIa64Map.put(8323, "trd3");+ regIa64Map.put(8324, "trd4");+ regIa64Map.put(8325, "trd5");+ regIa64Map.put(8326, "trd6");+ regIa64Map.put(8327, "trd7");++ regIa64Map.put(8448, "dbi0");+ regIa64Map.put(8449, "dbi1");+ regIa64Map.put(8450, "dbi2");+ regIa64Map.put(8451, "dbi3");+ regIa64Map.put(8452, "dbi4");+ regIa64Map.put(8453, "dbi5");+ regIa64Map.put(8454, "dbi6");+ regIa64Map.put(8455, "dbi7");++ regIa64Map.put(8576, "dbd0");+ regIa64Map.put(8577, "dbd1");+ regIa64Map.put(8578, "dbd2");+ regIa64Map.put(8579, "dbd3");+ regIa64Map.put(8580, "dbd4");+ regIa64Map.put(8581, "dbd5");+ regIa64Map.put(8582, "dbd6");+ regIa64Map.put(8583, "dbd7");+ }++ private static final String badRegister = "bad register";++ //==============================================================================================+ private AbstractPdb pdb;+ private int register;++ //==============================================================================================+ /**+ * Constructor for this symbol component.+ * @param pdb {@link AbstractPdb} to which this symbol belongs.+ * @param register Register ID.+ */+ public RegisterName(AbstractPdb pdb, int register) {+ this.pdb = pdb;+ this.register = register;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isRegNone() {+ return (register == 0);+ }++ @Override+ public void emit(StringBuilder builder) {+ builder.append(getRegisterName(pdb.getTargetProcessorIndexNumber(), register));+ }++ private String getRegisterName(int processorIn, int registerIn) {+ if (registerIn < 0) {+ return badRegister;+ }+ if (processorIn >= 0x00 && processorIn <= 0x07 && registerIn < regX86.length) {+ return regX86[registerIn];+ }+ else if (processorIn >= 0x10 && processorIn <= 0x18 && registerIn < regMips.length) {+ return regMips[registerIn];+ }+ else if (processorIn >= 0x20 && processorIn <= 0x24 && registerIn < reg68k.length) {+ return reg68k[registerIn];+ }+ else if (processorIn >= 0x30 && processorIn <= 0x34 && registerIn < regAlpha.length) {+ return regAlpha[registerIn];+ }+ else if (processorIn >= 0x40 && processorIn <= 0x45 && registerIn < regPpc.length) {+ return regPpc[registerIn];+ }+ else if (processorIn >= 0x50 && processorIn <= 0x54 && registerIn < regSh.length) {+ return regSh[registerIn];+ }++ else if (processorIn == 0xd0 && registerIn < regAmd64.length) {+ return regAmd64[registerIn];+ }+ else if (processorIn >= 0x80 && processorIn <= 0x81 && registerIn < regIa64Map.size()) {+ String val = regIa64Map.get(registerIn);+ if (val != null) {+ return val;+ }+ }+ // TODO: Don't have anything for arm, and other processors. See API for possibilities.+ return badRegister;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractAliasMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractAliasMsType.javanew file mode 100644index 0000000000..7564dda50e--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractAliasMsType.java@@ -0,0 +1,65 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractAliasMsType extends AbstractMsType {++ protected AbstractTypeIndex underlyingTypeIndex;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractAliasMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ underlyingTypeIndex = new TypeIndex32();+ create();+ underlyingTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, underlyingTypeIndex.get()));+ pdb.popDependencyStack();+ name.parse(reader);+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No API for this. Just outputting something that might be useful.+ // At this time, not doing anything with bind here; don't think it is warranted.+ builder.append(pdb.getTypeRecord(underlyingTypeIndex.get()));+ builder.append(" ");+ builder.append(name.get());+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractArgumentsListMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractArgumentsListMsType.javanew file mode 100644index 0000000000..edf6750f79--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractArgumentsListMsType.java@@ -0,0 +1,76 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.*;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractArgumentsListMsType extends AbstractMsType {++ protected List<AbstractTypeIndex> argTypeIndexList = new ArrayList<>();++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractArgumentsListMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ parseTypeIndexList(reader);+ for (AbstractTypeIndex index : argTypeIndexList) {+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, index.get()));+ pdb.popDependencyStack();+ }+ }++ /**+ * Returns List<AbstractTypeIndex> of indices in the argument list.+ * @return List<AbstractTypeIndex>+ */+ public List<AbstractTypeIndex> getArgTypeIndexList() {+ return argTypeIndexList;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ DelimiterState ds = new DelimiterState("", ", ");+ builder.append("(");+ for (AbstractTypeIndex typeIndex : argTypeIndexList) {+ AbstractMsType type = pdb.getTypeRecord(typeIndex.get());+ builder.append(ds.out(true, type.toString()));+ }+ builder.append(")");+ }++ /**+ * Abstract internal method to parse the type index list.+ * @param reader {@link PdbByteReader} that is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseTypeIndexList(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractArrayMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractArrayMsType.javanew file mode 100644index 0000000000..fca4d9947e--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractArrayMsType.java@@ -0,0 +1,135 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.math.BigInteger;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractArrayMsType extends AbstractMsType {++ protected AbstractTypeIndex elementTypeIndex;+ protected AbstractTypeIndex indexTypeIndex;+ protected BigInteger size;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractArrayMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ elementTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, elementTypeIndex.get()));+ pdb.popDependencyStack();+ indexTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, indexTypeIndex.get()));+ pdb.popDependencyStack();+ size = reader.parseNumeric();+ parseExtraFields(reader);+ name.parse(reader);+ reader.skipPadding();+ }++ /**+ * Returns the size of the array (number of elements * element size).+ * @return The size the array.+ */+ public BigInteger getSize() {+ return size;+ }++ /**+ * Returns the record index of the element type of this array.+ * @return The index of the base element type of the array.+ */+ public int getElementTypeIndex() {+ return elementTypeIndex.get();+ }++ /**+ * Returns the element type of this array.+ * @return {@link AbstractMsType} that is the base element type of the array.+ */+ public AbstractMsType getElementType() {+ return pdb.getTypeRecord(elementTypeIndex.get());+ }++ /**+ * Returns the index type of this array.+ * @return {@link AbstractMsType} that is the index type of the array.+ */+ public AbstractMsType getIndexType() {+ return pdb.getTypeRecord(indexTypeIndex.get());+ }++ /**+ * Returns the name of this array.+ * @return Name of the array.+ */+ @Override+ public String getName() {+ return name.get();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ if (bind.ordinal() < Bind.ARRAY.ordinal()) {+ builder.insert(0, "(");+ builder.append(")");+ }+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append("<");+ myBuilder.append(pdb.getTypeRecord(indexTypeIndex.get()));+ myBuilder.append(">");++ builder.append("[");+ builder.append(size);+ builder.append(myBuilder);+ builder.append("]");++ getElementType().emit(builder, Bind.ARRAY);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Internal method to parse particular extra fields in the deserialization process.+ * @param reader {@link PdbByteReader} that is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected void parseExtraFields(PdbByteReader reader) throws PdbException {+ // Do nothing as default.+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractBaseClassMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractBaseClassMsType.javanew file mode 100644index 0000000000..a8c3e754c7--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractBaseClassMsType.java@@ -0,0 +1,74 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.math.BigInteger;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractBaseClassMsType extends AbstractMsType {++ protected AbstractTypeIndex baseClassIndex;+ protected ClassFieldMsAttributes attribute;+ protected BigInteger offset;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractBaseClassMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseFields(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, baseClassIndex.get()));+ pdb.popDependencyStack();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ attribute.emit(builder);+ builder.append(":");+ builder.append(pdb.getTypeRecord(baseClassIndex.get()));+ builder.append("<@");+ builder.append(offset);+ builder.append(">");+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the fields for this type.+ * @param reader {@link PdbByteReader} from which data is parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractBasicArrayMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractBasicArrayMsType.javanew file mode 100644index 0000000000..c4fea24ec1--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractBasicArrayMsType.java@@ -0,0 +1,72 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractBasicArrayMsType extends AbstractMsType {++ protected AbstractTypeIndex underlyingTypeIndex;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractBasicArrayMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ underlyingTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, underlyingTypeIndex.get()));+ pdb.popDependencyStack();+ }++ /**+ * Returns the type that is pointed to.+ * @return {@link AbstractMsType} type that is pointed to by this pointer.+ */+ public AbstractMsType getUnderlyingType() {+ return pdb.getTypeRecord(underlyingTypeIndex.get());+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // TODO: This might be wrong. I'm using bind twice. Revisit.+ getUnderlyingType().emit(builder, bind);+ if (bind.ordinal() < Bind.ARRAY.ordinal()) {+ builder.insert(0, "(");+ builder.append(")");+ }+ builder.append("[]");+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractBitfieldMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractBitfieldMsType.javanew file mode 100644index 0000000000..0792e8ce46--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractBitfieldMsType.java@@ -0,0 +1,97 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractBitfieldMsType extends AbstractMsType {++ protected AbstractTypeIndex elementTypeIndex;+ protected int length;+ protected int position;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractBitfieldMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseFields(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, elementTypeIndex.get()));+ pdb.popDependencyStack();+ }++ /**+ * Returns the type index of the element type.+ * @return The element type.+ */+ public int getElementTypeIndex() {+ return elementTypeIndex.get();+ }++ /**+ * Returns the bit length of the bit-field.+ * @return The bit length.+ */+ public int getBitLength() {+ return length;+ }++ /**+ * Returns the bit position of the bit-field.+ * @return The bit position.+ */+ public int getBitPosition() {+ return position;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No documented API for output.+ pdb.getTypeRecord(elementTypeIndex.get()).emit(builder, Bind.NONE);+ builder.append(" : ");+ builder.append(length);+ builder.append(" <@");+ builder.append(position);+ builder.append(">");+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the fields for this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractClassMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractClassMsType.javanew file mode 100644index 0000000000..1a953310d6--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractClassMsType.java@@ -0,0 +1,48 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractClassMsType extends AbstractCompositeMsType {++ private static final String TYPE_STRING = "class";++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractClassMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ protected String getTypeString() {+ return TYPE_STRING;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractCobol0MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractCobol0MsType.javanew file mode 100644index 0000000000..f1d51ded7e--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractCobol0MsType.java@@ -0,0 +1,71 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractCobol0MsType extends AbstractMsType {++ protected AbstractTypeIndex parentTypeIndex;+ // TODO: This is made up data. API and examples are unknown.+ protected byte[] data;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractCobol0MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parentTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, parentTypeIndex.get()));+ pdb.popDependencyStack();+ data = reader.parseBytesRemaining();+ }++ /**+ * Returns the type that is pointed to.+ * @return {@link AbstractMsType} type that is pointed to by this pointer.+ */+ public AbstractMsType getParentType() {+ return pdb.getTypeRecord(parentTypeIndex.get());+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append("Cobol0MsType\n");+ builder.append(String.format(" parent type index: %s\n", getParentType()));+ builder.append(String.format(" additional data length: %d\n", data.length));+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractCompositeMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractCompositeMsType.javanew file mode 100644index 0000000000..7b79f2be79--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractCompositeMsType.java@@ -0,0 +1,180 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.math.BigInteger;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractCompositeMsType extends AbstractMsType {++ protected int count;+ protected AbstractTypeIndex fieldDescriptorListTypeIndex;+ protected MsProperty property;+ protected AbstractTypeIndex derivedFromListTypeIndex; // Zero if none. Not used by union.+ protected AbstractTypeIndex vShapeTableTypeIndex; // Not used by union.+ //TODO: has more... guessing below+ protected BigInteger size;+ protected AbstractString name;+ protected AbstractString mangledName; // Used by MsType (not used by 16MsType or StMsType?)++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractCompositeMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseFields(reader);+ reader.skipPadding();+ if (fieldDescriptorListTypeIndex.get() != 0) {+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, fieldDescriptorListTypeIndex.get()));+ pdb.popDependencyStack();+ }+ if ((derivedFromListTypeIndex != null) && (derivedFromListTypeIndex.get() != 0)) {+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, derivedFromListTypeIndex.get()));+ pdb.popDependencyStack();+ }+ if ((vShapeTableTypeIndex != null) && (vShapeTableTypeIndex.get() != 0)) {+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, vShapeTableTypeIndex.get()));+ pdb.popDependencyStack();+ }+ }++ /**+ * Returns the name of this composite.+ * @return Name type of the composite.+ */+ @Override+ public String getName() {+ return name.get();+ }++ /**+ * Returns the mangled name within this composite.+ * @return Mangled name.+ */+ public String getMangledName() {+ return mangledName.get();+ }++ /**+ * Returns the type index of the field descriptor list used for this composite.+ * @return Type index of the field descriptor list.+ */+ public int getFieldDescriptorListTypeIndex() {+ return fieldDescriptorListTypeIndex.get();+ }++ /**+ * Returns the type index of the derived-from list of types.+ * @return Type index of the derived-from list of types.+ */+ public int getDerivedFromListTypeIndex() {+ if (derivedFromListTypeIndex == null) {+ return 0;+ }+ return derivedFromListTypeIndex.get();+ }++ /**+ * Returns the type index of the VShape table.+ * @return Type index of the VShape table.+ */+ public int getVShapeTableTypeIndex() {+ if (vShapeTableTypeIndex == null) {+ return 0;+ }+ return vShapeTableTypeIndex.get();+ }++ /**+ * Returns the MsProperty of this composite.+ * @return {@link MsProperty} of this composite.+ */+ public MsProperty getMsProperty() {+ return property;+ }++ /**+ * Returns the size of this composite+ * @return Size of this composite.+ */+ public BigInteger getSize() {+ return size;+ }++ /**+ * Returns the field type for the fields of this class. Returns null if none.+ * @return {@link AbstractMsType} type of the field type or null if none.+ */+ public AbstractMsType getFieldDescriptorListType() {+ if (fieldDescriptorListTypeIndex.get() == 0) {+ return null;+ }+ return pdb.getTypeRecord(fieldDescriptorListTypeIndex.get());+ }++ //TODO: ??? nothing done with mangledName+ @Override+ public void emit(StringBuilder builder, Bind bind) {+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append(getTypeString());+ myBuilder.append(" ");+ myBuilder.append(name);+ myBuilder.append("<");+ myBuilder.append(count);+ myBuilder.append(",");+ myBuilder.append(property);+ myBuilder.append(">");+ AbstractMsType fieldType = getFieldDescriptorListType();+ if (fieldType != null) {+ myBuilder.append(fieldType);+ }+ myBuilder.append(" ");+ builder.insert(0, myBuilder);+ }++ protected abstract void create();++ /**+ * Parsed the fields for this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException upon error parsing a field.+ */+ protected abstract void parseFields(PdbByteReader reader) throws PdbException;++ /**+ * Returns the type of composite.+ * @return Standard (C/C++) name for the type of composite.+ */+ protected abstract String getTypeString();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDefaultArgumentsMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDefaultArgumentsMsType.javanew file mode 100644index 0000000000..6ef4374af4--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDefaultArgumentsMsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractDefaultArgumentsMsType extends AbstractMsType {++ protected AbstractTypeIndex typeIndex;+ protected AbstractString expression;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractDefaultArgumentsMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ create();+ typeIndex.parse(reader);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, typeIndex.get()));+ pdb.popDependencyStack();+ expression.parse(reader);+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append(pdb.getTypeRecord(typeIndex.get()));+ builder.append(" ");+ builder.append(expression);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDerivedClassListMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDerivedClassListMsType.javanew file mode 100644index 0000000000..1f32c9b53d--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDerivedClassListMsType.java@@ -0,0 +1,68 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.*;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractDerivedClassListMsType extends AbstractMsType {++ protected List<AbstractTypeIndex> typeIndexList = new ArrayList<>();++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractDerivedClassListMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ parseTypeIndexList(reader);+ for (AbstractTypeIndex typeIndex : typeIndexList) {+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, typeIndex.get()));+ pdb.popDependencyStack();+ }+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ DelimiterState ds = new DelimiterState("", ", ");+ for (AbstractTypeIndex typeIndex : typeIndexList) {+ AbstractMsType type = pdb.getTypeRecord(typeIndex.get());+ builder.append(ds.out(true, type.toString()));+ }+ }++ /**+ * Parses the Type Index List.+ * @param reader {@link PdbByteReader} that is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseTypeIndexList(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayConstBoundsLowerUpperMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayConstBoundsLowerUpperMsType.javanew file mode 100644index 0000000000..e17d2a8a2e--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayConstBoundsLowerUpperMsType.java@@ -0,0 +1,113 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractDimensionedArrayConstBoundsLowerUpperMsType extends AbstractMsType {++ protected int rank;+ protected AbstractTypeIndex typeIndex;+ // TODO: dimData is unknown. Needs analysis and implementation break-out.+ protected long[] lowerBound;+ protected long[] upperBound;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractDimensionedArrayConstBoundsLowerUpperMsType(AbstractPdb pdb,+ PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseBeginningFields(reader);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, typeIndex.get()));+ pdb.popDependencyStack();+ // TODO: fix all of this once we know the true size of each (assuming it is fixed).+ byte[] remainingData = reader.parseBytesRemaining();+ PdbByteReader boundsReader = new PdbByteReader(remainingData);+ int length = remainingData.length;+ assert (length % (2 * rank)) == 0; // two for lower and upper+ lowerBound = new long[rank];+ upperBound = new long[rank];+ int size = length / (2 * rank);+ switch (size) {+ case 1:+ for (int i = 0; i < rank; i++) {+ lowerBound[i] = boundsReader.parseUnsignedByteVal();+ upperBound[i] = boundsReader.parseUnsignedByteVal();+ }+ break;+ case 2:+ for (int i = 0; i < rank; i++) {+ lowerBound[i] = boundsReader.parseShort();+ upperBound[i] = boundsReader.parseShort();+ }+ break;+ case 4:+ for (int i = 0; i < rank; i++) {+ lowerBound[i] = boundsReader.parseInt();+ upperBound[i] = boundsReader.parseInt();+ }+ break;+ case 8:+ for (int i = 0; i < rank; i++) {+ lowerBound[i] = boundsReader.parseLong();+ upperBound[i] = boundsReader.parseLong();+ }+ break;+ default:+ assert false;+ }+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No documented API for output.+ pdb.getTypeRecord(typeIndex.get()).emit(builder, Bind.NONE);+ for (int i = 0; i < rank; i++) {+ builder.append("[");+ builder.append(lowerBound[i]);+ builder.append(":");+ builder.append(upperBound[i]);+ builder.append("]");+ }+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parsed the beginning fields of this type.+ * @param reader {@link PdbByteReader} from which the data is parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseBeginningFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayConstBoundsUpperMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayConstBoundsUpperMsType.javanew file mode 100644index 0000000000..f69ffa4e94--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayConstBoundsUpperMsType.java@@ -0,0 +1,105 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractDimensionedArrayConstBoundsUpperMsType extends AbstractMsType {++ protected int rank;+ protected AbstractTypeIndex typeIndex;+ // TODO: dimData is unknown. Needs analysis and implementation break-out.+ protected long[] upperBound;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractDimensionedArrayConstBoundsUpperMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ create();+ parseBeginningFields(reader);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, typeIndex.get()));+ pdb.popDependencyStack();+ // TODO: fix all of this once we know the true size of each (assuming it is fixed).+ byte[] remainingData = reader.parseBytesRemaining();+ PdbByteReader boundsReader = new PdbByteReader(remainingData);+ int length = remainingData.length;+ assert (length % rank) == 0;+ upperBound = new long[rank];+ int size = length / rank;+ switch (size) {+ case 1:+ for (int i = 0; i < rank; i++) {+ upperBound[i] = boundsReader.parseUnsignedByteVal();+ }+ break;+ case 2:+ for (int i = 0; i < rank; i++) {+ upperBound[i] = boundsReader.parseShort();+ }+ break;+ case 4:+ for (int i = 0; i < rank; i++) {+ upperBound[i] = boundsReader.parseInt();+ }+ break;+ case 8:+ for (int i = 0; i < rank; i++) {+ upperBound[i] = boundsReader.parseLong();+ }+ break;+ default:+ assert false;+ }+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No documented API for output.+ pdb.getTypeRecord(typeIndex.get()).emit(builder, Bind.NONE);+ for (int i = 0; i < rank; i++) {+ builder.append("[0:");+ builder.append(upperBound[i]);+ builder.append("]");+ }+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the initial fields for this type.+ * @param reader {@link PdbByteReader} from which the beginning fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseBeginningFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayMsType.javanew file mode 100644index 0000000000..d36c2ea323--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayMsType.java@@ -0,0 +1,102 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractDimensionedArrayMsType extends AbstractMsType {++ protected AbstractTypeIndex elementTypeIndex;+ protected AbstractTypeIndex dimensionInformation;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractDimensionedArrayMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ create();+ elementTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, elementTypeIndex.get()));+ pdb.popDependencyStack();+ dimensionInformation.parse(reader);+ name.parse(reader);+ reader.skipPadding();+ }++ /**+ * Returns the element type of this array.+ * @return The AbstractMsType that is the base element type of the array.+ */+ public AbstractMsType getElementType() {+ return pdb.getTypeRecord(elementTypeIndex.get());+ }++ /**+ * Returns the dimension information of this array.+ * @return The dimension information of the array.+ */+ public int getIndexType() {+ return dimensionInformation.get();+ }++ /**+ * Returns the name of this dimensioned array.+ * @return Name of the dimensioned array.+ */+ @Override+ public String getName() {+ return name.get();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ if (bind.ordinal() < Bind.ARRAY.ordinal()) {+ builder.insert(0, "(");+ builder.append(")");+ }+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append("<");+ myBuilder.append(dimensionInformation.get());+ myBuilder.append(">");++ builder.append("[");+ builder.append(myBuilder);+ builder.append("]");++ getElementType().emit(builder, Bind.ARRAY);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayVarBoundsLowerUpperMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayVarBoundsLowerUpperMsType.javanew file mode 100644index 0000000000..daabc8231f--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayVarBoundsLowerUpperMsType.java@@ -0,0 +1,104 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractDimensionedArrayVarBoundsLowerUpperMsType extends AbstractMsType {++ protected int rank;+ protected AbstractTypeIndex typeIndex;+ // TODO: dim is unknown. Needs analysis and implementation break-out.+ protected List<AbstractTypeIndex> lowerBound = new ArrayList<>();+ protected List<AbstractTypeIndex> upperBound = new ArrayList<>();++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractDimensionedArrayVarBoundsLowerUpperMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ create();+ parseBeginningFields(reader);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, typeIndex.get()));+ pdb.popDependencyStack();+ for (int i = 0; i < rank; i++) {+ AbstractTypeIndex lowerTypeIndex = parseTypeIndex(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, lowerTypeIndex.get()));+ pdb.popDependencyStack();+ assert ((pdb.getTypeRecord(lowerTypeIndex.get()) instanceof ReferencedSymbolMsType) ||+ (lowerTypeIndex.get() == 3));+ lowerBound.add(lowerTypeIndex);+ AbstractTypeIndex upperTypeIndex = parseTypeIndex(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, upperTypeIndex.get()));+ pdb.popDependencyStack();+ assert ((pdb.getTypeRecord(upperTypeIndex.get()) instanceof ReferencedSymbolMsType) ||+ (upperTypeIndex.get() == 3));+ upperBound.add(upperTypeIndex);+ }+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No documented API for output.+ pdb.getTypeRecord(typeIndex.get()).emit(builder, Bind.NONE);+ for (int i = 0; i < rank; i++) {+ builder.append("[");+ builder.append(pdb.getTypeRecord(lowerBound.get(i).get()));+ builder.append(":");+ builder.append(pdb.getTypeRecord(upperBound.get(i).get()));+ builder.append("]");+ }+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the initial fields for this type.+ * @param reader {@link PdbByteReader} from which the beginning fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseBeginningFields(PdbByteReader reader) throws PdbException;++ /**+ * Parses a type index field for this type+ * @param reader {@link PdbByteReader} from which the type index is parsed.+ * @return {@link AbstractTypeIndex} type index parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract AbstractTypeIndex parseTypeIndex(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayVarBoundsUpperMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayVarBoundsUpperMsType.javanew file mode 100644index 0000000000..c19ca5a14d--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractDimensionedArrayVarBoundsUpperMsType.java@@ -0,0 +1,96 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractDimensionedArrayVarBoundsUpperMsType extends AbstractMsType {++ protected int rank;+ protected AbstractTypeIndex typeIndex;+ // TODO: dim is unknown. Needs analysis and implementation break-out.+ protected List<AbstractTypeIndex> upperBound = new ArrayList<>();++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractDimensionedArrayVarBoundsUpperMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ create();+ parseBeginningFields(reader);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, typeIndex.get()));+ pdb.popDependencyStack();+ // TODO: fix all of this once we know the true size of each (assuming it is fixed).+ AbstractTypeIndex upperTypeIndex;+ for (int i = 0; i < rank; i++) {+ upperTypeIndex = parseTypeIndex(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, upperTypeIndex.get()));+ pdb.popDependencyStack();+ assert ((pdb.getTypeRecord(upperTypeIndex.get()) instanceof ReferencedSymbolMsType) ||+ (upperTypeIndex.get() == 3));+ upperBound.add(upperTypeIndex);+ }+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No documented API for output.+ pdb.getTypeRecord(typeIndex.get()).emit(builder, Bind.NONE);+ for (int i = 0; i < rank; i++) {+ builder.append("[0:");+ builder.append(pdb.getTypeRecord(upperBound.get(i).get()));+ builder.append("]");+ }+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the initial fields for this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseBeginningFields(PdbByteReader reader) throws PdbException;++ /**+ * Parses a type index for this type.+ * @param reader {@link PdbByteReader} from which the type index is parsed.+ * @return {@link AbstractTypeIndex} type index parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract AbstractTypeIndex parseTypeIndex(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractEnumMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractEnumMsType.javanew file mode 100644index 0000000000..45934eb169--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractEnumMsType.java@@ -0,0 +1,130 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractEnumMsType extends AbstractMsType {++ protected int numElements;+ protected MsProperty property;+ protected AbstractTypeIndex underlyingTypeIndex;+ protected AbstractTypeIndex fieldDescriptorListTypeIndex;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractEnumMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseFields(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, underlyingTypeIndex.get()));+ pdb.popDependencyStack();+ if (fieldDescriptorListTypeIndex.get() != 0) {+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, fieldDescriptorListTypeIndex.get()));+ pdb.popDependencyStack();+ }+ reader.skipPadding();+ }++ /**+ * Returns the name of this enum type.+ * @return Name type of the enum type.+ */+ @Override+ public String getName() {+ return name.get();+ }++ /**+ * Returns the number of elements in this Enum.+ * @return Number of elements in this Enum.+ */+ public int getNumElements() {+ return numElements;+ }++ /**+ * Returns the type index of the underlying type of this Enum.+ * @return Type index of the underlying type.+ */+ public int getUnderlyingTypeIndex() {+ return underlyingTypeIndex.get();+ }++ /**+ * Returns the type index of the field descriptor list of this Enum+ * @return Type index of the field descriptor list.+ */+ public int getFieldDescriptorListTypeIndex() {+ return fieldDescriptorListTypeIndex.get();+ }++ /**+ * Returns the MsProperty of this Enum+ * @return {@link MsProperty} of this Enum.+ */+ public MsProperty getMsProperty() {+ return property;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append("enum ");+ myBuilder.append(name);+ myBuilder.append("<");+ myBuilder.append(numElements);+ myBuilder.append(",");+ myBuilder.append(pdb.getTypeRecord(underlyingTypeIndex.get()));+ myBuilder.append(",");+ myBuilder.append(property);+ myBuilder.append(">");+ if (fieldDescriptorListTypeIndex.get() != 0) {+ myBuilder.append(pdb.getTypeRecord(fieldDescriptorListTypeIndex.get()));+ }+ myBuilder.append(" ");+ builder.insert(0, myBuilder);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the fields of the enum type.+ * @param reader {@link PdbByteReader} from which to parse the fields.+ * @throws PdbException upon error parsing a field.+ */+ protected abstract void parseFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractEnumerateMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractEnumerateMsType.javanew file mode 100644index 0000000000..7d8d837fc8--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractEnumerateMsType.java@@ -0,0 +1,85 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.math.BigInteger;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.AbstractString;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractEnumerateMsType extends AbstractMsType {++ protected ClassFieldMsAttributes attribute;+ protected BigInteger numeric;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractEnumerateMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ attribute = new ClassFieldMsAttributes(reader);+ numeric = reader.parseNumeric();+ name.parse(reader);+ reader.align4();+ }++ /**+ * Returns the name of this enumerate type.+ * @return Name type of the enumerate type.+ */+ @Override+ public String getName() {+ return name.get();+ }++ /**+ * Returns the numeric value of this Enumerate+ * @return The value of this Enumerate.+ */+ public BigInteger getNumeric() {+ return numeric;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // Attribute and space are not in API.+ builder.append(attribute);+ builder.append(": ");+ builder.append(name);+ builder.append("=");+ builder.append(numeric);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractFieldListMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractFieldListMsType.javanew file mode 100644index 0000000000..8c28a963aa--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractFieldListMsType.java@@ -0,0 +1,117 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.*;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractFieldListMsType extends AbstractMsType {++ private List<AbstractMsType> nameSpaceList = new ArrayList<>();+ private List<AbstractMsType> memberList = new ArrayList<>();+ private List<AbstractMsType> otherList = new ArrayList<>();++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractFieldListMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ while (reader.hasMore()) {+ AbstractMsType type = pdb.getTypeParser().parse(reader);+ if ((type instanceof AbstractBaseClassMsType) ||+ (type instanceof AbstractVirtualBaseClassMsType) ||+ (type instanceof AbstractIndirectVirtualBaseClassMsType)) {+ nameSpaceList.add(type);+ }+ else if ((type instanceof AbstractMemberMsType) ||+ (type instanceof AbstractEnumerateMsType)) {+ memberList.add(type);+ }+ else {+ otherList.add(type);+ }+ }+ }++ /**+ * Returns the (ordered?) {@link List}<{@link AbstractMsType}> of types in the namespace.+ * @return List of types in the namespace.+ */+ public List<AbstractMsType> getNamespaceList() {+ return nameSpaceList;+ }++ /**+ * Returns the (ordered?) {@link List}<{@link AbstractMsType}> of type members types of+ * this field list.+ * @return Field list.+ */+ public List<AbstractMsType> getMemberList() {+ return memberList;+ }++ /**+ * Returns the (ordered?) {@link List}<{@link AbstractMsType}> of other types. (We have+ * separated these out, but are unsure about what they are at this time.)+ * @return List of other types.+ */+ public List<AbstractMsType> getOtherList() {+ return otherList;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ //TODO: Note the documented API does not output field of the following types:+ // MSOverloadedMethod_16, MSOverloadedMethod,+ // MSStaticMethod_16, MSStaticMethod,+ // MSOneMethod_16, MSOneMethod.+ StringBuilder classBuilder = new StringBuilder();+ DelimiterState dsBases = new DelimiterState(" : ", ", ");+ for (AbstractMsType type : nameSpaceList) {+ classBuilder.append(dsBases.out(true, type.toString()));+ }++ StringBuilder memberBuilder = new StringBuilder();+ memberBuilder.append(" {");+ DelimiterState dsMembers = new DelimiterState("", ",");+ for (AbstractMsType type : memberList) {+ memberBuilder.append(dsMembers.out(true, type.toString()));+ }+ memberBuilder.append("}");++ StringBuilder otherBuilder = new StringBuilder();+ if (otherList.size() != 0) {+ otherBuilder.append("...");+ }+ builder.append(classBuilder);+ builder.append(memberBuilder);+ builder.append(otherBuilder);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractFriendClassMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractFriendClassMsType.javanew file mode 100644index 0000000000..e42fe79b54--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractFriendClassMsType.java@@ -0,0 +1,68 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractFriendClassMsType extends AbstractMsType {++ protected AbstractTypeIndex friendClassTypeIndex;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractFriendClassMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseInitialFields(reader);+ friendClassTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, friendClassTypeIndex.get()));+ pdb.popDependencyStack();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // TODO: API not documented. Fix this as figured out.+ builder.append("friend: ");+ builder.append(pdb.getTypeRecord(friendClassTypeIndex.get()).toString());+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the initial fields of this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseInitialFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractFriendFunctionMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractFriendFunctionMsType.javanew file mode 100644index 0000000000..a517057da8--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractFriendFunctionMsType.java@@ -0,0 +1,71 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractFriendFunctionMsType extends AbstractMsType {++ protected AbstractTypeIndex friendTypeIndex;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractFriendFunctionMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseFields(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, friendTypeIndex.get()));+ pdb.popDependencyStack();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // TODO: API not documented. Fix this as figured out.+ builder.append("friend: ");+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append(name);+ pdb.getTypeRecord(friendTypeIndex.get()).emit(myBuilder);+ builder.append(myBuilder);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parsed the fields of this type.+ * @param reader {@link PdbByteReader} from which to parse the fields.+ * @throws PdbException upon error parsing a field.+ */+ protected abstract void parseFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractIndexMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractIndexMsType.javanew file mode 100644index 0000000000..b336f7561e--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractIndexMsType.java@@ -0,0 +1,66 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.AbstractTypeIndex;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractIndexMsType extends AbstractMsType {++ protected AbstractTypeIndex referencedTypeIndex;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractIndexMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseFields(reader);+ }++ /**+ * Returns the type index of the referenced type.+ * @return Type index of the referened type.+ */+ public int getReferencedIndex() {+ return referencedTypeIndex.get();+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses fields for this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractIndirectVirtualBaseClassMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractIndirectVirtualBaseClassMsType.javanew file mode 100644index 0000000000..cd1b256483--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractIndirectVirtualBaseClassMsType.java@@ -0,0 +1,92 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.math.BigInteger;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractIndirectVirtualBaseClassMsType extends AbstractMsType {++ protected AbstractTypeIndex directVirtualBaseClassTypeIndex;+ protected AbstractTypeIndex virtualBasePointerTypeIndex;+ protected ClassFieldMsAttributes attribute;+ protected BigInteger virtualBaseOffsetFromAddressPoint;+ protected BigInteger virtualBaseOffsetFromVBTable;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractIndirectVirtualBaseClassMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ create();+ parseInitialFields(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, directVirtualBaseClassTypeIndex.get()));+ pdb.popDependencyStack();+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, virtualBasePointerTypeIndex.get()));+ pdb.popDependencyStack();+ //TODO: Check this+ virtualBaseOffsetFromAddressPoint = reader.parseNumeric();+ virtualBaseOffsetFromVBTable = reader.parseNumeric();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append("<indirect ");+ builder.append(attribute);+ builder.append(": ");+ AbstractMsType type = pdb.getTypeRecord(directVirtualBaseClassTypeIndex.get());+ builder.append(type.getName());++ StringBuilder vbpBuilder = new StringBuilder();+ vbpBuilder.append("vbp");+ pdb.getTypeRecord(virtualBasePointerTypeIndex.get()).emit(vbpBuilder, Bind.NONE);+ builder.append(vbpBuilder);+ builder.append("; offVbp=");+ builder.append(virtualBaseOffsetFromAddressPoint);+ builder.append("; offVbte=");+ builder.append(virtualBaseOffsetFromVBTable);+ builder.append("; >");+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the initial fields for this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseInitialFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractManagedMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractManagedMsType.javanew file mode 100644index 0000000000..39264a363c--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractManagedMsType.java@@ -0,0 +1,58 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.AbstractString;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractManagedMsType extends AbstractMsType {++ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractManagedMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ name.parse(reader);+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No API for this. Just outputting something that might be useful.+ // At this time, not doing anything with bind here; don't think it is warranted.+ builder.append(name.get());+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMemberFunctionMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMemberFunctionMsType.javanew file mode 100644index 0000000000..9700b7b2c0--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMemberFunctionMsType.java@@ -0,0 +1,175 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractMemberFunctionMsType extends AbstractMsType {++ protected AbstractTypeIndex returnValueTypeIndex;+ protected AbstractTypeIndex containingClassTypeIndex;+ protected AbstractTypeIndex thisPointerTypeIndex; // Model-specific+ protected int callingConvention; // MSFT API does not document the values.+ protected FunctionMsAttributes functionAttributes;+ protected int numParameters;+ protected AbstractTypeIndex argListTypeIndex;+ protected int thisAdjuster;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractMemberFunctionMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ returnValueTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, returnValueTypeIndex.get()));+ pdb.popDependencyStack();+ containingClassTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, containingClassTypeIndex.get()));+ pdb.popDependencyStack();+ thisPointerTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, thisPointerTypeIndex.get()));+ pdb.popDependencyStack();+ callingConvention = reader.parseUnsignedByteVal();+ functionAttributes = new FunctionMsAttributes(reader);+ numParameters = reader.parseUnsignedShortVal();+ argListTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, argListTypeIndex.get()));+ pdb.popDependencyStack();+ thisAdjuster = reader.parseInt();+ }++ /**+ * Returns the type index of the return type.+ * @return Type index of the return type.+ */+ public int getReturnTypeIndex() {+ return returnValueTypeIndex.get();+ }++ /**+ * Returns the calling convention (TODO: determine the mapping of these values to conventions.)+ * @return The calling convention.+ */+ public int getCallingConventionValue() {+ return callingConvention;+ }++ /**+ * Returns the function attributes.+ * @return The function attributes.+ */+ public FunctionMsAttributes getFunctionAttributes() {+ return functionAttributes;+ }++ /**+ * Returns the number of parameters to the function.+ * @return The number of parameters.+ */+ public int getNumParams() {+ return numParameters;+ }++ /**+ * Returns the type index of the arguments list.+ * @return The type index of the arguments list.+ */+ public int getArgListTypeIndex() {+ return argListTypeIndex.get();+ }++ /**+ * Returns the type for the return value type.+ * @return The {@link AbstractMsType} return value type.+ */+ public AbstractMsType getReturnType() {+ return pdb.getTypeRecord(returnValueTypeIndex.get());+ }++ /**+ * Returns the type for the class containing this method.+ * @return The {@link AbstractMsType} class containing this method.+ */+ public AbstractMsType getContainingClassType() {+ return pdb.getTypeRecord(containingClassTypeIndex.get());+ }++ /**+ * Returns the type for the "this" pointer.+ * @return The {@link AbstractMsType} "this" pointer.+ */+ public AbstractMsType getThisPointerType() {+ return pdb.getTypeRecord(thisPointerTypeIndex.get());+ }++ /**+ * Returns the type index for the arguments list.+ * @return The {@link AbstractMsType} arguments list.+ */+ public AbstractMsType getArgumentsListType() {+ return pdb.getTypeRecord(argListTypeIndex.get());+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ if (bind.ordinal() < Bind.PROC.ordinal()) {+ builder.insert(0, "(");+ builder.append(")");+ }+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append(getContainingClassType());+ myBuilder.append("::");+ builder.insert(0, myBuilder);+ builder.append(getArgumentsListType());+ builder.append("<");+ myBuilder = new StringBuilder();+ myBuilder.append("this");+ getThisPointerType().emit(myBuilder, Bind.NONE);+ builder.append(myBuilder);+ builder.append(",");+ builder.append(thisAdjuster);+ builder.append(",");+ builder.append(numParameters);+ builder.append(",");+ builder.append(functionAttributes);+ builder.append(">");++ getReturnType().emit(builder, Bind.PROC);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMemberModifyMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMemberModifyMsType.javanew file mode 100644index 0000000000..211de42e43--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMemberModifyMsType.java@@ -0,0 +1,70 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractMemberModifyMsType extends AbstractMsType {++ protected ClassFieldMsAttributes attribute;+ protected AbstractTypeIndex baseClassDefinitionTypeIndex;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractMemberModifyMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ baseClassDefinitionTypeIndex = new TypeIndex32();+ create();+ attribute = new ClassFieldMsAttributes(reader);+ baseClassDefinitionTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, baseClassDefinitionTypeIndex.get()));+ pdb.popDependencyStack();+ name.parse(reader);+ reader.align4();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No API for this. Just outputting something that might be useful.+ // At this time, not doing anything with bind here; don't think it is warranted.+ builder.append(attribute);+ builder.append(": ");+ builder.append(pdb.getTypeRecord(baseClassDefinitionTypeIndex.get()));+ builder.append(" ");+ builder.append(name.get());+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMemberMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMemberMsType.javanew file mode 100644index 0000000000..b48b0d2c73--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMemberMsType.java@@ -0,0 +1,114 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.math.BigInteger;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractMemberMsType extends AbstractMsType {++ protected ClassFieldMsAttributes attribute;+ protected AbstractTypeIndex fieldTypeRecordIndex;+ protected BigInteger offset;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractMemberMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseInitialFields(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, fieldTypeRecordIndex.get()));+ pdb.popDependencyStack();+ //TODO: might be Numeric (is for plain MSMember)+ offset = reader.parseNumeric();+ name.parse(reader);+ }++ /**+ * Returns the name of this member type.+ * @return Name type of the member type.+ */+ @Override+ public String getName() {+ return name.get();+ }++ /**+ * Returns the offset of the member.+ * @return The offset of the member.+ */+ public BigInteger getOffset() {+ return offset;+ }++ /**+ * Returns the attributes of the member.+ * @return The attributes of the member.+ */+ public ClassFieldMsAttributes getAttribute() {+ return attribute;+ }++ /**+ * Returns the type index of the field data type.+ * @return Type index of the field data type.+ */+ public int getFieldTypeRecordIndex() {+ return fieldTypeRecordIndex.get();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append(attribute);+ builder.append(": ");+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append(name);+ pdb.getTypeRecord(fieldTypeRecordIndex.get()).emit(myBuilder, Bind.NONE);+ builder.append(myBuilder);+ builder.append("<@");+ builder.append(offset);+ builder.append(">");+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the inital fields for this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseInitialFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMethodListMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMethodListMsType.javanew file mode 100644index 0000000000..ec72259f1e--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMethodListMsType.java@@ -0,0 +1,78 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.*;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractMethodListMsType extends AbstractMsType {++ protected List<AbstractMethodRecordMs> list = new ArrayList<>();++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractMethodListMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ while (reader.hasMore()) {+ AbstractMethodRecordMs record = parseOneRecord(pdb, reader);+ list.add(record);+ }+ }++ /**+ * Returns the size of the list of methods.+ * @return Size of the methods.+ */+ public int getListSize() {+ return list.size();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // Making this up; no API for output.+ DelimiterState ds = new DelimiterState("", ",");+ builder.append("{");+ for (AbstractMethodRecordMs record : list) {+ builder.append(ds.out(true, record.toString()));+ }+ builder.append("}");+ }++ /**+ * Method to parse one record.+ * @param pdbIn {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @return {@link AbstractMethodRecordMs} record parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract AbstractMethodRecordMs parseOneRecord(AbstractPdb pdbIn,+ PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMethodRecordMs.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMethodRecordMs.javanew file mode 100644index 0000000000..6e67d2d1f0--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMethodRecordMs.java@@ -0,0 +1,76 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.*;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractMethodRecordMs extends AbstractParsableItem {++ protected AbstractPdb pdb;+ protected ClassFieldMsAttributes attributes;+ protected AbstractTypeIndex procedureRecordNumber;+ protected long optionalOffset;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractMethodRecordMs(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ this.pdb = pdb;+ create();+ parseFields(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, procedureRecordNumber.get()));+ pdb.popDependencyStack();+ }++ @Override+ public void emit(StringBuilder builder) {+ // Making this up; no API for output.+ builder.append("<");+ builder.append(attributes);+ builder.append(": ");+ builder.append(pdb.getTypeRecord(procedureRecordNumber.get()));+ if (attributes.getPropertyVal() == 4) {+ builder.append(",");+ builder.append(optionalOffset);+ }+ builder.append(">");+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the fields for this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractModifierMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractModifierMsType.javanew file mode 100644index 0000000000..173d51525d--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractModifierMsType.java@@ -0,0 +1,103 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractModifierMsType extends AbstractMsType {++ protected AbstractTypeIndex modifiedTypeIndex;+ protected boolean isConst;+ protected boolean isVolatile;+ protected boolean isUnaligned;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractModifierMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseFields(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, modifiedTypeIndex.get()));+ pdb.popDependencyStack();+ reader.skipPadding();+ }++ /**+ * Returns the record type index of the type that this modifier type modifies.+ * @return The record type index of the type that is this modifier type modifies.+ */+ public int getModifiedTypeIndex() {+ return modifiedTypeIndex.get();+ }++ /**+ * Returns the {@link AbstractMsType} that this modifier type modifies.+ * @return The type that is modified.+ */+ public AbstractMsType getModifiedType() {+ return pdb.getTypeRecord(modifiedTypeIndex.get());+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ StringBuilder modBuilder = new StringBuilder();+ modBuilder.append(isConst ? "const " : "");+ modBuilder.append(isVolatile ? "volatile " : "");+ modBuilder.append(isUnaligned ? "__unaligned " : ""); // Not in API.+ modBuilder.append(getModifiedType());+ modBuilder.append(" ");+ builder.insert(0, modBuilder);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the fields for this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseFields(PdbByteReader reader) throws PdbException;++ /**+ * Internal method to process the integer attributes value into individual components.+ * @param attributes Attributes field to be parsed/processed.+ */+ protected void processAttributes(int attributes) {+ isConst = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ isVolatile = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ isUnaligned = ((attributes & 0x0001) == 0x0001);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMsType.javaindex 3659d6dc5c..488be58cd1 100644--- a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMsType.java+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractMsType.java@@ -20,7 +20,7 @@ import ghidra.pdb.PdbByteReader;import ghidra.pdb.pdbreader.AbstractPdb;/**- * This class extends {@link AbstractParsableItem} as is the base class for PDB Data Type units.+ * This is the abstract class for PDB Data Type units.*/public abstract class AbstractMsType extends AbstractParsableItem {protected AbstractPdb pdb;diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractNestedTypeExtMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractNestedTypeExtMsType.javanew file mode 100644index 0000000000..924625a7a1--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractNestedTypeExtMsType.java@@ -0,0 +1,71 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractNestedTypeExtMsType extends AbstractMsType {++ protected ClassFieldMsAttributes attribute;+ protected AbstractTypeIndex nestedTypeDefinitionIndex;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractNestedTypeExtMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ nestedTypeDefinitionIndex = new TypeIndex32();+ create();+ //TODO: guess+ attribute = new ClassFieldMsAttributes(reader);+ nestedTypeDefinitionIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, nestedTypeDefinitionIndex.get()));+ pdb.popDependencyStack();+ name.parse(reader);+ reader.align4();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No API for this.+ builder.append(name.get());+ pdb.getTypeRecord(nestedTypeDefinitionIndex.get()).emit(builder, Bind.NONE);+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append(attribute);+ myBuilder.append(": ");+ builder.insert(0, myBuilder);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractNestedTypeMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractNestedTypeMsType.javanew file mode 100644index 0000000000..34ea1bca75--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractNestedTypeMsType.java@@ -0,0 +1,79 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractNestedTypeMsType extends AbstractMsType {++ protected AbstractTypeIndex nestedTypeDefinitionIndex;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractNestedTypeMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseInitialFields(reader);+ nestedTypeDefinitionIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, nestedTypeDefinitionIndex.get()));+ pdb.popDependencyStack();+ name.parse(reader);+ }++ /**+ * Returns the name of this nested type.+ * @return Name of the nested type.+ */+ @Override+ public String getName() {+ return name.get();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No API for this.+ builder.append(name.get());+ pdb.getTypeRecord(nestedTypeDefinitionIndex.get()).emit(builder, Bind.NONE);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the initial fields for this type.+ * @param reader {@link PdbByteReader } from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseInitialFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractOemDefinableStringMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractOemDefinableStringMsType.javanew file mode 100644index 0000000000..e4973b0cf0--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractOemDefinableStringMsType.java@@ -0,0 +1,77 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.AbstractTypeIndex;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractOemDefinableStringMsType extends AbstractMsType {++ protected int msAssignedOEMIdentifier;+ protected int oemAssignedTypeIdentifier;+ protected List<AbstractTypeIndex> typeIndexList = new ArrayList<>();+ protected byte[] remainingBytes;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractOemDefinableStringMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ msAssignedOEMIdentifier = reader.parseUnsignedShortVal();+ oemAssignedTypeIdentifier = reader.parseUnsignedShortVal();+ parseTypeIndexList(reader);+ //TODO: We do not know what "OEM-defined" data remains. For now, just grabbing rest.+ remainingBytes = reader.parseBytesRemaining();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append("OEM Definable String\n");+ builder.append(+ String.format(" MSFT-assigned OEM Identifier: %s\n", msAssignedOEMIdentifier));+ builder.append(String.format(" OEM-assigned Identifier: %s\n", oemAssignedTypeIdentifier));+ builder.append(String.format(" count: %d\n", typeIndexList.size()));+ for (int i = 0; i < typeIndexList.size(); i++) {+ builder.append(+ String.format(" typeIndex[%d]: 0x%08x\n", i, typeIndexList.get(i).get()));+ }+ builder.append(String.format(" additional data length: %d\n", remainingBytes.length));+ }++ /**+ * Parses the Type Index List.+ * @param reader {@link PdbByteReader} that is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseTypeIndexList(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractOneMethodMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractOneMethodMsType.javanew file mode 100644index 0000000000..d02d5a9933--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractOneMethodMsType.java@@ -0,0 +1,78 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractOneMethodMsType extends AbstractMsType {++ protected ClassFieldMsAttributes attribute;+ protected AbstractTypeIndex procedureTypeRecordIndex;+ protected long offsetInVFTableIfIntroVirtual;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractOneMethodMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ attribute = new ClassFieldMsAttributes(reader);+ procedureTypeRecordIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, procedureTypeRecordIndex.get()));+ pdb.popDependencyStack();+ if ((attribute.getPropertyVal() == 0x04) || (attribute.getPropertyVal() == 0x06)) {+ offsetInVFTableIfIntroVirtual = reader.parseUnsignedIntVal();+ }+ else {+ offsetInVFTableIfIntroVirtual = 0;+ }+ name.parse(reader);+ reader.skipPadding();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No API for this. Just outputting something that might be useful.+ // At this time, not doing anything with bind here; don't think it is warranted.+ builder.append("<");+ builder.append(attribute);+ builder.append(": ");+ builder.append(pdb.getTypeRecord(procedureTypeRecordIndex.get()));+ builder.append(",");+ builder.append(offsetInVFTableIfIntroVirtual);+ builder.append(">");+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractOverloadedMethodMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractOverloadedMethodMsType.javanew file mode 100644index 0000000000..abd8ee285e--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractOverloadedMethodMsType.java@@ -0,0 +1,69 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractOverloadedMethodMsType extends AbstractMsType {++ protected int count;+ protected AbstractTypeIndex methodListIndex;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractOverloadedMethodMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ create();+ count = reader.parseUnsignedShortVal();+ methodListIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, methodListIndex.get()));+ pdb.popDependencyStack();+ name.parse(reader);+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No API for this. Just outputting something that might be useful.+ // At this time, not doing anything with bind here; don't think it is warranted.+ builder.append("overloaded[");+ builder.append(count);+ builder.append("]:");+ builder.append(name);+ builder.append(pdb.getTypeRecord(methodListIndex.get()));+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractPointerMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractPointerMsType.javanew file mode 100644index 0000000000..c6e78bbc15--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractPointerMsType.java@@ -0,0 +1,486 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractPointerMsType extends AbstractMsType {++ private static final int TYPE_NEAR = 0x00; // 16-bit pointer+ private static final int TYPE_FAR = 0x01; // 16:16 far pointer+ private static final int TYPE_HUGE = 0x02; // 16:16 huge pointer+ private static final int TYPE_SEGMENT_BASED = 0x03;+ private static final int TYPE_VALUE_BASED = 0x04;+ private static final int TYPE_SEGMENT_VALUE_BASED = 0x05;+ private static final int TYPE_ADDRESS_BASED = 0x06;+ private static final int TYPE_SEGMENT_ADDRESS_BASED = 0x07;+ private static final int TYPE_TYPE_BASED = 0x08;+ private static final int TYPE_SELF_BASED = 0x09;+ private static final int TYPE_NEAR32 = 0x0a; // 32-bit pointer+ private static final int TYPE_FAR32 = 0x0b; // 16:32 pointer+ private static final int TYPE_PTR64 = 0x0c; // 64-bit pointer++ private static final String[] TYPE_STRING = new String[14];+ static {+ TYPE_STRING[0] = "near";+ TYPE_STRING[1] = "far";+ TYPE_STRING[2] = "huge";+ TYPE_STRING[3] = "base(seg)";+ TYPE_STRING[4] = "base(val)";+ TYPE_STRING[5] = "base(segval)";+ TYPE_STRING[6] = "base(addr)";+ TYPE_STRING[7] = "base(segaddr)";+ TYPE_STRING[8] = "base(type)";+ TYPE_STRING[9] = "base(self)";+ TYPE_STRING[10] = "";+ TYPE_STRING[11] = "far32";+ TYPE_STRING[12] = "far64";+ TYPE_STRING[13] = "unspecified";+ }++ private static final int MODE_POINTER = 0x00; // Normal+ private static final int MODE_OLD_REFERENCE = 0x01; // Same as LVALUE_REFERENCE+ private static final int MODE_LVALUE_REFERENCE = 0x01; // Same as OLD_REFERENCE+ private static final int MODE_MEMBER_DATA_POINTER = 0x02;+ private static final int MODE_MEMBER_FUNCTION_POINTER = 0x03;+ private static final int MODE_RVALUE_REFERENCE = 0x04;+ private static final int MODE_RESERVED = 0x05;++ private static final String[] MEMBER_POINTER_ATTRIBUTE_STRING = new String[14];+ static {+ MEMBER_POINTER_ATTRIBUTE_STRING[0] = "pdm16_nonvirt";+ MEMBER_POINTER_ATTRIBUTE_STRING[1] = "pdm16_vfcn";+ MEMBER_POINTER_ATTRIBUTE_STRING[2] = "pdm16_vbase";+ MEMBER_POINTER_ATTRIBUTE_STRING[3] = "pdm32_nvvfcn";+ MEMBER_POINTER_ATTRIBUTE_STRING[4] = "pdm32_vbase";+ MEMBER_POINTER_ATTRIBUTE_STRING[5] = "pmf16_nearnvsa";+ MEMBER_POINTER_ATTRIBUTE_STRING[6] = "pmf16_nearnvma";+ MEMBER_POINTER_ATTRIBUTE_STRING[7] = "pmf16_nearvbase";+ MEMBER_POINTER_ATTRIBUTE_STRING[8] = "pmf16_farnvsa";+ MEMBER_POINTER_ATTRIBUTE_STRING[9] = "pmf16_farnvma";+ MEMBER_POINTER_ATTRIBUTE_STRING[10] = "pmf16_farvbase";+ MEMBER_POINTER_ATTRIBUTE_STRING[11] = "pmf32_nvsa";+ MEMBER_POINTER_ATTRIBUTE_STRING[12] = "pmf32_nvma";+ MEMBER_POINTER_ATTRIBUTE_STRING[13] = "pmf32_vbase";+ }++ private static final int MEMBER_POINTER_UNSPECIFIED = 0x00;+ private static final int MEMBER_POINTER_DATA_SINGLE_INHERITANCE = 0x01;+ private static final int MEMBER_POINTER_DATA_MULTIPLE_INHERITANCE = 0x02;+ private static final int MEMBER_POINTER_DATA_VIRTUAL_INHERITANCE = 0x03;+ private static final int MEMBER_POINTER_DATA_GENERAL = 0x04;+ private static final int MEMBER_POINTER_FUNCTION_SINGLE_INHERITANCE = 0x05;+ private static final int MEMBER_POINTER_FUNCTION_MULTIPLE_INHERITANCE = 0x06;+ private static final int MEMBER_POINTER_FUNCTION_VIRTUAL_INHERITANCE = 0x07;+ private static final int MEMBER_POINTER_FUNCTION_GENERAL = 0x08;++ //==============================================================================================+ protected AbstractTypeIndex underlyingTypeIndex;+ protected int pointerTypeAttribute;+ protected int pointerModeAttribute;+ protected boolean isFlat; // 0:32 pointer+ protected boolean isVolatile;+ protected boolean isConst;+ protected boolean isUnaligned;++ protected AbstractTypeIndex memberPointerContainingClassIndex;+ protected int memberPointerFormat;++ protected int baseSegment;+ protected AbstractString baseSymbol;+ protected int pointerBaseTypeIndex;+ protected AbstractString name;++ //==============================================================================================+ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractPointerMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parsePointerBody(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, underlyingTypeIndex.get()));+ pdb.popDependencyStack();++ if (pointerModeAttribute == MODE_MEMBER_DATA_POINTER ||+ pointerModeAttribute == MODE_MEMBER_FUNCTION_POINTER) {+ memberPointerContainingClassIndex.parse(reader);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA,+ memberPointerContainingClassIndex.get()));+ pdb.popDependencyStack();+ memberPointerFormat = reader.parseUnsignedShortVal();+ if (reader.hasMore()) {+ //TODO: I think there might be possible padding+ reader.parseBytesRemaining();+ }+ }+ else if (pointerTypeAttribute == TYPE_SEGMENT_BASED) {+ baseSegment = reader.parseUnsignedShortVal();+ if (reader.hasMore()) {+ //TODO: I think there might be possible padding+ //System.out.println(reader.dump());+ reader.parseBytesRemaining();+ }+ }+ else if (pointerTypeAttribute == TYPE_TYPE_BASED) {+ pointerBaseTypeIndex = reader.parseInt();+ name.parse(reader);+ reader.skipPadding();+ if (reader.hasMore()) {+ //TODO: I think there might be possible padding+ //System.out.println(reader.dump());+ reader.parseBytesRemaining();+ }+ }+ // Something needs to trigger this code (might be a mode or a type+ else if (pointerTypeAttribute == -1) {+ baseSymbol.parse(reader);+ //System.out.println(reader.dump());+ reader.skipPadding();+ }+ else if (reader.hasMore()) {+ // TODO: more investigation--enable code during research.+ //System.out.println(reader.dump());+ //assert (false);+ }+ reader.skipPadding();+ }++ /**+ * Returns the type that is pointed to.+ * @return Type that is pointed to by this pointer.+ */+ public AbstractMsType getUnderlyingType() {+ return pdb.getTypeRecord(underlyingTypeIndex.get());+ }++ /**+ * Returns the type index of the type that is pointed to.+ * @return The type index of the type that is pointed to by this pointer.+ */+ public int getUnderlyingTypeIndex() {+ return underlyingTypeIndex.get();+ }++ /**+ * Returns the size in bytes of the pointer.+ * @return The size in bytes.+ */+ public int getSize() {+ return getMySize();+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isNear() {+ return (pointerTypeAttribute == TYPE_NEAR);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isFar() {+ return (pointerTypeAttribute == TYPE_FAR);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isHuge() {+ return (pointerTypeAttribute == TYPE_HUGE);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isSegmentBased() {+ return (pointerTypeAttribute == TYPE_SEGMENT_BASED);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isValueBased() {+ return (pointerTypeAttribute == TYPE_VALUE_BASED);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isSegmentValueBased() {+ return (pointerTypeAttribute == TYPE_SEGMENT_VALUE_BASED);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isAddressBased() {+ return (pointerTypeAttribute == TYPE_ADDRESS_BASED);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isSegmentAddressBased() {+ return (pointerTypeAttribute == TYPE_SEGMENT_ADDRESS_BASED);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isTypeBased() {+ return (pointerTypeAttribute == TYPE_TYPE_BASED);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isSelfBased() {+ return (pointerTypeAttribute == TYPE_SELF_BASED);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isNear32() {+ return (pointerTypeAttribute == TYPE_NEAR32);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isFar32() {+ return (pointerTypeAttribute == TYPE_FAR32);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isPtr64() {+ return (pointerTypeAttribute == TYPE_PTR64);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isNormal() {+ return (pointerModeAttribute == MODE_POINTER);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isLOldReference() {+ return (pointerModeAttribute == MODE_OLD_REFERENCE);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isLValueReference() {+ return (pointerModeAttribute == MODE_LVALUE_REFERENCE);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isMemberDataPointer() {+ return (pointerModeAttribute == MODE_MEMBER_DATA_POINTER);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isMemberFunctionPointer() {+ return (pointerModeAttribute == MODE_MEMBER_FUNCTION_POINTER);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isFValueReference() {+ return (pointerModeAttribute == MODE_RVALUE_REFERENCE);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isModeReserved() {+ return (pointerModeAttribute == MODE_RESERVED);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isUnspecified() {+ return (memberPointerFormat == MEMBER_POINTER_UNSPECIFIED);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isDataSingleInheritance() {+ return (memberPointerFormat == MEMBER_POINTER_DATA_SINGLE_INHERITANCE);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isDataMultipleInheritance() {+ return (memberPointerFormat == MEMBER_POINTER_DATA_MULTIPLE_INHERITANCE);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isDataVirtualInheritance() {+ return (memberPointerFormat == MEMBER_POINTER_DATA_VIRTUAL_INHERITANCE);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isDataGeneral() {+ return (memberPointerFormat == MEMBER_POINTER_DATA_GENERAL);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isFunctionSingleInheritance() {+ return (memberPointerFormat == MEMBER_POINTER_FUNCTION_SINGLE_INHERITANCE);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isFunctionMultipleInheritance() {+ return (memberPointerFormat == MEMBER_POINTER_FUNCTION_MULTIPLE_INHERITANCE);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isFunctionVirtualInheritance() {+ return (memberPointerFormat == MEMBER_POINTER_FUNCTION_VIRTUAL_INHERITANCE);+ }++ /**+ * Returns boolean regarding the fact of the property.+ * @return Truth about the property.+ */+ public boolean isFunctionGeneral() {+ return (memberPointerFormat == MEMBER_POINTER_FUNCTION_GENERAL);+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append(isFlat ? "flat " : "");+ switch (pointerModeAttribute) {+ case MODE_POINTER:+ myBuilder.append(TYPE_STRING[pointerTypeAttribute]);+ myBuilder.append("*");+ break;+ case MODE_LVALUE_REFERENCE:+ myBuilder.append(TYPE_STRING[pointerTypeAttribute]);+ myBuilder.append("&");+ break;+ case MODE_RVALUE_REFERENCE:+ myBuilder.append(TYPE_STRING[pointerTypeAttribute]);+ myBuilder.append("&&");+ break;+ case MODE_MEMBER_DATA_POINTER:+ case MODE_MEMBER_FUNCTION_POINTER:+ pdb.getTypeRecord(memberPointerContainingClassIndex.get()).emit(builder, Bind.NONE);+ myBuilder.append("::* <");+ myBuilder.append(MEMBER_POINTER_ATTRIBUTE_STRING[memberPointerFormat]);+ myBuilder.append(">");+ break;+ }+ myBuilder.append(isConst ? "const " : "");+ myBuilder.append(isVolatile ? "volatile " : "");++ myBuilder.append(" "); //redundant space if const or volatile---TODO: fix+ builder.insert(0, myBuilder);+ builder.append(" ");+ getUnderlyingType().emit(builder, Bind.PTR);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the pointer body.+ * @param reader {@link PdbByteReader} from which the data is parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parsePointerBody(PdbByteReader reader) throws PdbException;++ /**+ * Parses the attributes of the pointer.+ * @param reader {@link PdbByteReader} frmo which the attributes are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseAttributes(PdbByteReader reader) throws PdbException;++ protected abstract int getMySize();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractPrecompiledTypeMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractPrecompiledTypeMsType.javanew file mode 100644index 0000000000..46a805f890--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractPrecompiledTypeMsType.java@@ -0,0 +1,69 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractPrecompiledTypeMsType extends AbstractMsType {++ protected AbstractTypeIndex start;+ protected int count;+ protected long signature;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractPrecompiledTypeMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ create();+ parseFields(reader);+ }++ // Note: MSFT output API not documented.+ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append(+ String.format("Precompiled: signature=0X%08X, name=%s, startTypeIndex=%d, count=%d",+ signature, name, start.get(), count));+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the fields of this type.+ * @param reader {@link PdbByteReader} from which to parse the fields.+ * @throws PdbException upon error parsing a field.+ */+ protected abstract void parseFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractProcedureMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractProcedureMsType.javanew file mode 100644index 0000000000..1d45d63425--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractProcedureMsType.java@@ -0,0 +1,131 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractProcedureMsType extends AbstractMsType {++ protected AbstractTypeIndex returnValueTypeIndex;+ protected int callingConvention; // MSFT API does not document the values.+ protected FunctionMsAttributes functionAttributes;+ protected int numParameters;+ protected AbstractTypeIndex argListTypeIndex;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractProcedureMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ returnValueTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, returnValueTypeIndex.get()));+ pdb.popDependencyStack();+ callingConvention = reader.parseUnsignedByteVal();+ functionAttributes = new FunctionMsAttributes(reader);+ numParameters = reader.parseUnsignedShortVal();+ argListTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, argListTypeIndex.get()));+ pdb.popDependencyStack();+ reader.skipPadding();+ }++ /**+ * Returns the type index of the return type.+ * @return Type index of the return type.+ */+ public int getReturnTypeIndex() {+ return returnValueTypeIndex.get();+ }++ /**+ * Returns the calling convention (TODO: determine the mapping of these values to conventions.)+ * @return The calling convention.+ */+ public int getCallingConventionValue() {+ return callingConvention;+ }++ /**+ * Returns the function attributes.+ * @return Function attributes+ */+ public FunctionMsAttributes getFunctionAttributes() {+ return functionAttributes;+ }++ /**+ * Returns the number of parameters.+ * @return Number of parameters.+ */+ public int getNumParams() {+ return numParameters;+ }++ /**+ * Returns the type index of the arguments list type.+ * @return Type index of the arguments list type.+ */+ public int getArgListTypeIndex() {+ return argListTypeIndex.get();+ }++ /**+ * Returns the type for the return value type.+ * @return {@link AbstractMsType} of the return value type.+ */+ public AbstractMsType getReturnType() {+ return pdb.getTypeRecord(returnValueTypeIndex.get());+ }++ /**+ * Returns the type for the arguments list.+ * @return {@link AbstractMsType} of the arguments list.+ */+ public AbstractMsType getArgumentsListType() {+ return pdb.getTypeRecord(argListTypeIndex.get());+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ if (bind.ordinal() < Bind.PROC.ordinal()) {+ builder.insert(0, "(");+ builder.append(")");+ }+ builder.append(getArgumentsListType());+ getReturnType().emit(builder, Bind.PROC);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractSkipMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractSkipMsType.javanew file mode 100644index 0000000000..86db7c9f7c--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractSkipMsType.java@@ -0,0 +1,59 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.AbstractTypeIndex;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractSkipMsType extends AbstractMsType {++ protected AbstractTypeIndex nextValidTypeIndex;+ protected int recordLength;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractSkipMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ nextValidTypeIndex.parse(reader);+ recordLength = reader.getLimit() - reader.getIndex();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append(String.format("Skip Record, nextValidTypeIndex = 0x%x, Length = 0x%x",+ nextValidTypeIndex.get(), recordLength));+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractStaticMemberMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractStaticMemberMsType.javanew file mode 100644index 0000000000..b1ee14360e--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractStaticMemberMsType.java@@ -0,0 +1,79 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractStaticMemberMsType extends AbstractMsType {++ protected ClassFieldMsAttributes attribute;+ protected AbstractTypeIndex fieldTypeRecordIndex;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractStaticMemberMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseInitialFields(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, fieldTypeRecordIndex.get()));+ pdb.popDependencyStack();+ name.parse(reader);+ }++ @Override+ public String getName() {+ return name.get();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No API for this.+ builder.append(name);+ pdb.getTypeRecord(fieldTypeRecordIndex.get()).emit(builder, Bind.NONE);+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append(attribute);+ myBuilder.append(": ");+ builder.insert(0, myBuilder);+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the initial fields of this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseInitialFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractStructureMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractStructureMsType.javanew file mode 100644index 0000000000..a13d95ee9a--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractStructureMsType.java@@ -0,0 +1,48 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractStructureMsType extends AbstractCompositeMsType {++ private static final String TYPE_STRING = "struct";++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractStructureMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ protected String getTypeString() {+ return TYPE_STRING;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractTypeServerMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractTypeServerMsType.javanew file mode 100644index 0000000000..d72e23527e--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractTypeServerMsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.AbstractString;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractTypeServerMsType extends AbstractMsType {++ protected long signature;+ protected long age;+ protected AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractTypeServerMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ signature = reader.parseUnsignedIntVal();+ age = reader.parseUnsignedIntVal();+ name.parse(reader);+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // There is no documented API.+ builder.append(+ String.format("<<%s %s 0x%08x %d>>", getClass().getSimpleName(), name, signature, age));+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractUnionMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractUnionMsType.javanew file mode 100644index 0000000000..1f73dff883--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractUnionMsType.java@@ -0,0 +1,48 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractUnionMsType extends AbstractCompositeMsType {++ private static final String TYPE_STRING = "union";++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AbstractUnionMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ protected String getTypeString() {+ return TYPE_STRING;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualBaseClassMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualBaseClassMsType.javanew file mode 100644index 0000000000..3f1504fe49--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualBaseClassMsType.java@@ -0,0 +1,92 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.math.BigInteger;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractVirtualBaseClassMsType extends AbstractMsType {++ protected AbstractTypeIndex directVirtualBaseClassTypeIndex;+ protected AbstractTypeIndex virtualBasePointerTypeIndex;+ protected ClassFieldMsAttributes attribute;+ protected BigInteger virtualBaseOffsetFromAddressPoint;+ protected BigInteger virtualBaseOffsetFromVBTable;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractVirtualBaseClassMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ create();+ parseInitialFields(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, directVirtualBaseClassTypeIndex.get()));+ pdb.popDependencyStack();+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, virtualBasePointerTypeIndex.get()));+ pdb.popDependencyStack();+ //TODO: Check this+ virtualBaseOffsetFromAddressPoint = reader.parseNumeric();+ virtualBaseOffsetFromVBTable = reader.parseNumeric();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append(attribute);+ builder.append(": ");+ AbstractMsType type = pdb.getTypeRecord(directVirtualBaseClassTypeIndex.get());+ builder.append(type.getName());+ builder.append("< ");++ StringBuilder vbpBuilder = new StringBuilder();+ vbpBuilder.append("vbp");+ pdb.getTypeRecord(virtualBasePointerTypeIndex.get()).emit(vbpBuilder, Bind.NONE);+ builder.append(vbpBuilder);+ builder.append("; offVbp=");+ builder.append(virtualBaseOffsetFromAddressPoint);+ builder.append("; offVbte=");+ builder.append(virtualBaseOffsetFromVBTable);+ builder.append("; >");+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the initial fields for this type.+ * @param reader {@link PdbByteReader} from which the data is parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseInitialFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualFunctionTablePathMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualFunctionTablePathMsType.javanew file mode 100644index 0000000000..d618c7ad25--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualFunctionTablePathMsType.java@@ -0,0 +1,65 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.AbstractTypeIndex;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractVirtualFunctionTablePathMsType extends AbstractMsType {++ protected List<AbstractTypeIndex> bases = new ArrayList<>();++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractVirtualFunctionTablePathMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ parseFields(reader);+ }++ // Note: MSFT output API not documented.+ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append(String.format("VFTPath: count=%d\n", bases.size()));+ for (int i = 0; i < bases.size(); i++) {+ builder.append(String.format(" index[%d]=%d\n", i, bases.get(i).get()));+ }+ }++ /**+ * Abstract internal method to parse fields in the deserialization process.+ * @param reader {@link PdbByteReader} that is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualFunctionTablePointerMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualFunctionTablePointerMsType.javanew file mode 100644index 0000000000..272e4d0e37--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualFunctionTablePointerMsType.java@@ -0,0 +1,68 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractVirtualFunctionTablePointerMsType extends AbstractMsType {++ protected AbstractTypeIndex pointerTypeIndex;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractVirtualFunctionTablePointerMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ create();+ parseInitialFields(reader);+ pointerTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, pointerTypeIndex.get()));+ pdb.popDependencyStack();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append("VFTablePtr: ");+ builder.append(pdb.getTypeRecord(pointerTypeIndex.get()));+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the initial fields for this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseInitialFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualFunctionTablePointerWithOffsetMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualFunctionTablePointerWithOffsetMsType.javanew file mode 100644index 0000000000..892d73dc9d--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AbstractVirtualFunctionTablePointerWithOffsetMsType.java@@ -0,0 +1,72 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * An abstract class for a number of specific PDB data types that share certain information.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public abstract class AbstractVirtualFunctionTablePointerWithOffsetMsType extends AbstractMsType {++ protected AbstractTypeIndex pointerTypeIndex;+ protected int offset;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public AbstractVirtualFunctionTablePointerWithOffsetMsType(AbstractPdb pdb,+ PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ create();+ parseInitialFields(reader);+ pointerTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, pointerTypeIndex.get()));+ pdb.popDependencyStack();+ offset = reader.parseInt();+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append("VFTablePtr<off=");+ builder.append(offset);+ builder.append(">: ");+ builder.append(pdb.getTypeRecord(pointerTypeIndex.get()));+ }++ /**+ * Creates subcomponents for this class, which can be deserialized later.+ */+ protected abstract void create();++ /**+ * Parses the initial fields for this type.+ * @param reader {@link PdbByteReader} from which the fields are parsed.+ * @throws PdbException Upon not enough data left to parse.+ */+ protected abstract void parseInitialFields(PdbByteReader reader) throws PdbException;++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AliasMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AliasMsType.javanew file mode 100644index 0000000000..56c11ea11b--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AliasMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringNt;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class AliasMsType extends AbstractAliasMsType {++ public static final int PDB_ID = 0x150a;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AliasMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringNt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AliasStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AliasStMsType.javanew file mode 100644index 0000000000..fb5726ee40--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/AliasStMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringSt;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class AliasStMsType extends AbstractAliasMsType {++ public static final int PDB_ID = 0x1010;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public AliasStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArgumentsList16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArgumentsList16MsType.javanew file mode 100644index 0000000000..6c5d606646--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArgumentsList16MsType.java@@ -0,0 +1,58 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ArgumentsList16MsType extends AbstractArgumentsListMsType {++ public static final int PDB_ID = 0x0201;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public ArgumentsList16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void parseTypeIndexList(PdbByteReader reader) throws PdbException {+ int count = reader.parseUnsignedShortVal();+ for (int i = 0; i < count; i++) {+ AbstractTypeIndex typeIndex = new TypeIndex16();+ typeIndex.parse(reader);+ argTypeIndexList.add(typeIndex);+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArgumentsListMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArgumentsListMsType.javanew file mode 100644index 0000000000..e8ca23a58c--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArgumentsListMsType.java@@ -0,0 +1,58 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ArgumentsListMsType extends AbstractArgumentsListMsType {++ public static final int PDB_ID = 0x1201;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public ArgumentsListMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void parseTypeIndexList(PdbByteReader reader) throws PdbException {+ int count = reader.parseInt();+ for (int i = 0; i < count; i++) {+ AbstractTypeIndex typeIndex = new TypeIndex32();+ typeIndex.parse(reader);+ argTypeIndexList.add(typeIndex);+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Array16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Array16MsType.javanew file mode 100644index 0000000000..52c23ab6d3--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Array16MsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Array16MsType extends AbstractArrayMsType {++ public static final int PDB_ID = 0x0003;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public Array16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ elementTypeIndex = new TypeIndex16();+ indexTypeIndex = new TypeIndex16();+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArrayMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArrayMsType.javanew file mode 100644index 0000000000..4ba22850db--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArrayMsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ArrayMsType extends AbstractArrayMsType {++ public static final int PDB_ID = 0x1503;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public ArrayMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ elementTypeIndex = new TypeIndex32();+ indexTypeIndex = new TypeIndex32();+ name = new StringNt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArrayStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArrayStMsType.javanew file mode 100644index 0000000000..aa778a96a0--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ArrayStMsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ArrayStMsType extends AbstractArrayMsType {++ public static final int PDB_ID = 0x1003;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public ArrayStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ elementTypeIndex = new TypeIndex32();+ indexTypeIndex = new TypeIndex32();+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BadMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BadMsType.javaindex 5f6fad7212..679d589e15 100644--- a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BadMsType.java+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BadMsType.java@@ -18,8 +18,6 @@ package ghidra.pdb.pdbreader.type;import ghidra.pdb.pdbreader.AbstractPdb;/**- * This class extends {@link AbstractMsType}.- * <P>* Important: This is not a real type. This "Bad" type takes the place of a type that has* encountered a parsing issue vis-a-vis a PdbException.*/diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BaseClass16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BaseClass16MsType.javanew file mode 100644index 0000000000..4aff3aa5dc--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BaseClass16MsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class BaseClass16MsType extends AbstractBaseClassMsType {++ public static final int PDB_ID = 0x0400;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public BaseClass16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ baseClassIndex = new TypeIndex16();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ baseClassIndex.parse(reader);+ attribute = new ClassFieldMsAttributes(reader);+ offset = reader.parseNumeric();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BaseClassMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BaseClassMsType.javanew file mode 100644index 0000000000..85da6b18b0--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BaseClassMsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class BaseClassMsType extends AbstractBaseClassMsType {++ public static final int PDB_ID = 0x1400;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public BaseClassMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ baseClassIndex = new TypeIndex32();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ attribute = new ClassFieldMsAttributes(reader);+ baseClassIndex.parse(reader);+ offset = reader.parseNumeric();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BaseInterfaceMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BaseInterfaceMsType.javanew file mode 100644index 0000000000..805a72bc40--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BaseInterfaceMsType.java@@ -0,0 +1,72 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.math.BigInteger;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class BaseInterfaceMsType extends AbstractMsType {++ public static final int PDB_ID = 0x151a;++ private AbstractTypeIndex baseClassIndex;+ private ClassFieldMsAttributes attribute;+ private BigInteger offset;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public BaseInterfaceMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ baseClassIndex = new TypeIndex32();+ attribute = new ClassFieldMsAttributes(reader);+ baseClassIndex.parse(reader);+ this.pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, baseClassIndex.get()));+ this.pdb.popDependencyStack();+ offset = reader.parseNumeric();+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ attribute.emit(builder);+ builder.append(":");+ builder.append(pdb.getTypeRecord(baseClassIndex.get()));+ builder.append("<@");+ builder.append(offset);+ builder.append(">");+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BasicArray16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BasicArray16MsType.javanew file mode 100644index 0000000000..5a71483229--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BasicArray16MsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class BasicArray16MsType extends AbstractBasicArrayMsType {++ public static final int PDB_ID = 0x000d;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public BasicArray16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ underlyingTypeIndex = new TypeIndex16();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BasicArrayMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BasicArrayMsType.javanew file mode 100644index 0000000000..2f61409480--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BasicArrayMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class BasicArrayMsType extends AbstractBasicArrayMsType {++ public static final int PDB_ID = 0x100b;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public BasicArrayMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ underlyingTypeIndex = new TypeIndex32();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Bitfield16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Bitfield16MsType.javanew file mode 100644index 0000000000..b308085c8a--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Bitfield16MsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Bitfield16MsType extends AbstractBitfieldMsType {++ public static final int PDB_ID = 0x0206;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public Bitfield16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ elementTypeIndex = new TypeIndex16();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ length = reader.parseUnsignedByteVal();+ position = reader.parseUnsignedByteVal();+ elementTypeIndex.parse(reader);+ reader.skipPadding();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BitfieldMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BitfieldMsType.javanew file mode 100644index 0000000000..7c8ea994a3--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BitfieldMsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class BitfieldMsType extends AbstractBitfieldMsType {++ public static final int PDB_ID = 0x1205; // Note: this is not 0x1000 from Bitfield_16's ID.++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public BitfieldMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ elementTypeIndex = new TypeIndex32();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ elementTypeIndex.parse(reader);+ length = reader.parseUnsignedByteVal();+ position = reader.parseUnsignedByteVal();+ reader.align4();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BuildInfoMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BuildInfoMsType.javanew file mode 100644index 0000000000..4c7d2eab25--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/BuildInfoMsType.java@@ -0,0 +1,91 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.*;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.CategoryIndex;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class BuildInfoMsType extends AbstractMsType {++ public static final int PDB_ID = 0x1603;++ public static final int BUILDINFO_CURRENT_DIRECTORY = 0;+ public static final int BUILDINFO_BUILD_TOOL = 1;+ public static final int BUILDINFO_SOURCE_FILE = 2;+ public static final int BUILDINFO_PROGRAM_DATABASE_FILE = 3;+ public static final int BUILDINFO_COMMAND_ARGUMENTS = 4;++ private static final String[] BUILDINFO_STRING = new String[5];+ static {+ BUILDINFO_STRING[0] = "CurrentDirectory: ";+ BUILDINFO_STRING[1] = "BuildTool: ";+ BUILDINFO_STRING[2] = "SourceFile: ";+ BUILDINFO_STRING[3] = "ProgramDatabaseFile: ";+ BUILDINFO_STRING[4] = "CommandArguments: ";+ }++ //==============================================================================================+ private int count;+ private List<Integer> argsCodeItemId = new ArrayList<>();++ //==============================================================================================+ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public BuildInfoMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ count = reader.parseUnsignedShortVal();+ for (int i = 0; i < count; i++) {+ int codeItemId = reader.parseInt();+ argsCodeItemId.add(codeItemId);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.ITEM, codeItemId));+ pdb.popDependencyStack();+ }+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ //No API for output.+ DelimiterState ds = new DelimiterState("", ", ");+ for (int i = 0; (i < count) && (i < BUILDINFO_STRING.length); i++) {+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append(BUILDINFO_STRING[i]);+ myBuilder.append(pdb.getItemRecord(argsCodeItemId.get(i)));+ builder.append(ds.out(true, myBuilder.toString()));+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Class16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Class16MsType.javanew file mode 100644index 0000000000..1b9164fa15--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Class16MsType.java@@ -0,0 +1,69 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Class16MsType extends AbstractClassMsType {++ public static final int PDB_ID = 0x0004;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public Class16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex16();+ derivedFromListTypeIndex = new TypeIndex16(); // Can be zero if none.+ vShapeTableTypeIndex = new TypeIndex16();+ name = new StringSt();+ mangledName = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ //Different order+ count = reader.parseUnsignedShortVal();+ fieldDescriptorListTypeIndex.parse(reader);+ property = new MsProperty(reader);+ derivedFromListTypeIndex.parse(reader);+ vShapeTableTypeIndex.parse(reader);+ size = reader.parseNumeric();+ name.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ClassFieldMsAttributes.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ClassFieldMsAttributes.javanew file mode 100644index 0000000000..1b10de9c19--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ClassFieldMsAttributes.java@@ -0,0 +1,244 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.*;++/**+ * Class field attributes used on fields within specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ClassFieldMsAttributes extends AbstractParsableItem {++ private static final int ACCESS_BLANK = 0;+ private static final int ACCESS_PRIVATE = 1;+ private static final int ACCESS_PROTECTED = 2;+ private static final int ACCESS_PUBLIC = 3;++ private static final int PROPERTY_BLANK = 0;+ private static final int PROPERTY_VIRTUAL = 1;+ private static final int PROPERTY_STATIC = 2;+ private static final int PROPERTY_FRIEND = 3;+ private static final int PROPERTY_INTRO = 4;+ private static final int PROPERTY_PURE = 5;+ private static final int PROPERTY_INTRO_PURE = 6;+ private static final int PROPERTY_RESV = 7;++ private static final String[] ACCESS_STRING = new String[4];+ static {+ ACCESS_STRING[0] = "";+ ACCESS_STRING[1] = "private";+ ACCESS_STRING[2] = "protected";+ ACCESS_STRING[3] = "public";++ }+ private static final String[] PROPERTY_STRING = new String[8];+ static {+ PROPERTY_STRING[0] = "";+ PROPERTY_STRING[1] = "virtual";+ PROPERTY_STRING[2] = "static";+ PROPERTY_STRING[3] = "friend";+ PROPERTY_STRING[4] = "<intro>";+ PROPERTY_STRING[5] = "<pure>";+ PROPERTY_STRING[6] = "<intro,pure>";+ PROPERTY_STRING[7] = "";++ }++ //==============================================================================================+ private boolean compilerGenerateFunctionDoesNotExist;+ private boolean cannotBeInherited;+ private boolean cannotBeConstructed;+ private boolean compilerGenerateFunctionDoesExist;+ private boolean cannotBeOverriden;+ private int accessVal;+ private int propertyVal;++ //==============================================================================================+ /**+ * Constructor for ClassFieldAttributes/+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public ClassFieldMsAttributes(PdbByteReader reader) throws PdbException {+ int attributes = reader.parseUnsignedShortVal();+ processAttributes(attributes);+ }++ /**+ * Returns the value (index) of the Access Value.+ * @return Index of Access Value.+ */+ public int getAccessVal() {+ return accessVal;+ }++ /**+ * Returns the value (index) of the Property Value.+ * @return Index of Property Value.+ */+ public int getPropertyVal() {+ return propertyVal;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isAccessBlank() {+ return (accessVal == ACCESS_BLANK);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isAccessPrivate() {+ return (accessVal == ACCESS_PRIVATE);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isAccessProtected() {+ return (accessVal == ACCESS_PROTECTED);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isAccessPublic() {+ return (accessVal == ACCESS_PUBLIC);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isPropertyBlank() {+ return (propertyVal == PROPERTY_BLANK);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isPropertyVirtual() {+ return (propertyVal == PROPERTY_VIRTUAL);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isPropertyStatic() {+ return (propertyVal == PROPERTY_STATIC);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isPropertyFriend() {+ return (propertyVal == PROPERTY_FRIEND);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isPropertyIntro() {+ return (propertyVal == PROPERTY_INTRO);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isPropertyPure() {+ return (propertyVal == PROPERTY_PURE);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isPropertyIntroPure() {+ return (propertyVal == PROPERTY_INTRO_PURE);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isPropertyReserved() {+ return (propertyVal == PROPERTY_RESV);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isCompilerGeneratedFunctionDoesExist() {+ return compilerGenerateFunctionDoesExist;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isCannotBeOverriden() {+ return cannotBeOverriden;+ }++ @Override+ public void emit(StringBuilder builder) {+ builder.append(ACCESS_STRING[accessVal]);+ if ((accessVal != 0) && (propertyVal != 0)) {+ builder.append(" ");+ }+ builder.append(PROPERTY_STRING[propertyVal]);+ if (compilerGenerateFunctionDoesNotExist || cannotBeInherited || cannotBeConstructed) {+ DelimiterState ds = new DelimiterState("<", ", ");+ builder.append(ds.out(compilerGenerateFunctionDoesNotExist, "pseudo"));+ builder.append(ds.out(cannotBeInherited, "noinherit"));+ builder.append(ds.out(cannotBeConstructed, "noconstruct"));+ builder.append(">");+ }+ }++ private void processAttributes(int attributes) {+ accessVal = (attributes & 0x0003);+ attributes >>= 2;+ propertyVal = (attributes & 0x0007);+ attributes >>= 3;+ compilerGenerateFunctionDoesNotExist = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ cannotBeInherited = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ cannotBeConstructed = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ compilerGenerateFunctionDoesExist = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ cannotBeOverriden = ((attributes & 0x0001) == 0x0001);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ClassMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ClassMsType.javanew file mode 100644index 0000000000..3affadcf75--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ClassMsType.java@@ -0,0 +1,89 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ * <P>+ * Note that class, struct, and interface are very closed related and have many of the same+ * constructs and parsing procedures. However, they are separate. If any of the internals+ * of one of these is changed, it is highly suggested that the others be changed as well as+ * there is not code-shared between these other than by code duplication.+ */+public class ClassMsType extends AbstractClassMsType {++ public static final int PDB_ID = 0x1504;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public ClassMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex32();+ derivedFromListTypeIndex = new TypeIndex32(); // Can be zero if none.+ vShapeTableTypeIndex = new TypeIndex32();+ name = new StringNt();+ mangledName = new StringNt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ count = reader.parseUnsignedShortVal();+ property = new MsProperty(reader);+ fieldDescriptorListTypeIndex.parse(reader);+ derivedFromListTypeIndex.parse(reader);+ vShapeTableTypeIndex.parse(reader);+ //TODO: has more... guessing below+ size = reader.parseNumeric();+ if (reader.hasMoreNonPad()) {+ name.parse(reader);+ //System.out.println(name);+ if (reader.hasMoreNonPad()) {+ mangledName.parse(reader);+ //System.out.println(mangledName);+ }+ }+ else {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ reader.skipPadding();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ClassStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ClassStMsType.javanew file mode 100644index 0000000000..dc2960bdfc--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ClassStMsType.java@@ -0,0 +1,96 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ * <P>+ * Note that class, struct, and interface are very closed related and have many of the same+ * constructs and parsing procedures. However, they are separate. If any of the internals+ * of one of these is changed, it is highly suggested that the others be changed as well as+ * there is not code-shared between these other than by code duplication.+ */+public class ClassStMsType extends AbstractClassMsType {++ public static final int PDB_ID = 0x1004;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public ClassStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex32();+ derivedFromListTypeIndex = new TypeIndex32(); // Can be zero if none.+ vShapeTableTypeIndex = new TypeIndex32();+ name = new StringSt();+ mangledName = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ count = reader.parseUnsignedShortVal();+ property = new MsProperty(reader);+ fieldDescriptorListTypeIndex.parse(reader);+ derivedFromListTypeIndex.parse(reader);+ vShapeTableTypeIndex.parse(reader);+ //TODO: has more... guessing below+ size = reader.parseNumeric();+ if (reader.hasMoreNonPad()) {+ name.parse(reader);+ //System.out.println(name);+ if (reader.hasMoreNonPad()) {+ mangledName.parse(reader);+ //System.out.println(mangledName);+ }+ else if (reader.hasMore()) {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ }+ else {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ reader.skipPadding();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Cobol016MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Cobol016MsType.javanew file mode 100644index 0000000000..b02166f4eb--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Cobol016MsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Cobol016MsType extends AbstractCobol0MsType {++ public static final int PDB_ID = 0x000b;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public Cobol016MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ parentTypeIndex = new TypeIndex16();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Cobol0MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Cobol0MsType.javanew file mode 100644index 0000000000..5bd0ecc55c--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Cobol0MsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Cobol0MsType extends AbstractCobol0MsType {++ public static final int PDB_ID = 0x100a;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public Cobol0MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ parentTypeIndex = new TypeIndex32();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Cobol1MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Cobol1MsType.javanew file mode 100644index 0000000000..0a78a92efa--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Cobol1MsType.java@@ -0,0 +1,58 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Cobol1MsType extends AbstractMsType {++ public static final int PDB_ID = 0x000c;++ // TODO: This is made up data. API and examples are unknown.+ private byte[] data;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ */+ public Cobol1MsType(AbstractPdb pdb, PdbByteReader reader) {+ super(pdb, reader);+ //System.out.println(reader.dump());+ // TODO: This is made up data. API and examples are unknown.+ data = reader.parseBytesRemaining();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append("Cobol1MsType\n");+ builder.append(String.format(" additional data length: %d\n", data.length));+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DefaultArguments16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DefaultArguments16MsType.javanew file mode 100644index 0000000000..f3c3440f8a--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DefaultArguments16MsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DefaultArguments16MsType extends AbstractDefaultArgumentsMsType {++ public static final int PDB_ID = 0x0202;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public DefaultArguments16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex16();+ expression = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DefaultArgumentsMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DefaultArgumentsMsType.javanew file mode 100644index 0000000000..2254f83718--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DefaultArgumentsMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DefaultArgumentsMsType extends AbstractDefaultArgumentsMsType {++ public static final int PDB_ID = 0x150b;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public DefaultArgumentsMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex32();+ expression = new StringNt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DefaultArgumentsStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DefaultArgumentsStMsType.javanew file mode 100644index 0000000000..378cf68881--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DefaultArgumentsStMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DefaultArgumentsStMsType extends AbstractDefaultArgumentsMsType {++ public static final int PDB_ID = 0x1202;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public DefaultArgumentsStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex32();+ expression = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DerivedClassList16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DerivedClassList16MsType.javanew file mode 100644index 0000000000..8b5df36194--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DerivedClassList16MsType.java@@ -0,0 +1,58 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DerivedClassList16MsType extends AbstractDerivedClassListMsType {++ public static final int PDB_ID = 0x0205;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public DerivedClassList16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void parseTypeIndexList(PdbByteReader reader) throws PdbException {+ int count = reader.parseUnsignedShortVal();+ for (int i = 0; i < count; i++) {+ AbstractTypeIndex typeIndex = new TypeIndex16();+ typeIndex.parse(reader);+ typeIndexList.add(typeIndex);+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DerivedClassListMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DerivedClassListMsType.javanew file mode 100644index 0000000000..e85381ae1d--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DerivedClassListMsType.java@@ -0,0 +1,58 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DerivedClassListMsType extends AbstractDerivedClassListMsType {++ public static final int PDB_ID = 0x1204;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public DerivedClassListMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void parseTypeIndexList(PdbByteReader reader) throws PdbException {+ int count = reader.parseInt();+ for (int i = 0; i < count; i++) {+ AbstractTypeIndex typeIndex = new TypeIndex32();+ typeIndex.parse(reader);+ typeIndexList.add(typeIndex);+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArray16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArray16MsType.javanew file mode 100644index 0000000000..efc98eeeba--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArray16MsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DimensionedArray16MsType extends AbstractDimensionedArrayMsType {++ public static final int PDB_ID = 0x0011;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public DimensionedArray16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ elementTypeIndex = new TypeIndex16();+ dimensionInformation = new TypeIndex16();+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsLowerUpper16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsLowerUpper16MsType.javanew file mode 100644index 0000000000..b2684d6b13--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsLowerUpper16MsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DimensionedArrayConstBoundsLowerUpper16MsType+ extends AbstractDimensionedArrayConstBoundsLowerUpperMsType {++ public static final int PDB_ID = 0x0209;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public DimensionedArrayConstBoundsLowerUpper16MsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex16();+ }++ @Override+ protected void parseBeginningFields(PdbByteReader reader) throws PdbException {+ rank = reader.parseUnsignedShortVal();+ typeIndex.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsLowerUpperMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsLowerUpperMsType.javanew file mode 100644index 0000000000..728c2cfae7--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsLowerUpperMsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DimensionedArrayConstBoundsLowerUpperMsType+ extends AbstractDimensionedArrayConstBoundsLowerUpperMsType {++ public static final int PDB_ID = 0x1208;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public DimensionedArrayConstBoundsLowerUpperMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex32();+ }++ @Override+ protected void parseBeginningFields(PdbByteReader reader) throws PdbException {+ typeIndex.parse(reader);+ rank = reader.parseUnsignedShortVal();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsUpper16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsUpper16MsType.javanew file mode 100644index 0000000000..8b5eaafa73--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsUpper16MsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DimensionedArrayConstBoundsUpper16MsType+ extends AbstractDimensionedArrayConstBoundsUpperMsType {++ public static final int PDB_ID = 0x0208;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public DimensionedArrayConstBoundsUpper16MsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex16();+ }++ @Override+ protected void parseBeginningFields(PdbByteReader reader) throws PdbException {+ rank = reader.parseUnsignedShortVal();+ typeIndex.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsUpperMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsUpperMsType.javanew file mode 100644index 0000000000..e0ca0ba57a--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayConstBoundsUpperMsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DimensionedArrayConstBoundsUpperMsType+ extends AbstractDimensionedArrayConstBoundsUpperMsType {++ public static final int PDB_ID = 0x1207;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public DimensionedArrayConstBoundsUpperMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex32();+ }++ @Override+ protected void parseBeginningFields(PdbByteReader reader) throws PdbException {+ typeIndex.parse(reader);+ rank = reader.parseUnsignedShortVal();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayMsType.javanew file mode 100644index 0000000000..138e8b6e8d--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayMsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DimensionedArrayMsType extends AbstractDimensionedArrayMsType {++ public static final int PDB_ID = 0x1508;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public DimensionedArrayMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ elementTypeIndex = new TypeIndex32();+ dimensionInformation = new TypeIndex32();+ name = new StringNt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayStMsType.javanew file mode 100644index 0000000000..5a258a6f6f--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayStMsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DimensionedArrayStMsType extends AbstractDimensionedArrayMsType {++ public static final int PDB_ID = 0x100c;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public DimensionedArrayStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ elementTypeIndex = new TypeIndex32();+ dimensionInformation = new TypeIndex32();+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsLowerUpper16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsLowerUpper16MsType.javanew file mode 100644index 0000000000..bc5821d6fe--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsLowerUpper16MsType.java@@ -0,0 +1,68 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DimensionedArrayVarBoundsLowerUpper16MsType+ extends AbstractDimensionedArrayVarBoundsLowerUpperMsType {++ public static final int PDB_ID = 0x020b;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public DimensionedArrayVarBoundsLowerUpper16MsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex16();+ }++ @Override+ protected void parseBeginningFields(PdbByteReader reader) throws PdbException {+ rank = reader.parseUnsignedShortVal();+ typeIndex.parse(reader);+ }++ @Override+ protected AbstractTypeIndex parseTypeIndex(PdbByteReader reader) throws PdbException {+ AbstractTypeIndex myTypeIndex = new TypeIndex16();+ myTypeIndex.parse(reader);+ return myTypeIndex;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsLowerUpperMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsLowerUpperMsType.javanew file mode 100644index 0000000000..4b447fd8a4--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsLowerUpperMsType.java@@ -0,0 +1,68 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DimensionedArrayVarBoundsLowerUpperMsType+ extends AbstractDimensionedArrayVarBoundsLowerUpperMsType {++ public static final int PDB_ID = 0x120a;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public DimensionedArrayVarBoundsLowerUpperMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex32();+ }++ @Override+ protected void parseBeginningFields(PdbByteReader reader) throws PdbException {+ rank = reader.parseInt();+ typeIndex.parse(reader);+ }++ @Override+ protected AbstractTypeIndex parseTypeIndex(PdbByteReader reader) throws PdbException {+ AbstractTypeIndex myTypeIndex = new TypeIndex32();+ myTypeIndex.parse(reader);+ return myTypeIndex;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsUpper16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsUpper16MsType.javanew file mode 100644index 0000000000..9ffaa7c3bb--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsUpper16MsType.java@@ -0,0 +1,68 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DimensionedArrayVarBoundsUpper16MsType+ extends AbstractDimensionedArrayVarBoundsUpperMsType {++ public static final int PDB_ID = 0x020a;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public DimensionedArrayVarBoundsUpper16MsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex16();+ }++ @Override+ protected void parseBeginningFields(PdbByteReader reader) throws PdbException {+ rank = reader.parseUnsignedShortVal();+ typeIndex.parse(reader);+ }++ @Override+ protected AbstractTypeIndex parseTypeIndex(PdbByteReader reader) throws PdbException {+ AbstractTypeIndex myTypeIndex = new TypeIndex16();+ myTypeIndex.parse(reader);+ return myTypeIndex;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsUpperMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsUpperMsType.javanew file mode 100644index 0000000000..d97eaf8fc3--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DimensionedArrayVarBoundsUpperMsType.java@@ -0,0 +1,68 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class DimensionedArrayVarBoundsUpperMsType+ extends AbstractDimensionedArrayVarBoundsUpperMsType {++ public static final int PDB_ID = 0x1209;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public DimensionedArrayVarBoundsUpperMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ typeIndex = new TypeIndex32();+ }++ @Override+ protected void parseBeginningFields(PdbByteReader reader) throws PdbException {+ rank = reader.parseInt();+ typeIndex.parse(reader);+ }++ @Override+ protected AbstractTypeIndex parseTypeIndex(PdbByteReader reader) throws PdbException {+ AbstractTypeIndex myTypeIndex = new TypeIndex32();+ myTypeIndex.parse(reader);+ return myTypeIndex;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DummyMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DummyMsType.javanew file mode 100644index 0000000000..cbf360fdcc--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/DummyMsType.java@@ -0,0 +1,69 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * This class extends {@link AbstractMsType}.+ * <P>+ * Important: This is not a real type. This "Dummy" type has been created to help with testing.+ */+public class DummyMsType extends AbstractMsType {++ /** This should not be a the PDB_ID value of a real AbstractMsType. */+ public static final int PDB_ID = 0xff00;++ String typeNamePrefix;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @param typeNamePrefix Type name prefix for this dummy type.+ */+ public DummyMsType(AbstractPdb pdb, PdbByteReader reader, String typeNamePrefix) {+ super(pdb, reader);+ this.typeNamePrefix = typeNamePrefix;+ }++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ */+ public DummyMsType(AbstractPdb pdb, PdbByteReader reader) {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ if (builder.length() != 0) {+ builder.insert(0, " ");+ }+ builder.insert(0, "DummyMsType");+ if (typeNamePrefix != null) {+ builder.insert(0, typeNamePrefix);+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EndPrecompiledTypeMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EndPrecompiledTypeMsType.javanew file mode 100644index 0000000000..6ed8132245--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EndPrecompiledTypeMsType.java@@ -0,0 +1,57 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class EndPrecompiledTypeMsType extends AbstractMsType {++ public static final int PDB_ID = 0x0014;++ protected long signature;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public EndPrecompiledTypeMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ signature = reader.parseUnsignedIntVal();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ // Note: MSFT output API not documented.+ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append((String.format("EndPrecompiled: signature=0X%08X", signature)));+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Enum16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Enum16MsType.javanew file mode 100644index 0000000000..1bd3f0c67d--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Enum16MsType.java@@ -0,0 +1,64 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Enum16MsType extends AbstractEnumMsType {++ public static final int PDB_ID = 0x0007;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public Enum16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex16();+ underlyingTypeIndex = new TypeIndex16();+ name = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ numElements = reader.parseUnsignedShortVal();+ underlyingTypeIndex.parse(reader);+ fieldDescriptorListTypeIndex.parse(reader);+ property = new MsProperty(reader);+ name.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumMsType.javanew file mode 100644index 0000000000..30b4c7d8e8--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumMsType.java@@ -0,0 +1,100 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class EnumMsType extends AbstractEnumMsType {++ public static final int PDB_ID = 0x1507;++ protected AbstractString mangledName;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public EnumMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ /**+ * Returns the mangled name field+ * @return Mangled name.+ */+ public String getMangledName() {+ return mangledName.get();+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex32();+ underlyingTypeIndex = new TypeIndex32();+ name = new StringNt();+ mangledName = new StringNt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ numElements = reader.parseUnsignedShortVal();+ property = new MsProperty(reader);+ underlyingTypeIndex.parse(reader);+ fieldDescriptorListTypeIndex.parse(reader);+ if (reader.hasMoreNonPad()) {+ name.parse(reader);+ //System.out.println(name);+ if (reader.hasMoreNonPad()) {+ mangledName.parse(reader);+ //System.out.println(mangledName);+ }+ else if (reader.hasMore()) {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ }+ else {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ reader.skipPadding();+// name.parse(reader);+// mangledName.parse(reader);+// reader.skipPadding();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumStMsType.javanew file mode 100644index 0000000000..4a14a79787--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumStMsType.java@@ -0,0 +1,64 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class EnumStMsType extends AbstractEnumMsType {++ public static final int PDB_ID = 0x1007;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public EnumStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex32();+ underlyingTypeIndex = new TypeIndex32();+ name = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ numElements = reader.parseUnsignedShortVal();+ property = new MsProperty(reader);+ underlyingTypeIndex.parse(reader);+ fieldDescriptorListTypeIndex.parse(reader);+ name.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumerateMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumerateMsType.javanew file mode 100644index 0000000000..be263f5bba--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumerateMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringNt;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class EnumerateMsType extends AbstractEnumerateMsType {++ public static final int PDB_ID = 0x1502;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public EnumerateMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringNt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumerateStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumerateStMsType.javanew file mode 100644index 0000000000..0e4f53db03--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/EnumerateStMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringSt;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class EnumerateStMsType extends AbstractEnumerateMsType {++ public static final int PDB_ID = 0x0403;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public EnumerateStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FieldList16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FieldList16MsType.javanew file mode 100644index 0000000000..8cfa16367f--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FieldList16MsType.java@@ -0,0 +1,48 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class FieldList16MsType extends AbstractFieldListMsType {++ public static final int PDB_ID = 0x0204;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public FieldList16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FieldListMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FieldListMsType.javanew file mode 100644index 0000000000..51c675f668--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FieldListMsType.java@@ -0,0 +1,48 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class FieldListMsType extends AbstractFieldListMsType {++ public static final int PDB_ID = 0x1203;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public FieldListMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendClass16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendClass16MsType.javanew file mode 100644index 0000000000..6625d4ef73--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendClass16MsType.java@@ -0,0 +1,60 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class FriendClass16MsType extends AbstractFriendClassMsType {++ public static final int PDB_ID = 0x040b;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public FriendClass16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ friendClassTypeIndex = new TypeIndex16();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) {+ // Do nothing.+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendClassMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendClassMsType.javanew file mode 100644index 0000000000..6af9c87594--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendClassMsType.java@@ -0,0 +1,60 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class FriendClassMsType extends AbstractFriendClassMsType {++ public static final int PDB_ID = 0x140a;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public FriendClassMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ friendClassTypeIndex = new TypeIndex32();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ reader.parseBytes(2); // Throw away 2 bytes.+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendFunction16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendFunction16MsType.javanew file mode 100644index 0000000000..218afe121d--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendFunction16MsType.java@@ -0,0 +1,59 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class FriendFunction16MsType extends AbstractFriendFunctionMsType {++ public static final int PDB_ID = 0x0404;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public FriendFunction16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ friendTypeIndex = new TypeIndex16();+ name = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ friendTypeIndex.parse(reader);+ name.parse(reader);+ }+}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendFunctionMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendFunctionMsType.javanew file mode 100644index 0000000000..25e83841ee--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendFunctionMsType.java@@ -0,0 +1,60 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class FriendFunctionMsType extends AbstractFriendFunctionMsType {++ public static final int PDB_ID = 0x150c;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public FriendFunctionMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ friendTypeIndex = new TypeIndex32();+ name = new StringNt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ reader.parseBytes(2); // padding+ friendTypeIndex.parse(reader);+ name.parse(reader);+ }+}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendFunctionStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendFunctionStMsType.javanew file mode 100644index 0000000000..6285e75e16--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FriendFunctionStMsType.java@@ -0,0 +1,60 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class FriendFunctionStMsType extends AbstractFriendFunctionMsType {++ public static final int PDB_ID = 0x1403;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public FriendFunctionStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ friendTypeIndex = new TypeIndex32();+ name = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ reader.parseBytes(2); // padding+ friendTypeIndex.parse(reader);+ name.parse(reader);+ }+}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FunctionIdMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FunctionIdMsType.javanew file mode 100644index 0000000000..ec2c924170--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FunctionIdMsType.java@@ -0,0 +1,80 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class FunctionIdMsType extends AbstractMsType {++ public static final int PDB_ID = 0x1601;++ private AbstractTypeIndex scopeId; // zero if global+ private AbstractTypeIndex functionType;+ private AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public FunctionIdMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ scopeId = new TypeIndex32();+ functionType = new TypeIndex32();+ name = new StringNt();++ scopeId.parse(reader);+ if (scopeId.get() != 0) {+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.ITEM, scopeId.get()));+ pdb.popDependencyStack();+ }+ functionType.parse(reader);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, functionType.get()));+ pdb.popDependencyStack();+ name.parse(reader);+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ StringBuilder myBuilder = new StringBuilder();+ // Zero if global+ if (scopeId.get() != 0) {+ myBuilder.append(pdb.getItemRecord(scopeId.get()));+ myBuilder.append("::");+ }+ myBuilder.append(name);+ pdb.getTypeRecord(functionType.get()).emit(myBuilder, Bind.NONE);+ builder.append("FunctionId for: ");+ builder.append(myBuilder);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FunctionMsAttributes.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FunctionMsAttributes.javanew file mode 100644index 0000000000..5210890dd3--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/FunctionMsAttributes.java@@ -0,0 +1,67 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.*;++/**+ * Function attributes used on functions within specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class FunctionMsAttributes extends AbstractParsableItem {++ private static final String HAS_CPP_STYLE_RETURN_UDT_STRING = "return UDT (C++ style)";+ private static final String INSTANCE_CONSTRUCTOR_STRING = "instance constructor";+ private static final String INSTANCE_CONSTRUCTOR_VIRTUAL_BASE_STRING =+ "instance constructor of a class with virtual base";++ //==============================================================================================+ private boolean hasCPPStyleReturnUDT;+ private boolean isInstanceConstructor;+ private boolean isInstanceConstructorOfClassWithVirtualBases;++ //==============================================================================================+ /**+ * Constructor for FunctionMsAttributes.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public FunctionMsAttributes(PdbByteReader reader) throws PdbException {+ int attributes = reader.parseUnsignedByteVal();+ processAttributes(attributes);+ }++ @Override+ public void emit(StringBuilder builder) {+ DelimiterState ds = new DelimiterState("", "|");+ builder.append(ds.out(hasCPPStyleReturnUDT, HAS_CPP_STYLE_RETURN_UDT_STRING));+ builder.append(ds.out(isInstanceConstructor, INSTANCE_CONSTRUCTOR_STRING));+ builder.append(ds.out(isInstanceConstructorOfClassWithVirtualBases,+ INSTANCE_CONSTRUCTOR_VIRTUAL_BASE_STRING));+ }++ private void processAttributes(int attributes) {+ hasCPPStyleReturnUDT = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ isInstanceConstructor = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ isInstanceConstructorOfClassWithVirtualBases = ((attributes & 0x0001) == 0x0001);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/HighLevelShaderLanguageMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/HighLevelShaderLanguageMsType.javanew file mode 100644index 0000000000..187c1665c7--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/HighLevelShaderLanguageMsType.java@@ -0,0 +1,529 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class HighLevelShaderLanguageMsType extends AbstractMsType {++ public static final int PDB_ID = 0x1517;++ private static final int BUILTIN_HLSL_INTERFACE_POINTER = 0x0200;+ private static final int BUILTIN_HLSL_TEXTURE_1D = 0x0201;+ private static final int BUILTIN_HLSL_TEXTURE_1D_ARRAY = 0x0202;+ private static final int BUILTIN_HLSL_TEXTURE_2D = 0x0203;+ private static final int BUILTIN_HLSL_TEXTURE_2D_ARRAY = 0x0204;+ private static final int BUILTIN_HLSL_TEXTURE_3D = 0x0205;+ private static final int BUILTIN_HLSL_TEXTURE_CUBE = 0x0206;+ private static final int BUILTIN_HLSL_TEXTURE_CUBE_ARRAY = 0x0207;+ private static final int BUILTIN_HLSL_TEXTURE_2D_MS = 0x0208;+ private static final int BUILTIN_HLSL_TEXTURE_2D_MS_ARRAY = 0x0209;+ private static final int BUILTIN_HLSL_SAMPLER = 0x020a;+ private static final int BUILTIN_HLSL_SAMPLER_COMPARISON = 0x020b;+ private static final int BUILTIN_HLSL_BUFFER = 0x020c;+ private static final int BUILTIN_HLSL_POINT_STREAM = 0x020d;+ private static final int BUILTIN_HLSL_LINE_STREAM = 0x020e;+ private static final int BUILTIN_HLSL_TRIANGLE_STREAM = 0x020f;+ private static final int BUILTIN_HLSL_INPUT_PATCH = 0x0210;+ private static final int BUILTIN_HLSL_OUTPUT_PATCH = 0x0211;+ private static final int BUILTIN_HLSL_RW_TEXTURE_1D = 0x0212;+ private static final int BUILTIN_HLSL_RW_TEXTURE_1D_ARRAY = 0x0213;+ private static final int BUILTIN_HLSL_RW_TEXTURE_2D = 0x0214;+ private static final int BUILTIN_HLSL_RW_TEXTURE_2D_ARRAY = 0x0215;+ private static final int BUILTIN_HLSL_RW_TEXTURE_3D = 0x0216;+ private static final int BUILTIN_HLSL_RW_BUFFER = 0x0217;+ private static final int BUILTIN_HLSL_BYTE_ADDRESS_BUFFER = 0x0218;+ private static final int BUILTIN_HLSL_RW_BYTE_ADDRESS_BUFFER = 0x0219;+ private static final int BUILTIN_HLSL_STRUCTURED_BUFFER = 0x021a;+ private static final int BUILTIN_HLSL_RW_STRUCTURED_BUFFER = 0x021b;+ private static final int BUILTIN_HLSL_APPEND_STRUCTURED_BUFFER = 0x021c;+ private static final int BUILTIN_HLSL_CONSUME_STRUCTURED_BUFFER = 0x021d;+ private static final int BUILTIN_HLSL_MIN_8FLOAT = 0x021e;+ private static final int BUILTIN_HLSL_MIN_10FLOAT = 0x021f;+ private static final int BUILTIN_HLSL_MIN_16FLOAT = 0x0220;+ private static final int BUILTIN_HLSL_MIN_12INT = 0x0221;+ private static final int BUILTIN_HLSL_MIN_16INT = 0x0222;+ private static final int BUILTIN_HLSL_MIN_16UINT = 0x0223;++ //==============================================================================================+ private AbstractTypeIndex subtypeIndex;+ private int kind;+ private int numNumericProperties;+ private byte[] data;++ //==============================================================================================+ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public HighLevelShaderLanguageMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ subtypeIndex = new TypeIndex32();+ subtypeIndex.parse(reader);+ kind = reader.parseUnsignedShortVal();+ numNumericProperties = reader.parseUnsignedShortVal() & 0x000f;+ data = reader.parseBytesRemaining();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ /**+ * Returns the type index of the subtype for this class.+ * @return Type index of the subtype for this class.+ */+ public int getSubtypeIndex() {+ return subtypeIndex.get();+ }++ /**+ * Returns the integer "kind" value for this class.+ * @return The "kind" value.+ */+ public int getKind() {+ return kind;+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindInterfacePointer() {+ return (kind == BUILTIN_HLSL_INTERFACE_POINTER);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindTexture1D() {+ return (kind == BUILTIN_HLSL_TEXTURE_1D);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindTexture1DArray() {+ return (kind == BUILTIN_HLSL_TEXTURE_1D_ARRAY);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindTexture2D() {+ return (kind == BUILTIN_HLSL_TEXTURE_2D);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindTecture2DArray() {+ return (kind == BUILTIN_HLSL_TEXTURE_2D_ARRAY);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindTexture3D() {+ return (kind == BUILTIN_HLSL_TEXTURE_3D);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindTextureCube() {+ return (kind == BUILTIN_HLSL_TEXTURE_CUBE);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindTextureCubeArray() {+ return (kind == BUILTIN_HLSL_TEXTURE_CUBE_ARRAY);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindTexture2DMs() {+ return (kind == BUILTIN_HLSL_TEXTURE_2D_MS);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKind2DMsArray() {+ return (kind == BUILTIN_HLSL_TEXTURE_2D_MS_ARRAY);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindSampler() {+ return (kind == BUILTIN_HLSL_SAMPLER);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindSamplerComparison() {+ return (kind == BUILTIN_HLSL_SAMPLER_COMPARISON);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindBuffer() {+ return (kind == BUILTIN_HLSL_BUFFER);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindPointStream() {+ return (kind == BUILTIN_HLSL_POINT_STREAM);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindLineStream() {+ return (kind == BUILTIN_HLSL_LINE_STREAM);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindTriangleStream() {+ return (kind == BUILTIN_HLSL_TRIANGLE_STREAM);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindInputPatch() {+ return (kind == BUILTIN_HLSL_INPUT_PATCH);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindOutputPatch() {+ return (kind == BUILTIN_HLSL_OUTPUT_PATCH);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindRwTexture1D() {+ return (kind == BUILTIN_HLSL_RW_TEXTURE_1D);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindRwTexture1DArray() {+ return (kind == BUILTIN_HLSL_RW_TEXTURE_1D_ARRAY);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindRwTexture2D() {+ return (kind == BUILTIN_HLSL_RW_TEXTURE_2D);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindRwTexture2DArray() {+ return (kind == BUILTIN_HLSL_RW_TEXTURE_2D_ARRAY);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindRwTexture3D() {+ return (kind == BUILTIN_HLSL_RW_TEXTURE_3D);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindRwBuffer() {+ return (kind == BUILTIN_HLSL_RW_BUFFER);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindByteAddressBuffer() {+ return (kind == BUILTIN_HLSL_BYTE_ADDRESS_BUFFER);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindRwByteAddressBuffer() {+ return (kind == BUILTIN_HLSL_RW_BYTE_ADDRESS_BUFFER);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindStructuredBuffer() {+ return (kind == BUILTIN_HLSL_STRUCTURED_BUFFER);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindRwStructuredBuffer() {+ return (kind == BUILTIN_HLSL_RW_STRUCTURED_BUFFER);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindAppendStructuredBuffer() {+ return (kind == BUILTIN_HLSL_APPEND_STRUCTURED_BUFFER);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindConsumeStructuredBuffer() {+ return (kind == BUILTIN_HLSL_CONSUME_STRUCTURED_BUFFER);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindMin8Float() {+ return (kind == BUILTIN_HLSL_MIN_8FLOAT);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindMin10Float() {+ return (kind == BUILTIN_HLSL_MIN_10FLOAT);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindMin16Float() {+ return (kind == BUILTIN_HLSL_MIN_16FLOAT);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindMin12Int() {+ return (kind == BUILTIN_HLSL_MIN_12INT);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindMin16Int() {+ return (kind == BUILTIN_HLSL_MIN_16INT);+ }++ /**+ * Tells whether the "kind" property is true.+ * @return Truth about this "kind" property.+ */+ public boolean isKindMin16Uint() {+ return (kind == BUILTIN_HLSL_MIN_16UINT);+ }++ /**+ * Returns {@code byte[]} of the additional Data for this class.+ * @return Additional data for this class.+ */+ public byte[] getData() {+ return data;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No API for this. Just outputting something that might be useful.+ // At this time, not doing anything with bind here; don't think it is warranted.+ builder.append("Built-In HLSL: ");+ switch (kind) {+ case BUILTIN_HLSL_INTERFACE_POINTER:+ builder.append("InterfacePointer");+ break;+ case BUILTIN_HLSL_TEXTURE_1D:+ builder.append("Texture1D");+ break;+ case BUILTIN_HLSL_TEXTURE_1D_ARRAY:+ builder.append("Texture1DArray");+ break;+ case BUILTIN_HLSL_TEXTURE_2D:+ builder.append("Texture2D");+ break;+ case BUILTIN_HLSL_TEXTURE_2D_ARRAY:+ builder.append("Texture2DArray");+ break;+ case BUILTIN_HLSL_TEXTURE_3D:+ builder.append("Texture3D");+ break;+ case BUILTIN_HLSL_TEXTURE_CUBE:+ builder.append("TextureCube");+ break;+ case BUILTIN_HLSL_TEXTURE_CUBE_ARRAY:+ builder.append("TextureCubeArray");+ break;+ case BUILTIN_HLSL_TEXTURE_2D_MS:+ builder.append("Texture2DMs");+ break;+ case BUILTIN_HLSL_TEXTURE_2D_MS_ARRAY:+ builder.append("Texture2DMsArray");+ break;+ case BUILTIN_HLSL_SAMPLER:+ builder.append("Sampler");+ break;+ case BUILTIN_HLSL_SAMPLER_COMPARISON:+ builder.append("SamplerComparison");+ break;+ case BUILTIN_HLSL_BUFFER:+ builder.append("Buffer");+ break;+ case BUILTIN_HLSL_POINT_STREAM:+ builder.append("PointStream");+ break;+ case BUILTIN_HLSL_LINE_STREAM:+ builder.append("LineStream");+ break;+ case BUILTIN_HLSL_TRIANGLE_STREAM:+ builder.append("TriangleStream");+ break;+ case BUILTIN_HLSL_INPUT_PATCH:+ builder.append("InputPatch");+ break;+ case BUILTIN_HLSL_OUTPUT_PATCH:+ builder.append("OutputPatch");+ break;+ case BUILTIN_HLSL_RW_TEXTURE_1D:+ builder.append("RwTexture1D");+ break;+ case BUILTIN_HLSL_RW_TEXTURE_1D_ARRAY:+ builder.append("RwTexture1DArray");+ break;+ case BUILTIN_HLSL_RW_TEXTURE_2D:+ builder.append("RwTexture2D");+ break;+ case BUILTIN_HLSL_RW_TEXTURE_2D_ARRAY:+ builder.append("RwTexture2DArray");+ break;+ case BUILTIN_HLSL_RW_TEXTURE_3D:+ builder.append("RwTexture3D");+ break;+ case BUILTIN_HLSL_RW_BUFFER:+ builder.append("RwBuffer");+ break;+ case BUILTIN_HLSL_BYTE_ADDRESS_BUFFER:+ builder.append("ByteAddressBuffer");+ break;+ case BUILTIN_HLSL_RW_BYTE_ADDRESS_BUFFER:+ builder.append("RwByteAddressBuffer");+ break;+ case BUILTIN_HLSL_STRUCTURED_BUFFER:+ builder.append("StructuredBuffer");+ break;+ case BUILTIN_HLSL_RW_STRUCTURED_BUFFER:+ builder.append("RwStructuredBuffer");+ break;+ case BUILTIN_HLSL_APPEND_STRUCTURED_BUFFER:+ builder.append("AppendStructuredBuffer");+ break;+ case BUILTIN_HLSL_CONSUME_STRUCTURED_BUFFER:+ builder.append("ConsumeStructuredBuffer");+ break;+ case BUILTIN_HLSL_MIN_8FLOAT:+ builder.append("Min8Float");+ break;+ case BUILTIN_HLSL_MIN_10FLOAT:+ builder.append("Min10Float");+ break;+ case BUILTIN_HLSL_MIN_16FLOAT:+ builder.append("Min16Float");+ break;+ case BUILTIN_HLSL_MIN_12INT:+ builder.append("Min12Int");+ break;+ case BUILTIN_HLSL_MIN_16INT:+ builder.append("Min16Int");+ break;+ case BUILTIN_HLSL_MIN_16UINT:+ builder.append("Min16UInt");+ break;+ }+ builder.append(String.format(" <numProperties=%d>", numNumericProperties));+ // TODO: output more? What does it mean?+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Index16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Index16MsType.javanew file mode 100644index 0000000000..dcc2609b7b--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Index16MsType.java@@ -0,0 +1,59 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Index16MsType extends AbstractIndexMsType {++ public static final int PDB_ID = 0x0405;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public Index16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ referencedTypeIndex = new TypeIndex16();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ referencedTypeIndex.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/IndexMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/IndexMsType.javanew file mode 100644index 0000000000..cccd358633--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/IndexMsType.java@@ -0,0 +1,60 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class IndexMsType extends AbstractIndexMsType {++ public static final int PDB_ID = 0x1404;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public IndexMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ referencedTypeIndex = new TypeIndex32();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ reader.parseBytes(2); // Throw away 2 bytes.+ referencedTypeIndex.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/IndirectVirtualBaseClass16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/IndirectVirtualBaseClass16MsType.javanew file mode 100644index 0000000000..ae9be660ca--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/IndirectVirtualBaseClass16MsType.java@@ -0,0 +1,63 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class IndirectVirtualBaseClass16MsType extends AbstractIndirectVirtualBaseClassMsType {++ public static final int PDB_ID = 0x0402;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public IndirectVirtualBaseClass16MsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ directVirtualBaseClassTypeIndex = new TypeIndex16();+ virtualBasePointerTypeIndex = new TypeIndex16();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ directVirtualBaseClassTypeIndex.parse(reader);+ virtualBasePointerTypeIndex.parse(reader);+ attribute = new ClassFieldMsAttributes(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/IndirectVirtualBaseClassMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/IndirectVirtualBaseClassMsType.javanew file mode 100644index 0000000000..e624b53465--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/IndirectVirtualBaseClassMsType.java@@ -0,0 +1,63 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class IndirectVirtualBaseClassMsType extends AbstractIndirectVirtualBaseClassMsType {++ public static final int PDB_ID = 0x1402;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public IndirectVirtualBaseClassMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ directVirtualBaseClassTypeIndex = new TypeIndex32();+ virtualBasePointerTypeIndex = new TypeIndex32();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ attribute = new ClassFieldMsAttributes(reader);+ directVirtualBaseClassTypeIndex.parse(reader);+ virtualBasePointerTypeIndex.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/InterfaceMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/InterfaceMsType.javanew file mode 100644index 0000000000..db0418913f--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/InterfaceMsType.java@@ -0,0 +1,122 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ * <P>+ * Note that class, struct, and interface are very closed related and have many of the same+ * constructs and parsing procedures. However, they are separate. If any of the internals+ * of one of these is changed, it is highly suggested that the others be changed as well as+ * there is not code-shared between these other than by code duplication.+ */+public class InterfaceMsType extends AbstractCompositeMsType {++ public static final int PDB_ID = 0x1519;++ private static final String TYPE_STRING = "interface";++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public InterfaceMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append(getTypeString());+ myBuilder.append(" ");+ myBuilder.append(name);+ myBuilder.append("<");+ myBuilder.append(count);+ myBuilder.append(",");+ myBuilder.append(property);+ myBuilder.append(">");+ AbstractMsType fieldType = getFieldDescriptorListType();+ if (fieldType != null) {+ myBuilder.append(fieldType);+ }+ myBuilder.append(" ");+ builder.insert(0, myBuilder);+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex32();+ derivedFromListTypeIndex = new TypeIndex32(); // Can be zero if none.+ vShapeTableTypeIndex = new TypeIndex32();+ name = new StringNt();+ mangledName = new StringNt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ count = reader.parseUnsignedShortVal();+ property = new MsProperty(reader);+ fieldDescriptorListTypeIndex.parse(reader);+ derivedFromListTypeIndex.parse(reader);+ vShapeTableTypeIndex.parse(reader);+ //TODO: has more... guessing below+ size = reader.parseNumeric();+ if (reader.hasMoreNonPad()) {+ name.parse(reader);+ //System.out.println(name);+ if (reader.hasMoreNonPad()) {+ mangledName.parse(reader);+ //System.out.println(mangledName);+ }+ else if (reader.hasMore()) {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ }+ else {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ reader.skipPadding();+ }++ @Override+ protected String getTypeString() {+ return TYPE_STRING;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/LabelMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/LabelMsType.javanew file mode 100644index 0000000000..45ca81f884--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/LabelMsType.java@@ -0,0 +1,79 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class LabelMsType extends AbstractMsType {++ public static final int PDB_ID = 0x000e;++ private static final int ADDRESS_MODE_NEAR = 0;+ private static final int ADDRESS_MODE_FAR = 4;++ //==============================================================================================+ private int mode;++ //==============================================================================================+ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public LabelMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ mode = reader.parseUnsignedShortVal();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isNear() {+ return (mode == ADDRESS_MODE_NEAR);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isFar() {+ return (mode == ADDRESS_MODE_FAR);+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // There is no documented API.+ builder.append("<<" + getClass().getSimpleName() + (isNear() ? " near" : "") ++ (isFar() ? " far" : "") + ">>");+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ListMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ListMsType.javanew file mode 100644index 0000000000..d1f414e21d--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ListMsType.java@@ -0,0 +1,56 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ListMsType extends AbstractMsType {++ public static final int PDB_ID = 0x0203;++ private byte[] data;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ */+ public ListMsType(AbstractPdb pdb, PdbByteReader reader) {+ super(pdb, reader);+ data = reader.parseBytesRemaining();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // There is no documented API.+ builder.append(+ String.format("<<%s dataLength=%d>>", getClass().getSimpleName(), data.length));+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ManagedMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ManagedMsType.javanew file mode 100644index 0000000000..715657eb79--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ManagedMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringUtf8Nt;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ManagedMsType extends AbstractManagedMsType {++ public static final int PDB_ID = 0x1514;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public ManagedMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringUtf8Nt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ManagedStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ManagedStMsType.javanew file mode 100644index 0000000000..4a0707c413--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ManagedStMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringUtf8St;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ManagedStMsType extends AbstractManagedMsType {++ public static final int PDB_ID = 0x140f;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public ManagedStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringUtf8St();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MatrixMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MatrixMsType.javanew file mode 100644index 0000000000..48669b0bee--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MatrixMsType.java@@ -0,0 +1,129 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.math.BigInteger;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MatrixMsType extends AbstractMsType {++ public static final int PDB_ID = 0x151c;++ private AbstractTypeIndex elementTypeIndex;+ private long numRows;+ private long numColumns;+ private long majorStride;+ private boolean rowMajor; // default is column-major+ //TODO: not sure about the following.+ private BigInteger size;+ private AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public MatrixMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ elementTypeIndex = new TypeIndex32();+ name = new StringNt();++ elementTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, elementTypeIndex.get()));+ pdb.popDependencyStack();+ numRows = reader.parseUnsignedIntVal();+ numColumns = reader.parseUnsignedIntVal();+ majorStride = reader.parseUnsignedIntVal();+ int attribute = reader.parseUnsignedByteVal();+ rowMajor = ((attribute & 0x01) == 0x01);+ //TODO: not sure about the following.+ size = reader.parseNumeric();+ name.parse(reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ /**+ * Returns the size of the matrix type.+ * @return Size of the matrix type.+ */+ public BigInteger getSize() {+ return size;+ }++ /**+ * Returns the number of rows of the matrix type.+ * @return Number of rows of the matrix.+ */+ public long getNumRows() {+ return numRows;+ }++ /**+ * Returns the number of columns of the matrix type.+ * @return Number of columns of the matrix.+ */+ public long getNumColumns() {+ return numColumns;+ }++ /**+ * Returns whether matrix organized as row major (vs. column major)+ * @return True if row major; false if column major.+ */+ public boolean isRowMajor() {+ return rowMajor;+ }++ /**+ * Returns the size of the major stride of the matrix type.+ * @return Size of the major stride.+ */+ public long getMajorStride() {+ return majorStride;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No API for this. Just outputting something that might be useful.+ // At this time, not doing anything with bind here; don't think it is warranted.+ String elementTypeString = pdb.getTypeRecord(elementTypeIndex.get()).toString();+ if (rowMajor) {+ builder.append(String.format("matrix: %s[row<%s> %d][column<%s> %d]", name.get(),+ elementTypeString, numRows, elementTypeString, numColumns));+ }+ else {+ builder.append(String.format("matrix: %s[column<%s> %d][row<%s> %d]", name.get(),+ elementTypeString, numColumns, elementTypeString, numRows));+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Member16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Member16MsType.javanew file mode 100644index 0000000000..12d3c1c258--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Member16MsType.java@@ -0,0 +1,61 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Member16MsType extends AbstractMemberMsType {++ public static final int PDB_ID = 0x0406;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public Member16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldTypeRecordIndex = new TypeIndex16();+ name = new StringSt();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ fieldTypeRecordIndex.parse(reader);+ attribute = new ClassFieldMsAttributes(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberFunction16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberFunction16MsType.javanew file mode 100644index 0000000000..9d0fab2449--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberFunction16MsType.java@@ -0,0 +1,57 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MemberFunction16MsType extends AbstractMemberFunctionMsType {++ public static final int PDB_ID = 0x0009;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public MemberFunction16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ returnValueTypeIndex = new TypeIndex16();+ containingClassTypeIndex = new TypeIndex16();+ thisPointerTypeIndex = new TypeIndex16();+ argListTypeIndex = new TypeIndex16();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberFunctionIdMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberFunctionIdMsType.javanew file mode 100644index 0000000000..2abb997e8d--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberFunctionIdMsType.java@@ -0,0 +1,76 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MemberFunctionIdMsType extends AbstractMsType {++ public static final int PDB_ID = 0x1602;++ private AbstractTypeIndex parentTypeIndex;+ private AbstractTypeIndex functionType;+ private AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public MemberFunctionIdMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ parentTypeIndex = new TypeIndex32();+ functionType = new TypeIndex32();+ name = new StringNt();++ parentTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, parentTypeIndex.get()));+ pdb.popDependencyStack();+ functionType.parse(reader);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, functionType.get()));+ pdb.popDependencyStack();+ name.parse(reader);+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ StringBuilder myBuilder = new StringBuilder();+ myBuilder.append(pdb.getTypeRecord(parentTypeIndex.get()));+ myBuilder.append("::");+ myBuilder.append(name);+ pdb.getTypeRecord(functionType.get()).emit(myBuilder, Bind.NONE);+ builder.append("MemberFunctionId for: ");+ builder.append(myBuilder);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberFunctionMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberFunctionMsType.javanew file mode 100644index 0000000000..b0f8a643e6--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberFunctionMsType.java@@ -0,0 +1,57 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MemberFunctionMsType extends AbstractMemberFunctionMsType {++ public static final int PDB_ID = 0x1009;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public MemberFunctionMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ returnValueTypeIndex = new TypeIndex32();+ containingClassTypeIndex = new TypeIndex32();+ thisPointerTypeIndex = new TypeIndex32();+ argListTypeIndex = new TypeIndex32();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberModifyMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberModifyMsType.javanew file mode 100644index 0000000000..93718af339--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberModifyMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringNt;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MemberModifyMsType extends AbstractMemberModifyMsType {++ public static final int PDB_ID = 0x1513;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public MemberModifyMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringNt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberModifyStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberModifyStMsType.javanew file mode 100644index 0000000000..dd58326abe--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberModifyStMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringSt;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MemberModifyStMsType extends AbstractMemberModifyMsType {++ public static final int PDB_ID = 0x140e;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public MemberModifyStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberMsType.javanew file mode 100644index 0000000000..6835f74013--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberMsType.java@@ -0,0 +1,61 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MemberMsType extends AbstractMemberMsType {++ public static final int PDB_ID = 0x150d;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public MemberMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.skipPadding(); // Real data shows padding instead of align.+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldTypeRecordIndex = new TypeIndex32();+ name = new StringNt();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ attribute = new ClassFieldMsAttributes(reader);+ fieldTypeRecordIndex.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberStMsType.javanew file mode 100644index 0000000000..4fca92f2bc--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MemberStMsType.java@@ -0,0 +1,61 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MemberStMsType extends AbstractMemberMsType {++ public static final int PDB_ID = 0x1405;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public MemberStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldTypeRecordIndex = new TypeIndex32();+ name = new StringSt();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ attribute = new ClassFieldMsAttributes(reader);+ fieldTypeRecordIndex.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodList16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodList16MsType.javanew file mode 100644index 0000000000..e96fc292f3--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodList16MsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MethodList16MsType extends AbstractMethodListMsType {++ public static final int PDB_ID = 0x0207;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public MethodList16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected AbstractMethodRecordMs parseOneRecord(AbstractPdb pdbIn, PdbByteReader reader)+ throws PdbException {+ return new MethodRecord16Ms(pdbIn, reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodListMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodListMsType.javanew file mode 100644index 0000000000..2728b68c30--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodListMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MethodListMsType extends AbstractMethodListMsType {++ public static final int PDB_ID = 0x1206;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public MethodListMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected AbstractMethodRecordMs parseOneRecord(AbstractPdb pdbIn, PdbByteReader reader)+ throws PdbException {+ return new MethodRecordMs(pdbIn, reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodRecord16Ms.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodRecord16Ms.javanew file mode 100644index 0000000000..cd10768e7b--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodRecord16Ms.java@@ -0,0 +1,59 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MethodRecord16Ms extends AbstractMethodRecordMs {++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public MethodRecord16Ms(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ protected void create() {+ procedureRecordNumber = new TypeIndex16();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ attributes = new ClassFieldMsAttributes(reader);+ procedureRecordNumber.parse(reader);+ if (attributes.getPropertyVal() == 4) {+ optionalOffset = reader.parseUnsignedIntVal();+ }+ else {+ optionalOffset = -1;+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodRecordMs.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodRecordMs.javanew file mode 100644index 0000000000..85c11cbb0a--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MethodRecordMs.java@@ -0,0 +1,63 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MethodRecordMs extends AbstractMethodRecordMs {++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public MethodRecordMs(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ protected void create() {+ procedureRecordNumber = new TypeIndex32();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ attributes = new ClassFieldMsAttributes(reader);+ reader.parseBytes(2); // structure padding+ procedureRecordNumber.parse(reader);+ // 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.getPropertyVal() == 4) || (attributes.getPropertyVal() == 6)) {+ optionalOffset = reader.parseUnsignedIntVal();+ }+ else {+ optionalOffset = -1;+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Modifier16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Modifier16MsType.javanew file mode 100644index 0000000000..138bb1af5a--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Modifier16MsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Modifier16MsType extends AbstractModifierMsType {++ public static final int PDB_ID = 0x0001;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public Modifier16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ modifiedTypeIndex = new TypeIndex16();+ }++ @Override+ // Different size type index, different order.+ protected void parseFields(PdbByteReader reader) throws PdbException {+ int attributes = reader.parseUnsignedShortVal();+ processAttributes(attributes);+ modifiedTypeIndex.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ModifierExMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ModifierExMsType.javanew file mode 100644index 0000000000..91edd9a47b--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ModifierExMsType.java@@ -0,0 +1,378 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ModifierExMsType extends AbstractMsType {++ public static final int PDB_ID = 0x1518;++ // Standard modifiers (reserved 0x0000 - 0x01ff)+ private static final int MOD_INVALID = 0x0000;+ private static final int MOD_CONST = 0x0001;+ private static final int MOD_VOLATILE = 0x0002;+ private static final int MOD_UNALIGNED = 0x0003;++ // HLSL modifiers 0x0200 - 0x03ff+ private static final int MOD_HLSL_UNIFORM = 0x0200;+ private static final int MOD_HLSL_LINE = 0x0201;+ private static final int MOD_HLSL_TRIANGLE = 0x0202;+ private static final int MOD_HLSL_LINEADJ = 0x0203;+ private static final int MOD_HLSL_TRIANGLEADJ = 0x0204;+ private static final int MOD_HLSL_LINEAR = 0x0205;+ private static final int MOD_HLSL_CENTROID = 0x0206;+ private static final int MOD_HLSL_CONSTINTERP = 0x0207;+ private static final int MOD_HLSL_NOPERSPECTIVE = 0x0208;+ private static final int MOD_HLSL_SAMPLE = 0x0209;+ private static final int MOD_HLSL_CENTER = 0x020a;+ private static final int MOD_HLSL_SNORM = 0x020b;+ private static final int MOD_HLSL_UNORM = 0x020c;+ private static final int MOD_HLSL_PRECISE = 0x020d;+ private static final int MOD_HLSL_UAV_GLOBALLY_COHERENT = 0x020e;++ private static final String[] STANDARD_MOD_STRING = new String[4];+ static {+ STANDARD_MOD_STRING[0] = "INVALID ";+ STANDARD_MOD_STRING[1] = "const ";+ STANDARD_MOD_STRING[2] = "volatile ";+ STANDARD_MOD_STRING[3] = "__unaligned ";++ }+ private static final String[] HLSL_MOD_STRING = new String[15];+ static {+ HLSL_MOD_STRING[0] = "__uniform__ ";+ HLSL_MOD_STRING[1] = "__line__ ";+ HLSL_MOD_STRING[2] = "__triangle__ ";+ HLSL_MOD_STRING[3] = "__lineadj__ ";+ HLSL_MOD_STRING[4] = "__triangleadj__ ";+ HLSL_MOD_STRING[5] = "__linear__ ";+ HLSL_MOD_STRING[6] = "__centroid__ ";+ HLSL_MOD_STRING[7] = "__constinterp__ ";+ HLSL_MOD_STRING[8] = "__noperspective__ ";+ HLSL_MOD_STRING[9] = "__sample__ ";+ HLSL_MOD_STRING[10] = "__center__ ";+ HLSL_MOD_STRING[11] = "__snorm__ ";+ HLSL_MOD_STRING[12] = "__unorm__ ";+ HLSL_MOD_STRING[13] = "__precise__ ";+ HLSL_MOD_STRING[14] = "__uav_globally_coherent__ ";+ }++ //==============================================================================================+ private AbstractTypeIndex modifiedTypeIndex;+ //TODO: alternative to List, could create a bunch of booleans (e.g., isConst), and put+ // methods in place to test (e.g., public boolean isConst()). Then emit() method would+ // have to put the modifier strings in a predesigned order instead of the order that they+ // were found in the record.+ private List<Integer> modifierList = new ArrayList<>();++ //==============================================================================================+ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public ModifierExMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ modifiedTypeIndex = new TypeIndex32();+ modifiedTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, modifiedTypeIndex.get()));+ pdb.popDependencyStack();+ int count = reader.parseUnsignedShortVal();+ for (int i = 0; i < count; i++) {+ // TODO: Not sure if these are unsigned short or int.+ int modifier = reader.parseUnsignedShortVal();+ if (modifier == MOD_INVALID) {+ // Should not happen, but could output a warning.+ }+ modifierList.add(modifier);+ }+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isConst() {+ for (int val : modifierList) {+ if (val == MOD_CONST) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isVolatile() {+ for (int val : modifierList) {+ if (val == MOD_VOLATILE) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isUnaligned() {+ for (int val : modifierList) {+ if (val == MOD_UNALIGNED) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslUniform() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_UNIFORM) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslLine() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_LINE) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslTriangle() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_TRIANGLE) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslLindAdj() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_LINEADJ) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslTriangleAdj() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_TRIANGLEADJ) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslLinear() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_LINEAR) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslCentroid() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_CENTROID) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslConstInterp() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_CONSTINTERP) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslNoPerspective() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_NOPERSPECTIVE) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslSample() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_SAMPLE) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslCenter() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_CENTER) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslSNorm() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_SNORM) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslUNorm() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_UNORM) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslPrecise() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_PRECISE) {+ return true;+ }+ }+ return false;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean IsHlslUavGloballyCoherent() {+ for (int val : modifierList) {+ if (val == MOD_HLSL_UAV_GLOBALLY_COHERENT) {+ return true;+ }+ }+ return false;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ StringBuilder modBuilder = new StringBuilder();+ for (int modifier : modifierList) {+ modBuilder.append(getModifierString(modifier));+ }+ modBuilder.append(pdb.getTypeRecord(modifiedTypeIndex.get()));+ builder.insert(0, modBuilder);+ }++ private String getModifierString(int modifierVal) {+ if ((modifierVal >= 0x0000) && (modifierVal <= 0x0003)) {+ return STANDARD_MOD_STRING[modifierVal];+ }+ else if ((modifierVal >= 0x0200) && (modifierVal <= 0x020e)) {+ return HLSL_MOD_STRING[modifierVal - 0x0200];+ }+ return STANDARD_MOD_STRING[0];+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ModifierMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ModifierMsType.javanew file mode 100644index 0000000000..1a773babec--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ModifierMsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ModifierMsType extends AbstractModifierMsType {++ public static final int PDB_ID = 0x1001;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public ModifierMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ modifiedTypeIndex = new TypeIndex32();+ }++ @Override+ // Different size type index, different order.+ protected void parseFields(PdbByteReader reader) throws PdbException {+ modifiedTypeIndex.parse(reader);+ int attributes = reader.parseUnsignedShortVal();+ processAttributes(attributes);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MsProperty.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MsProperty.javanew file mode 100644index 0000000000..8bd46657e7--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/MsProperty.java@@ -0,0 +1,261 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.*;++/**+ * Property attributes used for various specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class MsProperty extends AbstractParsableItem {++ public static final int HFA_NONE = 0;+ public static final int HFA_FLOAT = 1;+ public static final int HFA_DOUBLE = 2;+ public static final int HFA_RESV = 3;++ public static final int MOCOM_NONE = 0;+ public static final int MOCOM_REF = 1;+ public static final int MOCOM_VALUE = 2;+ public static final int MOCOM_INTERFACE = 3;++ private static final String[] HFA_STRING = new String[4];+ static {+ HFA_STRING[0] = "";+ HFA_STRING[1] = "hfaFloat";+ HFA_STRING[2] = "hfaDouble";+ HFA_STRING[3] = "hfa(3)";++ }+ private static final String[] MOCOM_STRING = new String[4];+ static {+ MOCOM_STRING[0] = "";+ MOCOM_STRING[1] = "ref";+ MOCOM_STRING[2] = "value";+ MOCOM_STRING[3] = "interface";++ }++ private static final String PACKED_STRING = "packed";+ private static final String CTOR_STRING = "ctor";+ private static final String OVERLOADED_OPS_STRING = "ovlops";+ private static final String NESTED_STRING = "isnested";+ private static final String CONTAINS_NESTED_STRING = "cnested";+ private static final String OVERLOADED_ASSIGN_STRING = "opassign";+ private static final String CASTING_METHODS_STRING = "opcast";+ private static final String FORWARD_REFS_STRING = "fwdref";+ private static final String SCOPED_STRING = "scoped";+ private static final String HAS_UNIQUE_NAME_STRING = "hasuniquename";+ private static final String SEALED_STRING = "sealed";+ private static final String INTRINSIC_STRING = "intrinsic";++ //==============================================================================================+ private boolean packedStructure;+ private boolean constructorOrDestructorPresent;+ private boolean overloadedOperatorsPresent;+ private boolean isNestedClass;+ private boolean containsNestedTypes;+ private boolean hasOverloadedAssignment;+ private boolean hasCastingMethods;+ private boolean isForwardReference;+ private boolean scopedDefinition;+ private boolean hasUniqueName; // A decorated name that follows the regular name+ private boolean sealed; // Cannot be used as a base class+ private boolean isIntrinsic; // (e.g., _m128d)++ private int hfaVal; // ???+ private int mocomVal; // ????++ //==============================================================================================+ /**+ * Constructor for MsProperty.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public MsProperty(PdbByteReader reader) throws PdbException {+ int properties = reader.parseUnsignedShortVal();+ processProperties(properties);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isPacked() {+ return packedStructure;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean hasConstructorOrDestructor() {+ return constructorOrDestructorPresent;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean hasOverloadedOperators() {+ return overloadedOperatorsPresent;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isNestedClass() {+ return isNestedClass;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean containsNestedTypes() {+ return containsNestedTypes;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean hasOverloadedAssignment() {+ return hasOverloadedAssignment;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean hasCastingMethods() {+ return hasCastingMethods;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isForwardReference() {+ return isForwardReference;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean hasScopedDefinition() {+ return scopedDefinition;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean hasUniqueName() {+ return hasUniqueName;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean cannotBeBaseClass() {+ return sealed;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isIntrinsic() {+ return isIntrinsic;+ }++ /**+ * Gets the value (index) of the property.+ * @return The index value of the property.+ */+ public int getHfaVal() {+ return hfaVal;+ }++ /**+ * Gets the value (index) of the property.+ * @return The index value of the property.+ */+ public int getMocomVal() {+ return mocomVal;+ }++ @Override+ public void emit(StringBuilder builder) {+ DelimiterState ds = new DelimiterState("", " ");+ builder.append(ds.out(packedStructure, PACKED_STRING));+ builder.append(ds.out(constructorOrDestructorPresent, CTOR_STRING));+ builder.append(ds.out(overloadedOperatorsPresent, OVERLOADED_OPS_STRING));+ builder.append(ds.out(isNestedClass, NESTED_STRING));+ builder.append(ds.out(containsNestedTypes, CONTAINS_NESTED_STRING));+ builder.append(ds.out(hasOverloadedAssignment, OVERLOADED_ASSIGN_STRING));+ builder.append(ds.out(hasCastingMethods, CASTING_METHODS_STRING));+ builder.append(ds.out(isForwardReference, FORWARD_REFS_STRING));+ builder.append(ds.out(scopedDefinition, SCOPED_STRING));+ builder.append(ds.out(hasUniqueName, HAS_UNIQUE_NAME_STRING));+ builder.append(ds.out(sealed, SEALED_STRING));+ builder.append(ds.out((hfaVal != 0), HFA_STRING[hfaVal]));+ builder.append(ds.out(isIntrinsic, INTRINSIC_STRING));+ builder.append(ds.out((mocomVal != 0), MOCOM_STRING[mocomVal]));+ }++ private void processProperties(int properties) {+ packedStructure = ((properties & 0x0001) == 0x0001);+ properties >>= 1;+ constructorOrDestructorPresent = ((properties & 0x0001) == 0x0001);+ properties >>= 1;+ overloadedOperatorsPresent = ((properties & 0x0001) == 0x0001);+ properties >>= 1;+ isNestedClass = ((properties & 0x0001) == 0x0001);+ properties >>= 1;+ containsNestedTypes = ((properties & 0x0001) == 0x0001);+ properties >>= 1;+ hasOverloadedAssignment = ((properties & 0x0001) == 0x0001);+ properties >>= 1;+ hasCastingMethods = ((properties & 0x0001) == 0x0001);+ properties >>= 1;+ isForwardReference = ((properties & 0x0001) == 0x0001);+ properties >>= 1;+ scopedDefinition = ((properties & 0x0001) == 0x0001);+ properties >>= 1;+ hasUniqueName = ((properties & 0x0001) == 0x0001);+ properties >>= 1;+ sealed = ((properties & 0x0001) == 0x0001);+ properties >>= 1;++ hfaVal = (properties & 0x0003);+ properties >>= 2;++ isIntrinsic = ((properties & 0x0001) == 0x0001);+ properties >>= 1;++ mocomVal = (properties & 0x0003);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedType16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedType16MsType.javanew file mode 100644index 0000000000..c60b01ed46--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedType16MsType.java@@ -0,0 +1,60 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class NestedType16MsType extends AbstractNestedTypeMsType {++ public static final int PDB_ID = 0x0409;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public NestedType16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ nestedTypeDefinitionIndex = new TypeIndex16();+ name = new StringSt();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) {+ // Do nothing.+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeExtMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeExtMsType.javanew file mode 100644index 0000000000..523e6397e4--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeExtMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringNt;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class NestedTypeExtMsType extends AbstractNestedTypeExtMsType {++ public static final int PDB_ID = 0x1512;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public NestedTypeExtMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringNt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeExtStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeExtStMsType.javanew file mode 100644index 0000000000..8a3b617467--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeExtStMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringSt;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class NestedTypeExtStMsType extends AbstractNestedTypeExtMsType {++ public static final int PDB_ID = 0x140d;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public NestedTypeExtStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeMsType.javanew file mode 100644index 0000000000..8d20be064b--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeMsType.java@@ -0,0 +1,60 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class NestedTypeMsType extends AbstractNestedTypeMsType {++ public static final int PDB_ID = 0x1510;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public NestedTypeMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ nestedTypeDefinitionIndex = new TypeIndex32();+ name = new StringNt();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ reader.parseBytes(2); // Throw away 2 bytes.+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeStMsType.javanew file mode 100644index 0000000000..3563d1c121--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NestedTypeStMsType.java@@ -0,0 +1,60 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class NestedTypeStMsType extends AbstractNestedTypeMsType {++ public static final int PDB_ID = 0x1408;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public NestedTypeStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ nestedTypeDefinitionIndex = new TypeIndex32();+ name = new StringSt();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ reader.parseBytes(2); // Throw away 2 bytes.+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NotTranMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NotTranMsType.javanew file mode 100644index 0000000000..1cffe4be2b--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NotTranMsType.java@@ -0,0 +1,52 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class NotTranMsType extends AbstractMsType {++ public static final int PDB_ID = 0x0010;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ */+ public NotTranMsType(AbstractPdb pdb, PdbByteReader reader) {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // There is no documented API.+ builder.append("<<" + getClass().getSimpleName() + ">>");+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NullMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NullMsType.javanew file mode 100644index 0000000000..03ebad6cd4--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/NullMsType.java@@ -0,0 +1,52 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class NullMsType extends AbstractMsType {++ public static final int PDB_ID = 0x000f;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ */+ public NullMsType(AbstractPdb pdb, PdbByteReader reader) {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // There is no documented API.+ builder.append("<<" + getClass().getSimpleName() + ">>");+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OemDefinableString16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OemDefinableString16MsType.javanew file mode 100644index 0000000000..58c318be6a--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OemDefinableString16MsType.java@@ -0,0 +1,58 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class OemDefinableString16MsType extends AbstractOemDefinableStringMsType {++ public static final int PDB_ID = 0x0015;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public OemDefinableString16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void parseTypeIndexList(PdbByteReader reader) throws PdbException {+ int count = reader.parseUnsignedShortVal();+ for (int i = 0; i < count; i++) {+ AbstractTypeIndex typeIndex = new TypeIndex16();+ typeIndex.parse(reader);+ typeIndexList.add(typeIndex);+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OemDefinableString2MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OemDefinableString2MsType.javanew file mode 100644index 0000000000..1f118a6827--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OemDefinableString2MsType.java@@ -0,0 +1,77 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.app.util.datatype.microsoft.GUID;+import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class OemDefinableString2MsType extends AbstractMsType {++ public static final int PDB_ID = 0x1011;++ private GUID guid; // = new GUID(0, (short) 0, (short) 0, initGuidField4);+ private List<AbstractTypeIndex> typeIndices = new ArrayList<>();+ private byte[] remainingBytes;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public OemDefinableString2MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ guid = reader.parseGUID();+ int count = reader.parseInt();+ for (int i = 0; i < count; i++) {+ AbstractTypeIndex typeIndex = new TypeIndex32();+ typeIndex.parse(reader);+ typeIndices.add(typeIndex);+ }+ //TODO: We do not know what "OEM-defined" data remains. For now, just grabbing rest.+ remainingBytes = reader.parseBytesRemaining();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ builder.append(String.format("OEM Definable String 2\n"));+ builder.append(String.format(" GUID: %s\n", guid.toString()));+ builder.append(String.format(" count: %d\n", typeIndices.size()));+ for (int i = 0; i < typeIndices.size(); i++) {+ builder.append(+ String.format(" typeIndex[%d]: 0x%08x\n", i, typeIndices.get(i).get()));+ }+ builder.append(String.format(" additional data length: %d\n", remainingBytes.length));+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OemDefinableStringMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OemDefinableStringMsType.javanew file mode 100644index 0000000000..2bb88d01a1--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OemDefinableStringMsType.java@@ -0,0 +1,58 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class OemDefinableStringMsType extends AbstractOemDefinableStringMsType {++ public static final int PDB_ID = 0x100f;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public OemDefinableStringMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void parseTypeIndexList(PdbByteReader reader) throws PdbException {+ int count = reader.parseInt();+ for (int i = 0; i < count; i++) {+ AbstractTypeIndex typeIndex = new TypeIndex32();+ typeIndex.parse(reader);+ typeIndexList.add(typeIndex);+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OneMethod16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OneMethod16MsType.javanew file mode 100644index 0000000000..3d3f089623--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OneMethod16MsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class OneMethod16MsType extends AbstractOneMethodMsType {++ public static final int PDB_ID = 0x040c;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public OneMethod16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ procedureTypeRecordIndex = new TypeIndex16();+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OneMethodMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OneMethodMsType.javanew file mode 100644index 0000000000..6e38c648c0--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OneMethodMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class OneMethodMsType extends AbstractOneMethodMsType {++ public static final int PDB_ID = 0x1511;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public OneMethodMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ procedureTypeRecordIndex = new TypeIndex32();+ name = new StringNt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OneMethodStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OneMethodStMsType.javanew file mode 100644index 0000000000..72e60a0094--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OneMethodStMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class OneMethodStMsType extends AbstractOneMethodMsType {++ public static final int PDB_ID = 0x140b;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public OneMethodStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ procedureTypeRecordIndex = new TypeIndex32();+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OverloadedMethod16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OverloadedMethod16MsType.javanew file mode 100644index 0000000000..c0113be33f--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OverloadedMethod16MsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class OverloadedMethod16MsType extends AbstractOverloadedMethodMsType {++ public static final int PDB_ID = 0x0408;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public OverloadedMethod16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ methodListIndex = new TypeIndex16();+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OverloadedMethodMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OverloadedMethodMsType.javanew file mode 100644index 0000000000..d26127b088--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OverloadedMethodMsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class OverloadedMethodMsType extends AbstractOverloadedMethodMsType {++ public static final int PDB_ID = 0x150f;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public OverloadedMethodMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ methodListIndex = new TypeIndex32();+ name = new StringNt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OverloadedMethodStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OverloadedMethodStMsType.javanew file mode 100644index 0000000000..dbc36cf025--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/OverloadedMethodStMsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class OverloadedMethodStMsType extends AbstractOverloadedMethodMsType {++ public static final int PDB_ID = 0x1407;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public OverloadedMethodStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ methodListIndex = new TypeIndex32();+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Pointer16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Pointer16MsType.javanew file mode 100644index 0000000000..b3422803bc--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Pointer16MsType.java@@ -0,0 +1,84 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Pointer16MsType extends AbstractPointerMsType {++ public static final int PDB_ID = 0x0002;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public Pointer16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ underlyingTypeIndex = new TypeIndex16();+ memberPointerContainingClassIndex = new TypeIndex16();+ baseSymbol = new StringSt();+ name = new StringSt();+ }++ @Override+ protected void parsePointerBody(PdbByteReader reader) throws PdbException {+ parseAttributes(reader);+ underlyingTypeIndex.parse(reader);+ }++ @Override+ protected void parseAttributes(PdbByteReader reader) throws PdbException {+ int attributes1 = reader.parseUnsignedByteVal();+ int attributes2 = reader.parseUnsignedByteVal();+ pointerTypeAttribute = attributes1 & 0x001f;+ attributes1 >>= 5;+ pointerModeAttribute = attributes1 & 0x0007;++ isFlat = ((attributes2 & 0x0001) == 0x0001);+ attributes2 >>= 1;+ isVolatile = ((attributes2 & 0x0001) == 0x0001);+ attributes2 >>= 1;+ isConst = ((attributes2 & 0x0001) == 0x0001);+ attributes2 >>= 1;+ isUnaligned = ((attributes2 & 0x0001) == 0x0001);+ }++ @Override+ protected int getMySize() {+ return 2;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PointerMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PointerMsType.javanew file mode 100644index 0000000000..3ed7e81a14--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PointerMsType.java@@ -0,0 +1,154 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class PointerMsType extends AbstractPointerMsType {++ public static final int PDB_ID = 0x1002;++ private boolean isRestrict;+ private int size;+ private boolean isMocom;+ private boolean isLRef;+ private boolean isRRef;++ //TODO: There is a bit set beyond this in the following data+ //000000 74 00 00 00 4c 00 00 00 1c 49 00 00 00 00 f2 f1+ // The attributes long is 00 00 4c 00. The bit on the 4 is what is unknown.+ private boolean unk;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public PointerMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isRestrict() {+ return isRestrict;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isMocom() {+ return isMocom;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isLeftReference() {+ return isLRef;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isRightReference() {+ return isRRef;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isUnknownAttributes() {+ return unk;+ }++ @Override+ public int getSize() {+ return size;+ }++ @Override+ protected void create() {+ underlyingTypeIndex = new TypeIndex32();+ memberPointerContainingClassIndex = new TypeIndex32();+ baseSymbol = new StringNt();+ name = new StringNt();+ }++ @Override+ protected void parsePointerBody(PdbByteReader reader) throws PdbException {+ underlyingTypeIndex.parse(reader);+ parseAttributes(reader);+ }++ @Override+ protected void parseAttributes(PdbByteReader reader) throws PdbException {+ long attributes = reader.parseUnsignedIntVal();+ pointerTypeAttribute = (int) (attributes & 0x001f);+ attributes >>= 5;+ pointerModeAttribute = (int) (attributes & 0x0007);+ attributes >>= 3;++ isFlat = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ isVolatile = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ isConst = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ isUnaligned = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ isRestrict = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;++ size = (int) (attributes & 0x003f);+ attributes >>= 6;++ isMocom = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ isLRef = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ isRRef = ((attributes & 0x0001) == 0x0001);+ attributes >>= 1;+ unk = ((attributes & 0x0001) == 0x0001);+ }++ @Override+ protected int getMySize() {+ return 4;+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PrecompiledType16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PrecompiledType16MsType.javanew file mode 100644index 0000000000..f8fbb19f01--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PrecompiledType16MsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class PrecompiledType16MsType extends AbstractPrecompiledTypeMsType {++ public static final int PDB_ID = 0x0013;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public PrecompiledType16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ start = new TypeIndex16();+ name = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ start.parse(reader);+ count = reader.parseUnsignedShortVal();+ signature = reader.parseUnsignedIntVal();+ name.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PrecompiledTypeMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PrecompiledTypeMsType.javanew file mode 100644index 0000000000..3f432fbaa0--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PrecompiledTypeMsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class PrecompiledTypeMsType extends AbstractPrecompiledTypeMsType {++ public static final int PDB_ID = 0x1509;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public PrecompiledTypeMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ start = new TypeIndex32();+ name = new StringNt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ start.parse(reader);+ count = reader.parseInt();+ signature = reader.parseUnsignedIntVal();+ name.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PrecompiledTypeStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PrecompiledTypeStMsType.javanew file mode 100644index 0000000000..635e0d7127--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/PrecompiledTypeStMsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class PrecompiledTypeStMsType extends AbstractPrecompiledTypeMsType {++ public static final int PDB_ID = 0x100e;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public PrecompiledTypeStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ start = new TypeIndex32();+ name = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ start.parse(reader);+ count = reader.parseInt();+ signature = reader.parseUnsignedIntVal();+ name.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Procedure16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Procedure16MsType.javanew file mode 100644index 0000000000..58b7c6a4e6--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Procedure16MsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Procedure16MsType extends AbstractProcedureMsType {++ public static final int PDB_ID = 0x0008;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public Procedure16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ returnValueTypeIndex = new TypeIndex16();+ argListTypeIndex = new TypeIndex16();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ProcedureMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ProcedureMsType.javanew file mode 100644index 0000000000..26aa340b23--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ProcedureMsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ProcedureMsType extends AbstractProcedureMsType {++ public static final int PDB_ID = 0x1008;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public ProcedureMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ returnValueTypeIndex = new TypeIndex32();+ argListTypeIndex = new TypeIndex32();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ReferencedSymbolMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ReferencedSymbolMsType.javanew file mode 100644index 0000000000..b917fc0101--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/ReferencedSymbolMsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.symbol.AbstractMsSymbol;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class ReferencedSymbolMsType extends AbstractMsType {++ public static final int PDB_ID = 0x020c;++ //TODO: Need to see real data to implement correctly. Just guessing here. Not sure+ // if we should search all symbol records to find this "copy," if that is what it really is.+ private AbstractMsSymbol symbolRecord;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a string.+ */+ public ReferencedSymbolMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ int recordLength = reader.parseUnsignedShortVal();+ PdbByteReader recordReader = reader.getSubPdbByteReader(recordLength);+ symbolRecord = pdb.getSymbolParser().parse(recordReader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No documented "good" API for output.+ symbolRecord.emit(builder);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Skip16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Skip16MsType.javanew file mode 100644index 0000000000..d881f9d3b1--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Skip16MsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Skip16MsType extends AbstractSkipMsType {++ public static final int PDB_ID = 0x0200;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public Skip16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ nextValidTypeIndex = new TypeIndex16();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/SkipMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/SkipMsType.javanew file mode 100644index 0000000000..6fb14710eb--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/SkipMsType.java@@ -0,0 +1,55 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class SkipMsType extends AbstractSkipMsType {++ public static final int PDB_ID = 0x1200;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public SkipMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ nextValidTypeIndex = new TypeIndex32();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StaticMember16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StaticMember16MsType.javanew file mode 100644index 0000000000..c5e2d5ca5e--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StaticMember16MsType.java@@ -0,0 +1,61 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class StaticMember16MsType extends AbstractStaticMemberMsType {++ public static final int PDB_ID = 0x0407;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public StaticMember16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.skipPadding();+ }++ @Override+ protected void create() {+ fieldTypeRecordIndex = new TypeIndex16();+ name = new StringSt();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ fieldTypeRecordIndex.parse(reader);+ attribute = new ClassFieldMsAttributes(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StaticMemberMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StaticMemberMsType.javanew file mode 100644index 0000000000..76d857a507--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StaticMemberMsType.java@@ -0,0 +1,61 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class StaticMemberMsType extends AbstractStaticMemberMsType {++ public static final int PDB_ID = 0x150e;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public StaticMemberMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldTypeRecordIndex = new TypeIndex32();+ name = new StringNt();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ attribute = new ClassFieldMsAttributes(reader);+ fieldTypeRecordIndex.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StaticMemberStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StaticMemberStMsType.javanew file mode 100644index 0000000000..423061b3f2--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StaticMemberStMsType.java@@ -0,0 +1,61 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class StaticMemberStMsType extends AbstractStaticMemberMsType {++ public static final int PDB_ID = 0x1406;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public StaticMemberStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldTypeRecordIndex = new TypeIndex32();+ name = new StringSt();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ attribute = new ClassFieldMsAttributes(reader);+ fieldTypeRecordIndex.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StridedArrayMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StridedArrayMsType.javanew file mode 100644index 0000000000..3b814b116a--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StridedArrayMsType.java@@ -0,0 +1,76 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ * <P>+ * We decided to make this a derivation of {@link AbstractArrayMsType}. Could make it its own+ * if we decide to do that.+ * <P>+ * TODO: We are currently not outputting stride information--might need to create overloaded+ * method called by emit.+ */+public class StridedArrayMsType extends AbstractArrayMsType {++ public static final int PDB_ID = 0x1516;++ private long stride;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public StridedArrayMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ /**+ * Returns the size of the stride for this Strided Array.+ * @return Size of the stride.+ */+ public long getStride() {+ return stride;+ }++ @Override+ protected void create() {+ elementTypeIndex = new TypeIndex32();+ indexTypeIndex = new TypeIndex32();+ name = new StringNt();+ }++ @Override+ protected void parseExtraFields(PdbByteReader reader) throws PdbException {+ stride = reader.parseUnsignedIntVal();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StringIdMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StringIdMsType.javanew file mode 100644index 0000000000..f64c32a6f1--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StringIdMsType.java@@ -0,0 +1,78 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.CategoryIndex;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class StringIdMsType extends AbstractMsType {++ public static final int PDB_ID = 0x1605;++ private int idOfSubstringIDList;+ private String name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a string.+ */+ public StringIdMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ idOfSubstringIDList = reader.parseInt();+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.ITEM, idOfSubstringIDList));+ pdb.popDependencyStack();++ name = reader.parseNullTerminatedString();+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ //TODO: could be wrong (including how substrings are concatenated and added), but it+ // appears to work correctly like this.+ if (idOfSubstringIDList != 0) {+ AbstractMsType subStringList = pdb.getItemRecord(idOfSubstringIDList);+ if (!(subStringList instanceof SubstringListMsType)) {+ return; //fail quietly.+ }+ builder.append(subStringList);++ }+ // The API shows this as an else on the 'if' and I found a symbol which would get+ // truncated without this as a stand-alone statement. MSFT appears to be wrong+ // in their handling of the PDB here.+ // Example is from build1264_Z7/cn3.pdb in testPdbTPI800UsingAutoClose_1().+ builder.append(name);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Structure16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Structure16MsType.javanew file mode 100644index 0000000000..d5bfc6c566--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Structure16MsType.java@@ -0,0 +1,74 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ * <P>+ * Note that class, struct, and interface are very closed related and have many of the same+ * constructs and parsing procedures. However, they are separate. If any of the internals+ * of one of these is changed, it is highly suggested that the others be changed as well as+ * there is not code-shared between these other than by code duplication.+ */+public class Structure16MsType extends AbstractStructureMsType {++ public static final int PDB_ID = 0x0005;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public Structure16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex16();+ derivedFromListTypeIndex = new TypeIndex16(); // Can be zero if none.+ vShapeTableTypeIndex = new TypeIndex16();+ name = new StringSt();+ mangledName = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ //Different order+ count = reader.parseUnsignedShortVal();+ fieldDescriptorListTypeIndex.parse(reader);+ property = new MsProperty(reader);+ derivedFromListTypeIndex.parse(reader);+ vShapeTableTypeIndex.parse(reader);+ size = reader.parseNumeric();+ name.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StructureMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StructureMsType.javanew file mode 100644index 0000000000..6d62298881--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StructureMsType.java@@ -0,0 +1,96 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ * <P>+ * Note that class, struct, and interface are very closed related and have many of the same+ * constructs and parsing procedures. However, they are separate. If any of the internals+ * of one of these is changed, it is highly suggested that the others be changed as well as+ * there is not code-shared between these other than by code duplication.+ */+public class StructureMsType extends AbstractStructureMsType {++ public static final int PDB_ID = 0x1505;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public StructureMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex32();+ derivedFromListTypeIndex = new TypeIndex32(); // Can be zero if none.+ vShapeTableTypeIndex = new TypeIndex32();+ name = new StringNt();+ mangledName = new StringNt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ count = reader.parseUnsignedShortVal();+ property = new MsProperty(reader);+ fieldDescriptorListTypeIndex.parse(reader);+ derivedFromListTypeIndex.parse(reader);+ vShapeTableTypeIndex.parse(reader);+ //TODO: has more... guessing below+ size = reader.parseNumeric();+ if (reader.hasMoreNonPad()) {+ name.parse(reader);+ //System.out.println(name);+ if (reader.hasMoreNonPad()) {+ mangledName.parse(reader);+ //System.out.println(mangledName);+ }+ else if (reader.hasMore()) {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ }+ else {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ reader.skipPadding();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StructureStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StructureStMsType.javanew file mode 100644index 0000000000..3c38c0d144--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/StructureStMsType.java@@ -0,0 +1,96 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ * <P>+ * Note that class, struct, and interface are very closed related and have many of the same+ * constructs and parsing procedures. However, they are separate. If any of the internals+ * of one of these is changed, it is highly suggested that the others be changed as well as+ * there is not code-shared between these other than by code duplication.+ */+public class StructureStMsType extends AbstractStructureMsType {++ public static final int PDB_ID = 0x1005;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public StructureStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex32();+ derivedFromListTypeIndex = new TypeIndex32(); // Can be zero if none.+ vShapeTableTypeIndex = new TypeIndex32();+ name = new StringSt();+ mangledName = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ count = reader.parseUnsignedShortVal();+ property = new MsProperty(reader);+ fieldDescriptorListTypeIndex.parse(reader);+ derivedFromListTypeIndex.parse(reader);+ vShapeTableTypeIndex.parse(reader);+ //TODO: has more... guessing below+ size = reader.parseNumeric();+ if (reader.hasMoreNonPad()) {+ name.parse(reader);+ //System.out.println(name);+ if (reader.hasMoreNonPad()) {+ mangledName.parse(reader);+ //System.out.println(mangledName);+ }+ else if (reader.hasMore()) {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ }+ else {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ reader.skipPadding();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/SubstringListMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/SubstringListMsType.javanew file mode 100644index 0000000000..db9202765f--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/SubstringListMsType.java@@ -0,0 +1,75 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class SubstringListMsType extends AbstractMsType {++ public static final int PDB_ID = 0x1604;++ protected List<AbstractTypeIndex> typeIndexList = new ArrayList<>();++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public SubstringListMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ int count = reader.parseInt();+ for (int i = 0; i < count; i++) {+ AbstractTypeIndex itemIndex = new TypeIndex32();+ itemIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.ITEM, itemIndex.get()));+ pdb.popDependencyStack();+ typeIndexList.add(itemIndex);+ }+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ //TODO: could be wrong (including how substrings are concatenated and added).+ // See MSStringID as well.+ for (AbstractTypeIndex typeIndex : typeIndexList) {+ AbstractMsType type = pdb.getItemRecord(typeIndex.get());+ if (!(type instanceof StringIdMsType)) {+ return; //fail quietly.+ }+ builder.append(type);+ }+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/TypeServer2MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/TypeServer2MsType.javanew file mode 100644index 0000000000..1c8505e39c--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/TypeServer2MsType.java@@ -0,0 +1,64 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.app.util.datatype.microsoft.GUID;+import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class TypeServer2MsType extends AbstractMsType {++ public static final int PDB_ID = 0x1515;++ private GUID signature;+ private long age;+ private AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public TypeServer2MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ name = new StringNt();+ signature = reader.parseGUID();+ age = reader.parseUnsignedIntVal();+ name.parse(reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // There is no documented API.+ builder.append(+ String.format("<<%s %s %s %d>>", getClass().getSimpleName(), name, signature, age));+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/TypeServerMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/TypeServerMsType.javanew file mode 100644index 0000000000..c7ae183807--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/TypeServerMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringNt;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class TypeServerMsType extends AbstractTypeServerMsType {++ public static final int PDB_ID = 0x1501;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public TypeServerMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringNt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/TypeServerStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/TypeServerStMsType.javanew file mode 100644index 0000000000..ca2b9e67ef--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/TypeServerStMsType.java@@ -0,0 +1,54 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.StringSt;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class TypeServerStMsType extends AbstractTypeServerMsType {++ public static final int PDB_ID = 0x0016;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public TypeServerStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ name = new StringSt();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Union16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Union16MsType.javanew file mode 100644index 0000000000..649abbf61b--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/Union16MsType.java@@ -0,0 +1,64 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class Union16MsType extends AbstractUnionMsType {++ public static final int PDB_ID = 0x0006;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public Union16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex16();+ name = new StringSt();+ mangledName = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ count = reader.parseUnsignedShortVal();+ fieldDescriptorListTypeIndex.parse(reader);+ property = new MsProperty(reader);+ size = reader.parseNumeric();+ name.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UnionMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UnionMsType.javanew file mode 100644index 0000000000..bdf79c0904--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UnionMsType.java@@ -0,0 +1,86 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class UnionMsType extends AbstractUnionMsType {++ public static final int PDB_ID = 0x1506;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public UnionMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex32();+ name = new StringNt();+ mangledName = new StringNt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ count = reader.parseUnsignedShortVal();+ property = new MsProperty(reader);+ fieldDescriptorListTypeIndex.parse(reader);+ size = reader.parseNumeric();+ if (reader.hasMoreNonPad()) {+ name.parse(reader);+ //System.out.println(name);+ if (reader.hasMoreNonPad()) {+ mangledName.parse(reader);+ //System.out.println(mangledName);+ }+ else if (reader.hasMore()) {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ }+ else {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ reader.skipPadding();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UnionStMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UnionStMsType.javanew file mode 100644index 0000000000..545590b228--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UnionStMsType.java@@ -0,0 +1,86 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class UnionStMsType extends AbstractUnionMsType {++ public static final int PDB_ID = 0x1006;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public UnionStMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ fieldDescriptorListTypeIndex = new TypeIndex32();+ name = new StringSt();+ mangledName = new StringSt();+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ count = reader.parseUnsignedShortVal();+ property = new MsProperty(reader);+ fieldDescriptorListTypeIndex.parse(reader);+ size = reader.parseNumeric();+ if (reader.hasMoreNonPad()) {+ name.parse(reader);+ //System.out.println(name);+ if (reader.hasMoreNonPad()) {+ mangledName.parse(reader);+ //System.out.println(mangledName);+ }+ else if (reader.hasMore()) {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ }+ else {+ // The following code is for developmental investigations;+ // set break point on "int a = 1;" instead of a+ // conditional break point.+ int a = 1;+ a = a + 1;+ }+ reader.skipPadding();+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UserDefinedTypeModuleSourceAndLineMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UserDefinedTypeModuleSourceAndLineMsType.javanew file mode 100644index 0000000000..10bc056cdd--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UserDefinedTypeModuleSourceAndLineMsType.java@@ -0,0 +1,84 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class UserDefinedTypeModuleSourceAndLineMsType extends AbstractMsType {++ public static final int PDB_ID = 0x1607;++ private AbstractTypeIndex udtTypeIndex;+ private AbstractTypeIndex sourceFileNameStringOffset;+ private int lineNumber;+ private int module;++ // TODO: For continued work with hash.+ //public static Set<Integer> sourceIdIndexList = new HashSet<>();++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public UserDefinedTypeModuleSourceAndLineMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ udtTypeIndex = new TypeIndex32();+ sourceFileNameStringOffset = new TypeIndex32();++ udtTypeIndex.parse(reader);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, udtTypeIndex.get()));+ pdb.popDependencyStack();+ sourceFileNameStringOffset.parse(reader);+ lineNumber = reader.parseInt();+ module = reader.parseUnsignedShortVal();+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No good API.+ // TODO: Think their hash stuff might be superfluous... will see...+ // TODO: output module # for now. Might need name lookup later.+ builder.append(UserDefinedTypeModuleSourceAndLineMsType.class.getSimpleName());+ builder.append(", module: ");+ builder.append(module);+ builder.append(", line: ");+ builder.append(lineNumber);+ builder.append(", sourceFileName: ");+ // I believe the following is correct source of string. API unclear.+ builder.append(pdb.getNameStringFromOffset(sourceFileNameStringOffset.get()));+ builder.append(", type: ");+ builder.append(pdb.getTypeRecord(udtTypeIndex.get()));+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UserDefinedTypeSourceAndLineMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UserDefinedTypeSourceAndLineMsType.javanew file mode 100644index 0000000000..c3bd8dfbae--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/UserDefinedTypeSourceAndLineMsType.java@@ -0,0 +1,79 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class UserDefinedTypeSourceAndLineMsType extends AbstractMsType {++ public static final int PDB_ID = 0x1606;++ private AbstractTypeIndex udtTypeIndex;+ private AbstractTypeIndex sourceFileNameStringIdIndex;+ private int lineNumber;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public UserDefinedTypeSourceAndLineMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ udtTypeIndex = new TypeIndex32();+ sourceFileNameStringIdIndex = new TypeIndex32();++ udtTypeIndex.parse(reader);+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, udtTypeIndex.get()));+ pdb.popDependencyStack();+ sourceFileNameStringIdIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.ITEM, sourceFileNameStringIdIndex.get()));+ pdb.popDependencyStack();++ lineNumber = reader.parseInt();+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No good API.+ // TODO: Think their hash stuff might be superfluous... will see...+ builder.append(UserDefinedTypeSourceAndLineMsType.class.getSimpleName());+ builder.append(", line: ");+ builder.append(lineNumber);+ builder.append(", SourceFileNameStringIdIndex: ");+ builder.append(pdb.getItemRecord(sourceFileNameStringIdIndex.get()).toString());+ builder.append(", type: ");+ builder.append(pdb.getTypeRecord(udtTypeIndex.get()));+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VectorMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VectorMsType.javanew file mode 100644index 0000000000..9e88d90898--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VectorMsType.java@@ -0,0 +1,83 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.math.BigInteger;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VectorMsType extends AbstractMsType {++ public static final int PDB_ID = 0x151b;++ private AbstractTypeIndex elementTypeIndex;+ private long count;+ //TODO: not sure about the following.+ private BigInteger size;+ private AbstractString name;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public VectorMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ elementTypeIndex = new TypeIndex32();+ name = new StringNt();++ elementTypeIndex.parse(reader);+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, elementTypeIndex.get()));+ pdb.popDependencyStack();+ count = reader.parseUnsignedIntVal();+ //TODO: not sure about the following.+ size = reader.parseNumeric();+ name.parse(reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ /**+ * Returns the size of this vector type+ * @return Size of the vector.+ */+ public BigInteger getSize() {+ return size;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No API for this. Just outputting something that might be useful.+ // At this time, not doing anything with bind here; don't think it is warranted.+ builder.append(String.format("vector: %s[<%s> %d]", name.get(),+ pdb.getTypeRecord(elementTypeIndex.get()), count));+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualBaseClass16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualBaseClass16MsType.javanew file mode 100644index 0000000000..d0fd730127--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualBaseClass16MsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VirtualBaseClass16MsType extends AbstractVirtualBaseClassMsType {++ public static final int PDB_ID = 0x0401;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public VirtualBaseClass16MsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ protected void create() {+ directVirtualBaseClassTypeIndex = new TypeIndex16();+ virtualBasePointerTypeIndex = new TypeIndex16();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ directVirtualBaseClassTypeIndex.parse(reader);+ virtualBasePointerTypeIndex.parse(reader);+ attribute = new ClassFieldMsAttributes(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualBaseClassMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualBaseClassMsType.javanew file mode 100644index 0000000000..942902077f--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualBaseClassMsType.java@@ -0,0 +1,62 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VirtualBaseClassMsType extends AbstractVirtualBaseClassMsType {++ public static final int PDB_ID = 0x1401;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public VirtualBaseClassMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ directVirtualBaseClassTypeIndex = new TypeIndex32();+ virtualBasePointerTypeIndex = new TypeIndex32();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ attribute = new ClassFieldMsAttributes(reader);+ directVirtualBaseClassTypeIndex.parse(reader);+ virtualBasePointerTypeIndex.parse(reader);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTableMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTableMsType.javanew file mode 100644index 0000000000..63cbb9475a--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTableMsType.java@@ -0,0 +1,103 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.*;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.CategoryIndex;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VirtualFunctionTableMsType extends AbstractMsType {++ public static final int PDB_ID = 0x151d;++ private int ownerTypeIndex;+ private int baseVirtualFunctionTableTypeIndex;+ private int vfptrOffsetRelToObjectLayout;+ private int namesArrayLength;+ private String vftableName;+ private List<String> names = new ArrayList<>();++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException upon error parsing a field.+ */+ public VirtualFunctionTableMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ ownerTypeIndex = reader.parseInt();+ pdb.pushDependencyStack(new CategoryIndex(CategoryIndex.Category.DATA, ownerTypeIndex));+ pdb.popDependencyStack();+ baseVirtualFunctionTableTypeIndex = reader.parseInt();+ pdb.pushDependencyStack(+ new CategoryIndex(CategoryIndex.Category.DATA, baseVirtualFunctionTableTypeIndex));+ pdb.popDependencyStack();+ vfptrOffsetRelToObjectLayout = reader.parseInt();+ namesArrayLength = reader.parseInt();+ PdbByteReader namesReader = reader.getSubPdbByteReader(namesArrayLength);+ boolean first = true;+ while (namesReader.hasMore()) {+ String name = namesReader.parseNullTerminatedString();+ if (first) {+ first = false;+ vftableName = name;+ }+ else {+ names.add(name);+ }+ }+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ //No API.+ builder.append("VFTable for [");+ builder.append(pdb.getTypeRecord(ownerTypeIndex));+ builder.append("<vfptr_offset=");+ builder.append(vfptrOffsetRelToObjectLayout);+ builder.append(">");+ if (baseVirtualFunctionTableTypeIndex != 0) {+ builder.append(" : ");+ builder.append(pdb.getTypeRecord(baseVirtualFunctionTableTypeIndex));+ }+ builder.append("] ");+ builder.append(vftableName);+ builder.append(": {");++ DelimiterState ds = new DelimiterState("", ",");+ for (String name : names) {+ builder.append(ds.out(true, name)); // Method names.+ }+ builder.append("}");+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePath16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePath16MsType.javanew file mode 100644index 0000000000..778d35b1b8--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePath16MsType.java@@ -0,0 +1,60 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VirtualFunctionTablePath16MsType extends AbstractVirtualFunctionTablePathMsType {++ public static final int PDB_ID = 0x0012;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public VirtualFunctionTablePath16MsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ int count = reader.parseUnsignedShortVal();+ for (int i = 0; i < count; i++) {+ AbstractTypeIndex typeIndex = new TypeIndex16();+ typeIndex.parse(reader);+ bases.add(typeIndex);+ }++ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePathMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePathMsType.javanew file mode 100644index 0000000000..29d38a59a2--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePathMsType.java@@ -0,0 +1,60 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.*;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VirtualFunctionTablePathMsType extends AbstractVirtualFunctionTablePathMsType {++ public static final int PDB_ID = 0x100d;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public VirtualFunctionTablePathMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void parseFields(PdbByteReader reader) throws PdbException {+ int count = reader.parseInt();+ for (int i = 0; i < count; i++) {+ AbstractTypeIndex typeIndex = new TypeIndex32();+ typeIndex.parse(reader);+ bases.add(typeIndex);+ }++ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointer16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointer16MsType.javanew file mode 100644index 0000000000..07aa8339a2--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointer16MsType.java@@ -0,0 +1,61 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VirtualFunctionTablePointer16MsType extends AbstractVirtualFunctionTablePointerMsType {++ public static final int PDB_ID = 0x040a;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public VirtualFunctionTablePointer16MsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ pointerTypeIndex = new TypeIndex16();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) {+ // Do nothing.+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointerMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointerMsType.javanew file mode 100644index 0000000000..39d0b1a3c1--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointerMsType.java@@ -0,0 +1,61 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VirtualFunctionTablePointerMsType extends AbstractVirtualFunctionTablePointerMsType {++ public static final int PDB_ID = 0x1409;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public VirtualFunctionTablePointerMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ reader.align4();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ pointerTypeIndex = new TypeIndex32();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ reader.parseBytes(2); // Throw away 2 bytes.+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointerWithOffset16MsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointerWithOffset16MsType.javanew file mode 100644index 0000000000..26baca2a4e--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointerWithOffset16MsType.java@@ -0,0 +1,61 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex16;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VirtualFunctionTablePointerWithOffset16MsType+ extends AbstractVirtualFunctionTablePointerWithOffsetMsType {++ public static final int PDB_ID = 0x040d;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public VirtualFunctionTablePointerWithOffset16MsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ pointerTypeIndex = new TypeIndex16();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) {+ // Do nothing.+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointerWithOffsetMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointerWithOffsetMsType.javanew file mode 100644index 0000000000..9edc4ffd95--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VirtualFunctionTablePointerWithOffsetMsType.java@@ -0,0 +1,61 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.PdbByteReader;+import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.AbstractPdb;+import ghidra.pdb.pdbreader.TypeIndex32;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VirtualFunctionTablePointerWithOffsetMsType+ extends AbstractVirtualFunctionTablePointerWithOffsetMsType {++ public static final int PDB_ID = 0x140c;++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public VirtualFunctionTablePointerWithOffsetMsType(AbstractPdb pdb, PdbByteReader reader)+ throws PdbException {+ super(pdb, reader);+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ protected void create() {+ pointerTypeIndex = new TypeIndex32();+ }++ @Override+ protected void parseInitialFields(PdbByteReader reader) throws PdbException {+ reader.parseBytes(2); // padding+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VtShapeDescriptorMsProperty.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VtShapeDescriptorMsProperty.javanew file mode 100644index 0000000000..00b7739441--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VtShapeDescriptorMsProperty.java@@ -0,0 +1,131 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import ghidra.pdb.AbstractParsableItem;++/**+ * VTShape Descriptor Property used on VtShapeMsType PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VtShapeDescriptorMsProperty extends AbstractParsableItem {++ private static final int NEAR = 0;+ private static final int FAR = 1;+ private static final int THIN = 2;+ private static final int OUTER = 3;+ private static final int META = 4;+ private static final int NEAR32 = 5;+ private static final int FAR32 = 6;+ private static final int UNUSED = 7;++ private static final String[] VTS_STRING = new String[8];+ static {+ VTS_STRING[0] = "near";+ VTS_STRING[1] = "far";+ VTS_STRING[2] = "thin";+ VTS_STRING[3] = "outer";+ VTS_STRING[4] = "meta";+ VTS_STRING[5] = "near32";+ VTS_STRING[6] = "far32";+ VTS_STRING[7] = "";+ }++ //==============================================================================================+ private int value;++ //==============================================================================================+ /**+ * Constructor for the VtShapeDescriptorMsProperty+ * @param value Value of the property.+ */+ public VtShapeDescriptorMsProperty(int value) {+ this.value = value;+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isNear() {+ return (value == NEAR);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isFar() {+ return (value == FAR);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isThin() {+ return (value == THIN);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isOuter() {+ return (value == OUTER);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isMeta() {+ return (value == META);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isNear32() {+ return (value == NEAR32);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isFar32() {+ return (value == FAR32);+ }++ /**+ * Tells whether the property is true.+ * @return Truth about the property.+ */+ public boolean isUnused() {+ return (value >= UNUSED);+ }++ @Override+ public void emit(StringBuilder builder) {+ builder.append(VTS_STRING[value]);+ }++}diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VtShapeMsType.java b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VtShapeMsType.javanew file mode 100644index 0000000000..a88146ae73--- /dev/null+++ b/Ghidra/Features/PDB/src/main/java/ghidra/pdb/pdbreader/type/VtShapeMsType.java@@ -0,0 +1,82 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import java.util.ArrayList;+import java.util.List;++import ghidra.pdb.*;+import ghidra.pdb.pdbreader.AbstractPdb;++/**+ * A class for a specific PDB data type.+ * <P>+ * For more information about PDBs, consult the Microsoft PDB API, see+ * <a href="https://devblogs.microsoft.com/cppblog/whats-inside-a-pdb-file">+ * What's inside a PDB File</a>.+ */+public class VtShapeMsType extends AbstractMsType {++ public static final int PDB_ID = 0x000a;++ private int count; // Number of entries in the VFT.+ private List<VtShapeDescriptorMsProperty> descriptorList = new ArrayList<>();++ /**+ * Constructor for this type.+ * @param pdb {@link AbstractPdb} to which this type belongs.+ * @param reader {@link PdbByteReader} from which this type is deserialized.+ * @throws PdbException Upon not enough data left to parse.+ */+ public VtShapeMsType(AbstractPdb pdb, PdbByteReader reader) throws PdbException {+ super(pdb, reader);+ count = reader.parseUnsignedShortVal();+ int byteVal = 0;+ int value;+ // It seems that the upper nibble of the the byte is first and the lower nibble is+ // second; that is why we process as we do below (shifting for the first and masking+ // for the second).+ for (int i = 0; i < count; i++) {+ if (i % 2 == 0) {+ byteVal = reader.parseUnsignedByteVal();+ value = byteVal >> 4;+ }+ else {+ value = byteVal & 0x0f;+ }+ VtShapeDescriptorMsProperty descriptor = new VtShapeDescriptorMsProperty(value);+ descriptorList.add(descriptor);+ }+ reader.skipPadding();+ }++ @Override+ public int getPdbId() {+ return PDB_ID;+ }++ @Override+ public void emit(StringBuilder builder, Bind bind) {+ // No documented API for output.+ DelimiterState ds = new DelimiterState("", ",");+ builder.append("vtshape: {");+ for (VtShapeDescriptorMsProperty descriptor : descriptorList) {+ builder.append(ds.out(true, descriptor));+ }+ builder.append(")");+ }++}diff --git a/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyDatabaseInterface.java b/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyDatabaseInterface.javanew file mode 100644index 0000000000..863bde2e23--- /dev/null+++ b/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyDatabaseInterface.java@@ -0,0 +1,37 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++/**+ * This class is an extension of {@link DatabaseInterface}, whose sole purpose+ * is to allow for testing of internal components of {@link AbstractPdb} classes. It is not+ * part of the production PDB Reader.+ */+class DummyDatabaseInterface extends DatabaseInterface {++ //==============================================================================================+ // Package-Protected Internals+ //==============================================================================================+ /**+ * IMPORTANT: This method is for testing only. It allows us to set a basic object.+ * Note: not all values are initialized.+ * @param pdb The AbstractPdb foundation for the DatabaseInterface.+ */+ DummyDatabaseInterface(AbstractPdb pdb) {+ super(pdb, 0);+ }++}diff --git a/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyDatabaseInterfaceNew.java b/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyDatabaseInterfaceNew.javanew file mode 100644index 0000000000..4331cd5ba4--- /dev/null+++ b/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyDatabaseInterfaceNew.java@@ -0,0 +1,37 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++/**+ * This class is an extension of {@link DatabaseInterfaceNew}, whose sole purpose+ * is to allow for testing of internal components of {@link AbstractPdb} classes. It is not+ * part of the production PDB Reader.+ */+class DummyDatabaseInterfaceNew extends DatabaseInterfaceNew {++ //==============================================================================================+ // Package-Protected Internals+ //==============================================================================================+ /**+ * IMPORTANT: This method is for testing only. It allows us to set a basic object.+ * Note: not all values are initialized.+ * @param pdb The AbstractPdb foundation for the DatabaseInterface.+ */+ DummyDatabaseInterfaceNew(AbstractPdb pdb) {+ super(pdb, -1);+ }++}diff --git a/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyPdb700.java b/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyPdb700.javanew file mode 100644index 0000000000..e1ac046d2f--- /dev/null+++ b/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyPdb700.java@@ -0,0 +1,97 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++import java.io.IOException;++import ghidra.pdb.PdbException;+import ghidra.pdb.pdbreader.type.AbstractMsType;++/**+ * This class is an extension of {@link Pdb700}, based on {@link AbstractPdb}, whose sole purpose+ * is to allow for testing of internal components of {@link AbstractPdb} classes. It is not+ * part of the production PDB Reader.+ */+public class DummyPdb700 extends Pdb700 {++ //==============================================================================================+ // API+ //==============================================================================================+ /**+ * IMPORTANT: This method is for testing only. It allows us to set a basic object.+ * Note: not all values are initialized. Constructor for a dummy PDB used for testing.+ * @param tpiIndexMin int. The IndexMin to set/use for the TypeProgramInterface.+ * @param tpiIndexMaxExclusive int. MaxIndex+1 to set/use for the TypeProgramInterface.+ * @param ipiIndexMin int. The IndexMin to set/use for the ItemProgramInterface.+ * @param ipiIndexMaxExclusive int. MaxIndex+1 to set/use for the ItemProgramInterface.+ * @throws IOException Upon file IO seek/read issues.+ * @throws PdbException Upon unknown value for configuration or error in processing components.+ */+ public DummyPdb700(int tpiIndexMin, int tpiIndexMaxExclusive, int ipiIndexMin,+ int ipiIndexMaxExclusive) throws IOException, PdbException {+ super(null);+ typeProgramInterface =+ new DummyTypeProgramInterface800(this, tpiIndexMin, tpiIndexMaxExclusive);+ databaseInterface = new DummyDatabaseInterfaceNew(this);+ hasIdStream = true;+ itemProgramInterface =+ new DummyTypeProgramInterface800(this, ipiIndexMin, ipiIndexMaxExclusive);+ nameTable.forTestingOnlyAddOffsetNamePair(1, "NameTableTestString");+ }++ /**+ * IMPORTANT: This method is for testing only. It allows us to set a "type" record for a+ * particular record number.+ * @param recordNumber int record number for the "type" AbstractMsType to be inserted.+ * @param type AbstractMsType to be inserted.+ * @return boolean true if successful.+ */+ public boolean setTypeRecord(int recordNumber, AbstractMsType type) {+ return typeProgramInterface.setRecord(recordNumber, type);+ }++ /**+ * IMPORTANT: This method is for testing only. It allows us to add a "type" record that gets+ * its record number automatically assigned.+ * @param type "type" AbstractMsType to be inserted.+ * @return int record number assigned.+ */+ public int addTypeRecord(AbstractMsType type) {+ return typeProgramInterface.addRecord(type);+ }++ /**+ * IMPORTANT: This method is for testing only. It allows us to set a "item" record for a+ * particular record number.+ * @param recordNumber int record number for the "item" AbstractMsType to be inserted.+ * @param type AbstractMsType to be inserted.+ * @return boolean true if successful.+ */+ public boolean setItemRecord(int recordNumber, AbstractMsType type) {+ return itemProgramInterface.setRecord(recordNumber, type);+ }++ /**+ * IMPORTANT: This method is for testing only. It allows us to add a "item" record that gets+ * its record number automatically assigned.+ * @param type "item" AbstractMsType to be inserted.+ * @return int record number assigned.+ */+ public int addItemRecord(AbstractMsType type) {+ return itemProgramInterface.addRecord(type);+ }++}diff --git a/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyTypeProgramInterface800.java b/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyTypeProgramInterface800.javanew file mode 100644index 0000000000..5627920aab--- /dev/null+++ b/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/DummyTypeProgramInterface800.java@@ -0,0 +1,41 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader;++/**+ * This class is an extension of {@link TypeProgramInterface800}, whose sole purpose+ * is to allow for testing of internal components of {@link AbstractPdb} classes. It is not+ * part of the production PDB Reader.+ */+public class DummyTypeProgramInterface800 extends TypeProgramInterface800 {++ //==============================================================================================+ // Package-Protected Internals+ //==============================================================================================+ /**+ * IMPORTANT: This method is for testing only. It allows us to set a basic object.+ * Note: not all values are initialized.+ * @param pdb The AbstractPdb foundation for the DatabaseInterface.+ * @param typeIndexMin int. The IndexMin to set/use.+ * @param typeIndexMaxExclusive int. One greater than the MaxIndex to set/use+ */+ DummyTypeProgramInterface800(AbstractPdb pdb, int typeIndexMin, int typeIndexMaxExclusive) {+ super(pdb, -1);+ this.typeIndexMin = typeIndexMin;+ this.typeIndexMaxExclusive = typeIndexMaxExclusive;+ }++}diff --git a/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/type/TypesTest.java b/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/type/TypesTest.javanew file mode 100644index 0000000000..0893833c1e--- /dev/null+++ b/Ghidra/Features/PDB/src/test/java/ghidra/pdb/pdbreader/type/TypesTest.java@@ -0,0 +1,2640 @@+/* ###+ * IP: GHIDRA+ *+ * 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.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.pdb.pdbreader.type;++import static org.junit.Assert.*;++import java.math.BigInteger;++import org.junit.Test;++import generic.test.AbstractGenericTest;+import ghidra.pdb.*;+import ghidra.pdb.pdbreader.*;+import ghidra.pdb.pdbreader.symbol.RegisterMsSymbol;+import ghidra.util.Msg;++//TODO: not sure if ST variety should get putPadding() or putAlign()++public class TypesTest extends AbstractGenericTest {++ private static AbstractPdb pdb;+ // Important: Must also use this processorIndex value in any tests below that need it to+ // ensure consistency across the tests. We are setting it int the pdb here (in the static+ // assignment block), but we do not know the order that any tests are run, so having the+ // same value will ensure consistent results.+ private static final int processorIndex = 0x0000;+ private static int stringIdMsType1;+ private static int stringIdMsType2;+ private static int substringListMsType1;+ private static int referencedSymbolMsType1;+ private static int methodList16MsType1;+ private static int methodListMsType1;+ private static int vtShapeMsType1;+ private static TypeParser typeParser;+ static {+ try (DummyPdb700 dummyPdb700 = new DummyPdb700(4096, 4096, 4096, 4096)) {+ pdb = dummyPdb700;+ pdb.setTargetProcessorIndexNumber(processorIndex);++ typeParser = pdb.getTypeParser();+ AbstractMsType type;+ AbstractMsType item;+ PdbByteReader reader;+ // Create records that will be used indirectly+ type = new DummyMsType(pdb, null);+ item = new DummyMsType(pdb, null, "Item");++ //=================================+ // typeParser Records+ dummyPdb700.setTypeRecord(4096, type);++ reader = new PdbByteReader(createReferencedSymbolMsTypeBuffer());+ type = typeParser.parse(reader);+ referencedSymbolMsType1 = dummyPdb700.addTypeRecord(type);++ reader = new PdbByteReader(createMethodList16MsTypeBuffer());+ type = typeParser.parse(reader);+ methodList16MsType1 = dummyPdb700.addTypeRecord(type);++ reader = new PdbByteReader(createMethodListMsTypeBuffer());+ type = typeParser.parse(reader);+ methodListMsType1 = dummyPdb700.addTypeRecord(type);++ reader = new PdbByteReader(createVtShapeMsTypeBuffer());+ type = typeParser.parse(reader);+ vtShapeMsType1 = dummyPdb700.addTypeRecord(type);++ //=================================+ // IPI Records+ dummyPdb700.setItemRecord(4096, item);++ reader = new PdbByteReader(createStringIdMsTypeBuffer(0, "String1"));+ item = typeParser.parse(reader);+ stringIdMsType1 = dummyPdb700.addItemRecord(item);++ reader = new PdbByteReader(createStringIdMsTypeBuffer(0, "String2"));+ item = typeParser.parse(reader);+ stringIdMsType2 = dummyPdb700.addItemRecord(item);++ reader = new PdbByteReader(+ createSubstringListMsTypeBuffer(new int[] { stringIdMsType1, stringIdMsType2 }));+ item = typeParser.parse(reader);+ substringListMsType1 = dummyPdb700.addItemRecord(item);+ }+ catch (Exception e) {+ Msg.error(null, "Error in static initialization of test", e);+ assert false;+ }+ }++ //==============================================================================================+ //==============================================================================================+ //==============================================================================================+ @Test+ public void testMsProperty() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(0xffff);+ writer.putUnsignedShort(0x2400);+ writer.putUnsignedShort(0x6c00);+ writer.putUnsignedShort(0xb400);+ PdbByteReader reader = new PdbByteReader(writer.get());+ MsProperty property = new MsProperty(reader);+ String result = property.toString().trim();+ assertEquals("packed ctor ovlops isnested cnested opassign opcast fwdref scoped" ++ " hasuniquename sealed hfa(3) intrinsic interface", result);+ property = new MsProperty(reader);+ result = property.toString().trim();+ assertEquals("sealed intrinsic", result);+ property = new MsProperty(reader);+ result = property.toString().trim();+ assertEquals("sealed hfaFloat intrinsic ref", result);+ property = new MsProperty(reader);+ result = property.toString().trim();+ assertEquals("sealed hfaDouble intrinsic value", result);+ }++ @Test+ public void testFunctionMsAttributes() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ // C++-style return UDT, is constructor, is constructor with vbase class.+ writer.putUnsignedByte(0x07);+ PdbByteReader reader = new PdbByteReader(writer.get());+ FunctionMsAttributes attributes = new FunctionMsAttributes(reader);+ String result = attributes.toString().trim();+ assertEquals("return UDT (C++ style)|instance constructor|instance constructor of a" ++ " class with virtual base", result);+ }++ //==============================================================================================+ //==============================================================================================+ //==============================================================================================+ // Below is just a small sampling of PrimitiveMsType variations.+ @Test+ public void testPrimitiveMsType0000() {+ AbstractMsType type = pdb.getTypeRecord(0x0000);+ assertEquals(type instanceof PrimitiveMsType, true);+ String result = type.toString().trim();+ assertEquals("T_NOTYPE", result);+ }++ @Test+ public void testPrimitiveMsType0110() {+ AbstractMsType type = pdb.getTypeRecord(0x0110);+ assertEquals(type instanceof PrimitiveMsType, true);+ String result = type.toString().trim();+ assertEquals("signed char near*", result);+ }++ //==============================================================================================+ //==============================================================================================+ //==============================================================================================+ @Test+ public void testUnknownMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(0xffff);+ writer.putBytes(new byte[] { (byte) 0xfe, (byte) 0xfd, (byte) 0xfc }); // dummy data+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof UnknownMsType, true);+ String result = type.toString().trim();+ assertEquals("UNKNOWN_TYPE (0XFFFF): Bytes:\n" + "000000 fe fd fc", result);+ }++ @Test+ public void testBadMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Modifier16MsType.PDB_ID);+ writer.putUnsignedShort(0x07);+ // Incomplete record should cause BadMsType to be created.+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof BadMsType, true);+ String result = type.toString().trim();+ assertEquals("BAD_TYPE: ID=0X0001", result);+ }++ @Test+ public void testModifier16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Modifier16MsType.PDB_ID);+ writer.putUnsignedShort(0x07);+ writer.putUnsignedShort(4096);+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Modifier16MsType, true);+ String result = type.toString().trim();+ assertEquals("const volatile __unaligned DummyMsType", result);+ }++ @Test+ public void testModifierMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ModifierMsType.PDB_ID);+ writer.putInt(4096);+ writer.putUnsignedShort(0x07);+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ModifierMsType, true);+ String result = type.toString().trim();+ assertEquals("const volatile __unaligned DummyMsType", result);+ }++ @Test+ public void testPointer16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Pointer16MsType.PDB_ID);+ // pointer type = 9 = base(self)+ // pointer mode = 3 = MODE_MEMBER_FUNCTION_POINTER+ int attributes1 = (0x03 << 5) | 0x09;+ int attributes2 = 0x0f;+ writer.putUnsignedByte(attributes1);+ writer.putUnsignedByte(attributes2);+ writer.putUnsignedShort(4096); // Underlying type+ // Conditional stuff next+ writer.putUnsignedShort(4096); // Index of class containing pointer to member+ // member pointer format = 5 = pmf16_nearnvsa+ writer.putUnsignedShort(5);+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Pointer16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType flat ::* <pmf16_nearnvsa>const volatile DummyMsType", result);+ }++ @Test+ public void testPointerMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(PointerMsType.PDB_ID);+ writer.putInt(4096); // Underlying type+ // pointer type = 9 = base(self)+ // pointer mode = 3 = MODE_MEMBER_FUNCTION_POINTER+ // true for 0:32 pointer+ // true for volatile+ // true for const+ // true for unaligned+ // true for restricted+ // 4 = byte-size of pointer+ // false for MoCOM+ // true for & ref-qualifier+ // false for && ref-qualifier+ long attributes =+ (0 << 22) | (1 << 21) | (0 << 20) | (4 << 14) | (0x1f << 8) | (0x03 << 5) | 0x09;+ writer.putUnsignedInt(attributes);+ // Conditional stuff next+ writer.putInt(4096); // Index of class containing pointer to member+ // member pointer format = 5 = MEMBER_POINTER_FUNCTION_SINGLE_INHERITANCE+ writer.putUnsignedShort(5);+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof PointerMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType flat ::* <pmf16_nearnvsa>const volatile DummyMsType", result);+ }++ @Test+ public void testArray16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Array16MsType.PDB_ID);+ writer.putUnsignedShort(4096);+ writer.putUnsignedShort(4096);+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ writer.putByteLengthPrefixedString("name");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Array16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType [16<DummyMsType>]", result);+ }++ @Test+ public void testArrayStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ArrayStMsType.PDB_ID);+ writer.putUnsignedInt(4096);+ writer.putUnsignedInt(4096);+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ writer.putByteLengthPrefixedString("name");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ArrayStMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType [16<DummyMsType>]", result);+ }++ @Test+ public void testArrayMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ArrayMsType.PDB_ID);+ writer.putUnsignedInt(4096);+ writer.putUnsignedInt(4096);+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ writer.putNullTerminatedString("name");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ArrayMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType [16<DummyMsType>]", result);+ }++ @Test+ public void testStridedArrayMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(StridedArrayMsType.PDB_ID);+ writer.putUnsignedInt(4096);+ writer.putUnsignedInt(4096);+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ writer.putUnsignedInt(0x0002); // stride value.+ writer.putNullTerminatedString("name");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof StridedArrayMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType [16<DummyMsType>]", result);+ }++ @Test+ public void testClass16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Class16MsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the class.+ writer.putUnsignedShort(4096); // Type index of field descriptor list.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putUnsignedShort(4096); // If not zero, is type index of derived-from list+ writer.putUnsignedShort(vtShapeMsType1); // Type index of the VtShapeMsType (vshape table).+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // size of class.+ writer.putByteLengthPrefixedString("ClassName16");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Class16MsType, true);+ String result = type.toString().trim();+ assertEquals("class ClassName16<2,packed ctor>DummyMsType", result);+ }++ @Test+ public void testClassStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ClassStMsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the class.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putUnsignedInt(4096); // Type index of field descriptor list.+ writer.putUnsignedInt(4096); // If not zero, is type index of derived-from list+ writer.putUnsignedInt(vtShapeMsType1); // Type index of the VtShapeMsType (vshape table).+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // size of class.+ writer.putByteLengthPrefixedString("ClassNameSt");+ writer.putByteLengthPrefixedString("OtherNameSt");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ClassStMsType, true);+ String result = type.toString().trim();+ assertEquals("class ClassNameSt<2,packed ctor>DummyMsType", result);+ }++ @Test+ public void testClassMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ClassMsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the class.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putUnsignedInt(4096); // Type index of field descriptor list.+ writer.putUnsignedInt(4096); // If not zero, is type index of derived-from list+ writer.putUnsignedInt(vtShapeMsType1); // Type index of the VtShapeMsType (vshape table).+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // size of class.+ writer.putNullTerminatedString("ClassName");+ writer.putNullTerminatedString("OtherName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ClassMsType, true);+ String result = type.toString().trim();+ assertEquals("class ClassName<2,packed ctor>DummyMsType", result);+ }++ @Test+ public void testStructure16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Structure16MsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the structure.+ writer.putUnsignedShort(4096); // Type index of field descriptor list.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putUnsignedShort(4096); // If not zero, is type index of derived-from list+ writer.putUnsignedShort(vtShapeMsType1); // Type index of the VtShapeMsType (vshape table).+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // size of structure.+ writer.putByteLengthPrefixedString("StructureName16");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Structure16MsType, true);+ String result = type.toString().trim();+ assertEquals("struct StructureName16<2,packed ctor>DummyMsType", result);+ }++ @Test+ public void testStructureStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(StructureStMsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the structure.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putUnsignedInt(4096); // Type index of field descriptor list.+ writer.putUnsignedInt(4096); // If not zero, is type index of derived-from list+ writer.putUnsignedInt(vtShapeMsType1); // Type index of the VtShapeMsType (vshape table).+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // size of structure.+ writer.putByteLengthPrefixedString("StructureNameSt");+ writer.putByteLengthPrefixedString("OtherNameSt");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof StructureStMsType, true);+ String result = type.toString().trim();+ assertEquals("struct StructureNameSt<2,packed ctor>DummyMsType", result);+ }++ @Test+ public void testStructureMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(StructureMsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the structure.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putUnsignedInt(4096); // Type index of field descriptor list.+ writer.putUnsignedInt(4096); // If not zero, is type index of derived-from list+ writer.putUnsignedInt(vtShapeMsType1); // Type index of the VtShapeMsType (vshape table).+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // size of structure.+ writer.putNullTerminatedString("StructureName");+ writer.putNullTerminatedString("OtherName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof StructureMsType, true);+ String result = type.toString().trim();+ assertEquals("struct StructureName<2,packed ctor>DummyMsType", result);+ }++ @Test+ public void testInterfaceMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(InterfaceMsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the interface.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putUnsignedInt(4096); // Type index of field descriptor list.+ writer.putUnsignedInt(4096); // If not zero, is type index of derived-from list+ writer.putUnsignedInt(vtShapeMsType1); // Type index of the VtShapeMsType (vshape table).+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // size of interface.+ writer.putNullTerminatedString("InterfaceName");+ writer.putNullTerminatedString("OtherName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof InterfaceMsType, true);+ String result = type.toString().trim();+ assertEquals("interface InterfaceName<2,packed ctor>DummyMsType", result);+ }++ @Test+ public void testUnion16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Union16MsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the class.+ writer.putUnsignedShort(4096); // Type index of field descriptor list.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // size of class.+ writer.putByteLengthPrefixedString("UnionName16");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Union16MsType, true);+ String result = type.toString().trim();+ assertEquals("union UnionName16<2,packed ctor>DummyMsType", result);+ }++ @Test+ public void testUnionStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(UnionStMsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the class.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putUnsignedInt(4096); // Type index of field descriptor list.+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // size of class.+ writer.putByteLengthPrefixedString("UnionNameSt");+ writer.putByteLengthPrefixedString("OtherNameSt");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof UnionStMsType, true);+ String result = type.toString().trim();+ assertEquals("union UnionNameSt<2,packed ctor>DummyMsType", result);+ }++ @Test+ public void testUnionMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(UnionMsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the class.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putUnsignedInt(4096); // Type index of field descriptor list.+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // size of class.+ writer.putNullTerminatedString("UnionName");+ writer.putNullTerminatedString("OtherName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof UnionMsType, true);+ String result = type.toString().trim();+ assertEquals("union UnionName<2,packed ctor>DummyMsType", result);+ }++ @Test+ public void testEnum16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Enum16MsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the class.+ writer.putUnsignedShort(4096); // Underlying type index.+ writer.putUnsignedShort(4096); // Type index of field descriptor list.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putByteLengthPrefixedString("EnumName16");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Enum16MsType, true);+ String result = type.toString().trim();+ assertEquals("enum EnumName16<2,DummyMsType,packed ctor>DummyMsType", result);+ }++ @Test+ public void testEnumStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(EnumStMsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the class.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putUnsignedInt(4096); // Underlying type index.+ writer.putUnsignedInt(4096); // Type index of field descriptor list.+ writer.putByteLengthPrefixedString("EnumNameSt");+ writer.putByteLengthPrefixedString("OtherNameSt");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof EnumStMsType, true);+ String result = type.toString().trim();+ assertEquals("enum EnumNameSt<2,DummyMsType,packed ctor>DummyMsType", result);+ }++ @Test+ public void testEnumMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(EnumMsType.PDB_ID);+ writer.putUnsignedShort(2); // Count of number of elements in the class.+ byte[] propertyBuffer = createMsPropertyBuffer();+ writer.putBytes(propertyBuffer);+ writer.putUnsignedInt(4096); // Underlying type index.+ writer.putUnsignedInt(4096); // Type index of field descriptor list.+ writer.putNullTerminatedString("EnumName");+ writer.putNullTerminatedString("OtherName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof EnumMsType, true);+ String result = type.toString().trim();+ assertEquals("enum EnumName<2,DummyMsType,packed ctor>DummyMsType", result);+ }++ @Test+ public void testProcedure16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Procedure16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // Return type index.+ writer.putUnsignedByte(0x01); // Calling convention.+ byte[] attributesBuffer = createFunctionMsAttributesBuffer();+ writer.putBytes(attributesBuffer);+ writer.putUnsignedShort(2); // Number of parameters.+ writer.putUnsignedShort(4096); // Type index arguments list.+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Procedure16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType DummyMsType", result);+ }++ @Test+ public void testProcedureMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ProcedureMsType.PDB_ID);+ writer.putUnsignedInt(4096); // Return type index.+ writer.putUnsignedByte(0x01); // Calling convention.+ byte[] attributesBuffer = createFunctionMsAttributesBuffer();+ writer.putBytes(attributesBuffer);+ writer.putUnsignedShort(2); // Number of parameters.+ writer.putUnsignedInt(4096); // Type index of arguments list.+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ProcedureMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType DummyMsType", result);+ }++ @Test+ public void testMemberFunction16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(MemberFunction16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // Return type index.+ writer.putUnsignedShort(4096); // Class type index.+ writer.putUnsignedShort(4096); // "this" type index.+ writer.putUnsignedByte(0x01); // Calling convention.+ byte[] attributesBuffer = createFunctionMsAttributesBuffer();+ writer.putBytes(attributesBuffer);+ writer.putUnsignedShort(2); // Number of parameters.+ writer.putUnsignedShort(4096); // Type index arguments list.+ writer.putInt(0x08); // This adjuster.+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof MemberFunction16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType DummyMsType::DummyMsType<DummyMsType this,8,2,return UDT" ++ " (C++ style)|instance constructor|instance constructor of a class with" ++ " virtual base>", result);+ }++ @Test+ public void testMemberFunctionMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(MemberFunctionMsType.PDB_ID);+ writer.putUnsignedInt(4096); // Return type index.+ writer.putUnsignedInt(4096); // Class type index.+ writer.putUnsignedInt(4096); // "this" type index.+ writer.putUnsignedByte(0x01); // Calling convention.+ byte[] attributesBuffer = createFunctionMsAttributesBuffer();+ writer.putBytes(attributesBuffer);+ writer.putUnsignedShort(2); // Number of parameters.+ writer.putUnsignedInt(4096); // Type index of arguments list.+ writer.putInt(0x08); // This adjuster.+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof MemberFunctionMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType DummyMsType::DummyMsType<DummyMsType this,8,2,return UDT" ++ " (C++ style)|instance constructor|instance constructor of a class with" ++ " virtual base>", result);+ }++ @Test+ public void testVtShapeMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ byte[] vtShapeMsTypeBytes = createVtShapeMsTypeBuffer();+ writer.putBytes(vtShapeMsTypeBytes);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof VtShapeMsType, true);+ String result = type.toString().trim();+ assertEquals("vtshape: {near,far,thin,outer,meta,near32,far32)", result);+ }++ @Test+ public void testVirtualFunctionTableMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(VirtualFunctionTableMsType.PDB_ID);+ writer.putUnsignedInt(4096); // class/struct owner of vftable+ writer.putUnsignedInt(4096); // vftable from which this vftable is derived.+ writer.putUnsignedInt(8); // offset of vfptr to this table, relative to object layout+ PdbByteWriter namesWriter = new PdbByteWriter();+ namesWriter.putNullTerminatedString("tableName");+ namesWriter.putNullTerminatedString("methodName1");+ namesWriter.putNullTerminatedString("methodName2");+ writer.putAlign(2);+ byte[] namesBytes = namesWriter.get();+ writer.putUnsignedInt(namesBytes.length); // length of names array+ writer.putBytes(namesBytes);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof VirtualFunctionTableMsType, true);+ String result = type.toString().trim();+ assertEquals("VFTable for [DummyMsType<vfptr_offset=8> : DummyMsType] tableName:" ++ " {methodName1,methodName2}", result);+ }++ @Test+ public void testCobol016MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Cobol016MsType.PDB_ID);+ writer.putUnsignedShort(4096); // Parent type index.+ // TODO: This is made up data. API and examples are unknown.+ writer.putBytes(new byte[] { 0x03, 0x02, 0x01, 0x00 });+ //writer.putAlign(2); // TODO: Not sure+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Cobol016MsType, true);+ String result = type.toString().trim();+ assertEquals(+ "Cobol0MsType\n" + " parent type index: DummyMsType\n" + " additional data length: 4",+ result);+ }++ @Test+ public void testCobol0MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Cobol0MsType.PDB_ID);+ writer.putUnsignedInt(4096); // Parent type index.+ // TODO: This is made up data. API and examples are unknown.+ writer.putBytes(new byte[] { 0x03, 0x02, 0x01, 0x00 });+ writer.putAlign(2); // TODO: Not sure+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Cobol0MsType, true);+ String result = type.toString().trim();+ assertEquals(+ "Cobol0MsType\n" + " parent type index: DummyMsType\n" + " additional data length: 4",+ result);+ }++ @Test+ public void testCobol1MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Cobol1MsType.PDB_ID);+ // TODO: This is made up data. API and examples are unknown.+ writer.putBytes(new byte[] { 0x03, 0x02, 0x01, 0x00 });+ writer.putAlign(2); // TODO: Not sure+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Cobol1MsType, true);+ String result = type.toString().trim();+ assertEquals("Cobol1MsType\n" + " additional data length: 4", result);+ }++ @Test+ public void testBasicArray16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(BasicArray16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // Parent type index.+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof BasicArray16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType[]", result);+ }++ @Test+ public void testBasicArrayMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(BasicArrayMsType.PDB_ID);+ writer.putUnsignedInt(4096); // Parent type index.+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof BasicArrayMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType[]", result);+ }++ @Test+ public void testLabelMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(LabelMsType.PDB_ID);+ writer.putUnsignedShort(4); // 0 = NEAR; 4 = FAR addressing mode.+ writer.putAlign(2); // TODO: Not sure+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof LabelMsType, true);+ String result = type.toString().trim();+ assertEquals("<<LabelMsType far>>", result);+ }++ @Test+ public void testNullMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(NullMsType.PDB_ID);+ writer.putAlign(2); // TODO: Not sure+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof NullMsType, true);+ String result = type.toString().trim();+ assertEquals("<<NullMsType>>", result);+ }++ @Test+ public void testNotTranMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(NotTranMsType.PDB_ID);+ writer.putAlign(2); // TODO: Not sure+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof NotTranMsType, true);+ String result = type.toString().trim();+ assertEquals("<<NotTranMsType>>", result);+ }++ @Test+ public void testDimensionedArray16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DimensionedArray16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // Underlying type index.+ writer.putUnsignedShort(3); // Dimension information.+ writer.putByteLengthPrefixedString("name");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DimensionedArray16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType [<3>]", result);+ }++ @Test+ public void testDimensionedArrayStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DimensionedArrayStMsType.PDB_ID);+ writer.putUnsignedInt(4096); // Underlying type index.+ writer.putUnsignedInt(3); // Dimension information.+ writer.putByteLengthPrefixedString("name");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DimensionedArrayStMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType [<3>]", result);+ }++ @Test+ public void testDimensionedArrayMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DimensionedArrayMsType.PDB_ID);+ writer.putUnsignedInt(4096); // Underlying type index.+ writer.putUnsignedInt(3); // Dimension information.+ writer.putNullTerminatedString("name");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DimensionedArrayMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType [<3>]", result);+ }++ @Test+ public void testVirtualFunctionTablePath16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(VirtualFunctionTablePath16MsType.PDB_ID);+ writer.putUnsignedShort(2); // count+ writer.putUnsignedShort(4096); // a type index+ writer.putUnsignedShort(4096); // a type index+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof VirtualFunctionTablePath16MsType, true);+ String result = type.toString().trim();+ assertEquals("VFTPath: count=2\n" + " index[0]=4096\n" + " index[1]=4096", result);+ }++ @Test+ public void testVirtualFunctionTablePathMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(VirtualFunctionTablePathMsType.PDB_ID);+ writer.putInt(2); // count+ writer.putInt(4096); // a type index+ writer.putInt(4096); // a type index+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof VirtualFunctionTablePathMsType, true);+ String result = type.toString().trim();+ assertEquals("VFTPath: count=2\n" + " index[0]=4096\n" + " index[1]=4096", result);+ }++ @Test+ public void testPrecompiledType16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(PrecompiledType16MsType.PDB_ID);+ writer.putUnsignedShort(8192); // a "start" type index+ writer.putUnsignedShort(2); // count+ writer.putUnsignedInt(0xfedcba98L); // made-up signature+ writer.putByteLengthPrefixedString("filename");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof PrecompiledType16MsType, true);+ String result = type.toString().trim();+ assertEquals(+ "Precompiled: signature=0XFEDCBA98, name=filename, startTypeIndex=8192," + " count=2",+ result);+ }++ @Test+ public void testPrecompiledTypeStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(PrecompiledTypeStMsType.PDB_ID);+ writer.putInt(8192); // a "start" type index+ writer.putInt(2); // count+ writer.putUnsignedInt(0xfedcba98L); // made-up signature+ writer.putByteLengthPrefixedString("filename");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof PrecompiledTypeStMsType, true);+ String result = type.toString().trim();+ assertEquals(+ "Precompiled: signature=0XFEDCBA98, name=filename, startTypeIndex=8192," + " count=2",+ result);+ }++ @Test+ public void testPrecompiledTypeMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(PrecompiledTypeMsType.PDB_ID);+ writer.putInt(8192); // a "start" type index+ writer.putInt(2); // count+ writer.putUnsignedInt(0xfedcba98L); // made-up signature+ writer.putNullTerminatedString("filename");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof PrecompiledTypeMsType, true);+ String result = type.toString().trim();+ assertEquals(+ "Precompiled: signature=0XFEDCBA98, name=filename, startTypeIndex=8192," + " count=2",+ result);+ }++ @Test+ public void testEndPrecompiledTypeMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(EndPrecompiledTypeMsType.PDB_ID);+ writer.putUnsignedInt(0xfedcba98L); // made-up signature+ writer.putAlign(2); // TODO: Not sure+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof EndPrecompiledTypeMsType, true);+ String result = type.toString().trim();+ assertEquals("EndPrecompiled: signature=0XFEDCBA98", result);+ }++ @Test+ public void testOemDefinableString16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(OemDefinableString16MsType.PDB_ID);+ writer.putUnsignedShort(8192); // MSFT-assigned OEM identifier.+ writer.putUnsignedShort(8193); // OEM-assigned identifier.+ writer.putUnsignedShort(2); // count+ writer.putUnsignedShort(4096); // type index+ writer.putUnsignedShort(4096); // type index+ // TODO: what is OEM-defined data that should follow?+ writer.putBytes(new byte[] { 0x03, 0x02, 0x01, 0x00 });+ //writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof OemDefinableString16MsType, true);+ String result = type.toString().trim();+ assertEquals("OEM Definable String\n" + " MSFT-assigned OEM Identifier: 8192\n" ++ " OEM-assigned Identifier: 8193\n" + " count: 2\n" ++ " typeIndex[0]: 0x00001000\n" + " typeIndex[1]: 0x00001000\n" ++ " additional data length: 4", result);+ }++ @Test+ public void testOemDefinableStringMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(OemDefinableStringMsType.PDB_ID);+ writer.putUnsignedShort(8192); // MSFT-assigned OEM identifier.+ writer.putUnsignedShort(8193); // OEM-assigned identifier.+ writer.putInt(2); // count+ writer.putInt(4096); // type index+ writer.putInt(4096); // type index+ // TODO: what is OEM-defined data that should follow?+ writer.putBytes(new byte[] { 0x03, 0x02, 0x01, 0x00 });+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof OemDefinableStringMsType, true);+ String result = type.toString().trim();+ assertEquals("OEM Definable String\n" + " MSFT-assigned OEM Identifier: 8192\n" ++ " OEM-assigned Identifier: 8193\n" + " count: 2\n" ++ " typeIndex[0]: 0x00001000\n" + " typeIndex[1]: 0x00001000\n" ++ " additional data length: 4", result);+ }++ @Test+ public void testOemDefinableString2MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(OemDefinableString2MsType.PDB_ID);+ writer.putGUID(0x0c0d0e0f, (short) 0x0a0b, (short) 0x0809,+ new byte[] { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 });+ writer.putInt(2); // count+ writer.putInt(4096); // type index+ writer.putInt(4096); // type index+ // TODO: what is OEM-defined data that should follow?+ writer.putBytes(new byte[] { 0x03, 0x02, 0x01, 0x00 });+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof OemDefinableString2MsType, true);+ String result = type.toString().trim();+ assertEquals("OEM Definable String 2\n" + " GUID: 0c0d0e0f-0a0b-0809-0706-050403020100\n" ++ " count: 2\n" + " typeIndex[0]: 0x00001000\n" + " typeIndex[1]: 0x00001000\n" ++ " additional data length: 4", result);+ }++ @Test+ public void testTypeServerStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(TypeServerStMsType.PDB_ID);+ writer.putUnsignedInt(0xfedcba98); // signature+ writer.putUnsignedInt(1); // age+ writer.putByteLengthPrefixedString("serverSt");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof TypeServerStMsType, true);+ String result = type.toString().trim();+ assertEquals("<<TypeServerStMsType serverSt 0xfedcba98 1>>", result);+ }++ @Test+ public void testTypeServerMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(TypeServerMsType.PDB_ID);+ writer.putUnsignedInt(0xfedcba98); // signature+ writer.putUnsignedInt(1); // age+ writer.putNullTerminatedString("server");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof TypeServerMsType, true);+ String result = type.toString().trim();+ assertEquals("<<TypeServerMsType server 0xfedcba98 1>>", result);+ }++ @Test+ public void testTypeServer2MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(TypeServer2MsType.PDB_ID);+ writer.putGUID(0x0c0d0e0f, (short) 0x0a0b, (short) 0x0809,+ new byte[] { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 });+ writer.putUnsignedInt(1); // age+ writer.putNullTerminatedString("server");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof TypeServer2MsType, true);+ String result = type.toString().trim();+ assertEquals("<<TypeServer2MsType server 0c0d0e0f-0a0b-0809-0706-050403020100 1>>", result);+ }++ @Test+ public void testSkip16() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Skip16MsType.PDB_ID);+ writer.putUnsignedShort(8192); // next "valid" index+ // pad bytes (not sure how many to put--probably normal align.+ writer.putBytes(new byte[] { (byte) 0xf1, (byte) 0xf2 });+ //writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Skip16MsType, true);+ String result = type.toString().trim();+ assertEquals("Skip Record, nextValidTypeIndex = 0x2000, Length = 0x2", result);+ }++ @Test+ public void testSkipMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(SkipMsType.PDB_ID);+ writer.putInt(8192); // next "valid" index+ // pad bytes (not sure how many to put--probably normal align (zero here?).+ writer.putBytes(new byte[] { 0x03, 0x02, 0x01, 0x00 });+ //writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof SkipMsType, true);+ String result = type.toString().trim();+ assertEquals("Skip Record, nextValidTypeIndex = 0x2000, Length = 0x4", result);+ }++ @Test+ public void testArgumentsList16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ArgumentsList16MsType.PDB_ID);+ writer.putUnsignedShort(2); // Number of arguments.+ writer.putUnsignedShort(4096); // Type index of argument.+ writer.putUnsignedShort(4096); // Type index of argument.+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ArgumentsList16MsType, true);+ String result = type.toString().trim();+ assertEquals("(DummyMsType, DummyMsType)", result);+ }++ @Test+ public void testArgumentsListMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ArgumentsListMsType.PDB_ID);+ writer.putUnsignedInt(2); // Number of arguments.+ writer.putUnsignedInt(4096); // Type index of argument.+ writer.putUnsignedInt(4096); // Type index of argument.+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ArgumentsListMsType, true);+ String result = type.toString().trim();+ assertEquals("(DummyMsType, DummyMsType)", result);+ }++ @Test+ public void testSubstringListMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(SubstringListMsType.PDB_ID);+ writer.putUnsignedInt(2); // Number of elements.+ writer.putUnsignedInt(stringIdMsType1); // Type index of element.+ writer.putUnsignedInt(stringIdMsType2); // Type index of element.+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof SubstringListMsType, true);+ String result = type.toString().trim();+ assertEquals("String1String2", result);+ }++ @Test+ public void testStringIdMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(StringIdMsType.PDB_ID);+ // Type index of SubStringListMsType (or 0 if not needed)+ writer.putUnsignedInt(substringListMsType1);+ writer.putNullTerminatedString("TailOfString");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof StringIdMsType, true);+ String result = type.toString().trim();+ assertEquals("String1String2TailOfString", result);+ }++ @Test+ public void testDefaultArguments16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DefaultArguments16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of expression type.+ writer.putByteLengthPrefixedString("expression");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DefaultArguments16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType expression", result);+ }++ @Test+ public void testDefaultArgumentsStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DefaultArgumentsStMsType.PDB_ID);+ writer.putUnsignedInt(4096); // type index of expression type.+ writer.putByteLengthPrefixedString("expression");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DefaultArgumentsStMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType expression", result);+ }++ @Test+ public void testDefaultArgumentsMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DefaultArgumentsMsType.PDB_ID);+ writer.putUnsignedInt(4096); // type index of expression type.+ writer.putNullTerminatedString("expression");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DefaultArgumentsMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType expression", result);+ }++ @Test+ public void testListMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ListMsType.PDB_ID);+ writer.putUnsignedByte(0x41);+ //writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ListMsType, true);+ String result = type.toString().trim();+ assertEquals("<<ListMsType dataLength=1>>", result);+ }++ @Test+ public void testFieldList16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(FieldList16MsType.PDB_ID);+ byte[] baseClass16MsTypeBytes = createBaseClass16MsTypeBuffer();+ byte[] member16MsTypeBytes = createMember16MsTypeBuffer();+ writer.putBytes(baseClass16MsTypeBytes);+ writer.putPadding(0); // Records in FieldList align on their own basis+ writer.putBytes(baseClass16MsTypeBytes);+ writer.putPadding(0); // Records in FieldList align on their own basis+ writer.putBytes(member16MsTypeBytes);+ writer.putPadding(0); // Records in FieldList align on their own basis+ writer.putBytes(member16MsTypeBytes);+ writer.putPadding(0); // Records in FieldList align on their own basis+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof FieldList16MsType, true);+ String result = type.toString().trim();+ assertEquals(": public static<pseudo, noinherit, noconstruct>:DummyMsType<@16>, public" ++ " static<pseudo, noinherit, noconstruct>:DummyMsType<@16> {public static<pseudo," ++ " noinherit, noconstruct>: DummyMsType memberName<@16>,public static<pseudo," ++ " noinherit, noconstruct>: DummyMsType memberName<@16>}", result);+ }++ @Test+ public void testFieldListMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(FieldListMsType.PDB_ID);+ byte[] baseClassMsTypeBytes = createBaseClassMsTypeBuffer();+ byte[] memberMsTypeBytes = createMemberMsTypeBuffer();+ writer.putBytes(baseClassMsTypeBytes);+ writer.putPadding(0); // Records in FieldList align on their own basis+ writer.putBytes(baseClassMsTypeBytes);+ writer.putPadding(0); // Records in FieldList align on their own basis+ writer.putBytes(memberMsTypeBytes);+ writer.putPadding(0); // Records in FieldList align on their own basis+ writer.putBytes(memberMsTypeBytes);+ writer.putPadding(0); // Records in FieldList align on their own basis+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof FieldListMsType, true);+ String result = type.toString().trim();+ assertEquals(": public static<pseudo, noinherit, noconstruct>:DummyMsType<@16>, public" ++ " static<pseudo, noinherit, noconstruct>:DummyMsType<@16> {public static<pseudo," ++ " noinherit, noconstruct>: DummyMsType memberName<@16>,public static<pseudo," ++ " noinherit, noconstruct>: DummyMsType memberName<@16>}", result);+ }++ @Test+ public void testDerivedClassList16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DerivedClassList16MsType.PDB_ID);+ writer.putUnsignedShort(2); // count+ writer.putUnsignedShort(4096); // type index+ writer.putUnsignedShort(4096); // type index+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DerivedClassList16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType, DummyMsType", result);+ }++ @Test+ public void testDerivedClassListMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DerivedClassListMsType.PDB_ID);+ writer.putUnsignedInt(2); // count+ writer.putUnsignedInt(4096); // type index+ writer.putUnsignedInt(4096); // type index+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DerivedClassListMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType, DummyMsType", result);+ }++ @Test+ public void testBitfield16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Bitfield16MsType.PDB_ID);+ writer.putUnsignedByte(2); // length+ writer.putUnsignedByte(2); // position+ writer.putUnsignedShort(4096); // type index+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Bitfield16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType : 2 <@2>", result);+ }++ @Test+ public void testBitfieldMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(BitfieldMsType.PDB_ID);+ writer.putUnsignedInt(4096); // type index+ writer.putUnsignedByte(2); // length+ writer.putUnsignedByte(2); // position+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof BitfieldMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType : 2 <@2>", result);+ }++ @Test+ public void testMethodList16MsType() throws PdbException {+ PdbByteReader reader = new PdbByteReader(createMethodList16MsTypeBuffer());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof MethodList16MsType, true);+ String result = type.toString().trim();+ assertEquals("{<public static<pseudo, noinherit, noconstruct>: DummyMsType>,<public" ++ " <intro><pseudo, noinherit, noconstruct>: DummyMsType,8>}", result);++ }++ @Test+ public void testMethodListMsType() throws PdbException {+ PdbByteReader reader = new PdbByteReader(createMethodListMsTypeBuffer());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof MethodListMsType, true);+ String result = type.toString().trim();+ assertEquals("{<public static<pseudo, noinherit, noconstruct>: DummyMsType>,<public" ++ " <intro><pseudo, noinherit, noconstruct>: DummyMsType,8>}", result);+ }++ @Test+ public void testDimensionedArrayConstBoundsUpper16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DimensionedArrayConstBoundsUpper16MsType.PDB_ID);+ writer.putUnsignedShort(2); // rank+ writer.putUnsignedShort(4096); // type index+ // dimData is dummy data for now. TODO: figure out and fix.+ writer.putBytes(new byte[] { 0x02, 0x03 });+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DimensionedArrayConstBoundsUpper16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType[0:2][0:3]", result);++ }++ @Test+ public void testDimensionedArrayConstBoundsUpperMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DimensionedArrayConstBoundsUpperMsType.PDB_ID);+ writer.putInt(4096); // type index+ writer.putUnsignedShort(2); // rank+ // dimData is dummy data for now. TODO: figure out and fix.+ writer.putBytes(new byte[] { 0x02, 0x03 });+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DimensionedArrayConstBoundsUpperMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType[0:2][0:3]", result);+ }++ @Test+ public void testDimensionedArrayConstBoundsLowerUpper16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DimensionedArrayConstBoundsLowerUpper16MsType.PDB_ID);+ writer.putUnsignedShort(2); // rank+ writer.putUnsignedShort(4096); // type index+ // dimData is dummy data for now. TODO: figure out and fix.+ writer.putBytes(new byte[] { 0x00, 0x01, 0x02, 0x03 });+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DimensionedArrayConstBoundsLowerUpper16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType[0:1][2:3]", result);++ }++ @Test+ public void testDimensionedArrayConstBoundsLowerUpperMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DimensionedArrayConstBoundsLowerUpperMsType.PDB_ID);+ writer.putInt(4096); // type index+ writer.putUnsignedShort(2); // rank+ // dimData is dummy data for now. TODO: figure out and fix.+ writer.putBytes(new byte[] { 0x00, 0x01, 0x02, 0x03 });+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DimensionedArrayConstBoundsLowerUpperMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType[0:1][2:3]", result);+ }++ @Test+ public void testDimensionedArrayVarBoundsUpper16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DimensionedArrayVarBoundsUpper16MsType.PDB_ID);+ writer.putUnsignedShort(2); // rank+ writer.putUnsignedShort(4096); // type index+ writer.putUnsignedShort(referencedSymbolMsType1); // dim 0 upper type+ writer.putUnsignedShort(3); // dim 1 upper primitive type "void"+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DimensionedArrayVarBoundsUpper16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType[0:REGISTER: al, Type: DummyMsType, registerSymbolName][0:void]",+ result);++ }++ @Test+ public void testDimensionedArrayVarBoundsUpperMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DimensionedArrayVarBoundsUpperMsType.PDB_ID);+ writer.putInt(2); // rank+ writer.putInt(4096); // type index+ writer.putInt(referencedSymbolMsType1); // dim 0 upper type+ writer.putInt(3); // dim 1 upper primitive type "void"+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DimensionedArrayVarBoundsUpperMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType[0:REGISTER: al, Type: DummyMsType, registerSymbolName][0:void]",+ result);+ }++ @Test+ public void testDimensionedArrayVarBoundsLowerUpper16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DimensionedArrayVarBoundsLowerUpper16MsType.PDB_ID);+ writer.putUnsignedShort(2); // rank+ writer.putUnsignedShort(4096); // type index+ writer.putUnsignedShort(referencedSymbolMsType1); // dim 0 lower type+ writer.putUnsignedShort(3); // dim 0 upper primitive type "void"+ writer.putUnsignedShort(3); // dim 1 lower primitive type "void"+ writer.putUnsignedShort(referencedSymbolMsType1); // dim 1 upper type+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DimensionedArrayVarBoundsLowerUpper16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType[REGISTER: al, Type: DummyMsType, registerSymbolName:void]" ++ "[void:REGISTER: al, Type: DummyMsType, registerSymbolName]", result);+ }++ @Test+ public void testDimensionedArrayVarBoundsLowerUpperMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(DimensionedArrayVarBoundsLowerUpperMsType.PDB_ID);+ writer.putInt(2); // rank+ writer.putInt(4096); // type index+ writer.putInt(referencedSymbolMsType1); // dim 0 lower type+ writer.putInt(3); // dim 0 upper primitive type "void"+ writer.putInt(3); // dim 1 lower primitive type "void"+ writer.putInt(referencedSymbolMsType1); // dim 1 upper type+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof DimensionedArrayVarBoundsLowerUpperMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType[REGISTER: al, Type: DummyMsType, registerSymbolName:void]" ++ "[void:REGISTER: al, Type: DummyMsType, registerSymbolName]", result);+ }++ @Test+ public void testReferencedSymbolMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ byte[] symbolBytes = createReferencedSymbolMsTypeBuffer();+ writer.putBytes(symbolBytes);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ReferencedSymbolMsType, true);+ String result = type.toString().trim();+ assertEquals("REGISTER: al, Type: DummyMsType, registerSymbolName", result);+ }++ @Test+ public void testBaseClass16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ byte[] symbolBytes = createBaseClass16MsTypeBuffer();+ writer.putBytes(symbolBytes);+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof BaseClass16MsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>:DummyMsType<@16>", result);+ }++ @Test+ public void testBaseClassMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ byte[] symbolBytes = createBaseClassMsTypeBuffer();+ writer.putBytes(symbolBytes);+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof BaseClassMsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>:DummyMsType<@16>", result);+ }++ @Test+ public void testBaseInterfaceMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(BaseInterfaceMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // type index of base class+ writer.putNumeric(new BigInteger("10", 16), 0x8002); //offset of base class within class+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof BaseInterfaceMsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>:DummyMsType<@16>", result);+ }++ @Test+ public void testVirtualBaseClass16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(VirtualBaseClass16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of direct virtual base class+ writer.putUnsignedShort(4096); // type index of virtual base class+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ // Offset of virtual base pointer from address point+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ // Offset of virtual base from vbtable.+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof VirtualBaseClass16MsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>: < DummyMsType vbp;" ++ " offVbp=16; offVbte=16; >", result);+ }++ @Test+ public void testVirtualBaseClassMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(VirtualBaseClassMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // type index of direct virtual base class+ writer.putInt(4096); // type index of virtual base class+ // Offset of virtual base pointer from address point+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ // Offset of virtual base from vbtable.+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof VirtualBaseClassMsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>: < DummyMsType vbp;" ++ " offVbp=16; offVbte=16; >", result);+ }++ @Test+ public void testIndirectVirtualBaseClass16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(IndirectVirtualBaseClass16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of direct virtual base class+ writer.putUnsignedShort(4096); // type index of virtual base class+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ // Offset of virtual base pointer from address point+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ // Offset of virtual base from vbtable.+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof IndirectVirtualBaseClass16MsType, true);+ String result = type.toString().trim();+ assertEquals("<indirect public static<pseudo, noinherit, noconstruct>: DummyMsType vbp;" ++ " offVbp=16; offVbte=16; >", result);+ }++ @Test+ public void testIndirectVirtualBaseClassMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(IndirectVirtualBaseClassMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // type index of direct virtual base class+ writer.putInt(4096); // type index of virtual base class+ // Offset of virtual base pointer from address point+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ // Offset of virtual base from vbtable.+ writer.putNumeric(new BigInteger("10", 16), 0x8002);+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof IndirectVirtualBaseClassMsType, true);+ String result = type.toString().trim();+ assertEquals("<indirect public static<pseudo, noinherit, noconstruct>: DummyMsType vbp;" ++ " offVbp=16; offVbte=16; >", result);+ }++ @Test+ public void testEnumerateStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(EnumerateStMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // Value+ writer.putByteLengthPrefixedString("enumerateName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof EnumerateStMsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>: enumerateName=16", result);+ }++ @Test+ public void testEnumerateMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(EnumerateMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // Value+ writer.putNullTerminatedString("enumerateName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof EnumerateMsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>: enumerateName=16", result);+ }++ @Test+ public void testFriendFunction16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(FriendFunction16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of friend function.+ writer.putByteLengthPrefixedString("friendFunctionName");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof FriendFunction16MsType, true);+ String result = type.toString().trim();+ // TODO: probably need a type other than 4096... need something that emits like a function.+ assertEquals("friend: DummyMsType friendFunctionName", result);+ }++ @Test+ public void testFriendFunctionStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(FriendFunctionStMsType.PDB_ID);+ writer.putBytes(new byte[] { 0x00, 0x00 }); // padding+ writer.putInt(4096); // type index of friend function.+ writer.putByteLengthPrefixedString("friendFunctionName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof FriendFunctionStMsType, true);+ String result = type.toString().trim();+ // TODO: probably need a type other than 4096... need something that emits like a function.+ assertEquals("friend: DummyMsType friendFunctionName", result);+ }++ @Test+ public void testFriendFunctionMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(FriendFunctionMsType.PDB_ID);+ writer.putBytes(new byte[] { 0x00, 0x00 }); // padding+ writer.putInt(4096); // type index of friend function.+ writer.putNullTerminatedString("friendFunctionName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof FriendFunctionMsType, true);+ String result = type.toString().trim();+ // TODO: probably need a type other than 4096... need something that emits like a function.+ assertEquals("friend: DummyMsType friendFunctionName", result);+ }++ @Test+ public void testIndex16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Index16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of friend function.+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Index16MsType, true);+ assertEquals(((Index16MsType) type).getReferencedIndex(), 4096);+ }++ @Test+ public void testIndexMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(IndexMsType.PDB_ID);+ writer.putBytes(new byte[] { 0x00, 0x00 }); // padding+ writer.putInt(4096); // type index of friend function.+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof IndexMsType, true);+ assertEquals(((AbstractIndexMsType) type).getReferencedIndex(), 4096);+ }++ @Test+ public void testMember16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ byte[] symbolBytes = createMember16MsTypeBuffer();+ writer.putBytes(symbolBytes);+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof Member16MsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>: DummyMsType memberName<@16>",+ result);+ }++ @Test+ public void testMemberStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ byte[] symbolBytes = createMemberStMsTypeBuffer();+ writer.putBytes(symbolBytes);+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof MemberStMsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>: DummyMsType memberName<@16>",+ result);+ }++ @Test+ public void testMemberMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ byte[] symbolBytes = createMemberMsTypeBuffer();+ writer.putBytes(symbolBytes);+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof MemberMsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>: DummyMsType memberName<@16>",+ result);+ }++ @Test+ public void testStaticMember16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(StaticMember16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of field.+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putByteLengthPrefixedString("staticMemberName");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof StaticMember16MsType, true);+ String result = type.toString().trim();+ assertEquals(+ "public static<pseudo, noinherit, noconstruct>: DummyMsType" + " staticMemberName",+ result);+ }++ @Test+ public void testStaticMemberStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(StaticMemberStMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // type index of field.+ writer.putByteLengthPrefixedString("staticMemberName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof StaticMemberStMsType, true);+ String result = type.toString().trim();+ assertEquals(+ "public static<pseudo, noinherit, noconstruct>: DummyMsType" + " staticMemberName",+ result);+ }++ @Test+ public void testStaticMemberMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(StaticMemberMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // type index of field.+ writer.putNullTerminatedString("staticMemberName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof StaticMemberMsType, true);+ String result = type.toString().trim();+ assertEquals(+ "public static<pseudo, noinherit, noconstruct>: DummyMsType" + " staticMemberName",+ result);+ }++ @Test+ public void testOverloadedMethod16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(OverloadedMethod16MsType.PDB_ID);+ int count =+ ((AbstractMethodListMsType) pdb.getTypeRecord(methodList16MsType1)).getListSize();+ writer.putUnsignedShort(count);+ writer.putUnsignedShort(methodList16MsType1); // type index of MethodList16MsType+ writer.putByteLengthPrefixedString("overloadedMethodName");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof OverloadedMethod16MsType, true);+ String result = type.toString().trim();+ assertEquals("overloaded[2]:overloadedMethodName{<public static<pseudo, noinherit," ++ " noconstruct>: DummyMsType>,<public <intro><pseudo, noinherit, noconstruct>:" ++ " DummyMsType,8>}", result);+ }++ @Test+ public void testOverloadedMethodStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(OverloadedMethodStMsType.PDB_ID);+ int count = ((AbstractMethodListMsType) pdb.getTypeRecord(methodListMsType1)).getListSize();+ writer.putUnsignedShort(count);+ writer.putInt(methodListMsType1); // type index of MethodListMsType+ writer.putByteLengthPrefixedString("overloadedMethodName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof OverloadedMethodStMsType, true);+ String result = type.toString().trim();+ assertEquals("overloaded[2]:overloadedMethodName{<public static<pseudo, noinherit," ++ " noconstruct>: DummyMsType>,<public <intro><pseudo, noinherit, noconstruct>:" ++ " DummyMsType,8>}", result);+ }++ @Test+ public void testOverloadedMethodMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(OverloadedMethodMsType.PDB_ID);+ int count = ((AbstractMethodListMsType) pdb.getTypeRecord(methodListMsType1)).getListSize();+ writer.putUnsignedShort(count);+ writer.putInt(methodListMsType1); // type index of MethodListMsType+ writer.putNullTerminatedString("overloadedMethodName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof OverloadedMethodMsType, true);+ String result = type.toString().trim();+ assertEquals("overloaded[2]:overloadedMethodName{<public static<pseudo, noinherit," ++ " noconstruct>: DummyMsType>,<public <intro><pseudo, noinherit, noconstruct>:" ++ " DummyMsType,8>}", result);+ }++ @Test+ public void testNestedType16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(NestedType16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of nested type+ writer.putByteLengthPrefixedString("nestedTypeName");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof NestedType16MsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType nestedTypeName", result);+ }++ @Test+ public void testNestedTypeStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(NestedTypeStMsType.PDB_ID);+ writer.putBytes(new byte[] { 0x00, 0x00 }); // padding+ writer.putInt(4096); // type index of nested type+ writer.putByteLengthPrefixedString("nestedTypeName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof NestedTypeStMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType nestedTypeName", result);+ }++ @Test+ public void testNestedTypeMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(NestedTypeMsType.PDB_ID);+ writer.putBytes(new byte[] { 0x00, 0x00 }); // padding+ writer.putInt(4096); // type index of nested type+ writer.putNullTerminatedString("nestedTypeName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof NestedTypeMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType nestedTypeName", result);+ }++ @Test+ public void testNestedTypeExtStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(NestedTypeExtStMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // type index of nested type+ writer.putByteLengthPrefixedString("nestedTypeExtName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof NestedTypeExtStMsType, true);+ String result = type.toString().trim();+ assertEquals(+ "public static<pseudo, noinherit, noconstruct>:" + " DummyMsType nestedTypeExtName",+ result);+ }++ @Test+ public void testNestedTypeExtMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(NestedTypeExtMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // type index of nested type+ writer.putNullTerminatedString("nestedTypeExtName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof NestedTypeExtMsType, true);+ String result = type.toString().trim();+ assertEquals(+ "public static<pseudo, noinherit, noconstruct>:" + " DummyMsType nestedTypeExtName",+ result);+ }++ @Test+ public void testVirtualFunctionTablePointer16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(VirtualFunctionTablePointer16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of pointer+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof VirtualFunctionTablePointer16MsType, true);+ String result = type.toString().trim();+ assertEquals("VFTablePtr: DummyMsType", result);+ }++ @Test+ public void testVirtualFunctionTablePointerMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(VirtualFunctionTablePointerMsType.PDB_ID);+ writer.putBytes(new byte[] { 0x00, 0x00 }); // padding+ writer.putInt(4096); // type index of pointer+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof VirtualFunctionTablePointerMsType, true);+ String result = type.toString().trim();+ assertEquals("VFTablePtr: DummyMsType", result);+ }++ @Test+ public void testFriendClass16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(FriendClass16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of pointer+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof FriendClass16MsType, true);+ String result = type.toString().trim();+ assertEquals("friend: DummyMsType", result);+ }++ @Test+ public void testFriendClassMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(FriendClassMsType.PDB_ID);+ writer.putBytes(new byte[] { 0x00, 0x00 }); // padding+ writer.putInt(4096); // type index of pointer+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof FriendClassMsType, true);+ String result = type.toString().trim();+ assertEquals("friend: DummyMsType", result);+ }++ @Test+ public void testOneMethod16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(OneMethod16MsType.PDB_ID);+ int procedureRecordNumber = 4096;+ int accessVal = 3;+ int propertyVal = 2;+ int offset = 8;+ byte[] attributesBuffer = createClassFieldMsAttributesBuffer(accessVal, propertyVal, true,+ true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putUnsignedShort(procedureRecordNumber);+ if (propertyVal == 4) {+ writer.putInt(offset);+ }+ writer.putByteLengthPrefixedString("methodName");+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof OneMethod16MsType, true);+ String result = type.toString().trim();+ assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType,0>", result);+ }++ @Test+ public void testOneMethodStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(OneMethodStMsType.PDB_ID);+ int procedureRecordNumber = 4096;+ int accessVal = 3;+ int propertyVal = 2;+ int offset = 8;+ byte[] attributesBuffer = createClassFieldMsAttributesBuffer(accessVal, propertyVal, true,+ true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(procedureRecordNumber);+ if (propertyVal == 4) {+ writer.putInt(offset);+ }+ writer.putByteLengthPrefixedString("methodName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof OneMethodStMsType, true);+ String result = type.toString().trim();+ assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType,0>", result);+ }++ @Test+ public void testOneMethodMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(OneMethodMsType.PDB_ID);+ int procedureRecordNumber = 4096;+ int accessVal = 3;+ int propertyVal = 2;+ int offset = 8;+ byte[] attributesBuffer = createClassFieldMsAttributesBuffer(accessVal, propertyVal, true,+ true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(procedureRecordNumber);+ if (propertyVal == 4) {+ writer.putInt(offset);+ }+ writer.putNullTerminatedString("methodName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof OneMethodMsType, true);+ String result = type.toString().trim();+ assertEquals("<public static<pseudo, noinherit, noconstruct>: DummyMsType,0>", result);+ }++ @Test+ public void testVirtualFunctionTablePointerWithOffset16MsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(VirtualFunctionTablePointerWithOffset16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of pointer+ writer.putInt(8); // offset+ writer.putPadding(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof VirtualFunctionTablePointerWithOffset16MsType, true);+ String result = type.toString().trim();+ assertEquals("VFTablePtr<off=8>: DummyMsType", result);+ }++ @Test+ public void testVirtualFunctionTablePointerWithOffsetMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(VirtualFunctionTablePointerWithOffsetMsType.PDB_ID);+ writer.putBytes(new byte[] { 0x00, 0x00 }); // padding+ writer.putInt(4096); // type index of pointer+ writer.putInt(8); // offset+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof VirtualFunctionTablePointerWithOffsetMsType, true);+ String result = type.toString().trim();+ assertEquals("VFTablePtr<off=8>: DummyMsType", result);+ }++ @Test+ public void testMemberModifyStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(MemberModifyStMsType.PDB_ID);+ int accessVal = 3;+ int propertyVal = 2;+ byte[] attributesBuffer = createClassFieldMsAttributesBuffer(accessVal, propertyVal, true,+ true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // base class type definition index+ writer.putByteLengthPrefixedString("memberName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof MemberModifyStMsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>: DummyMsType memberName",+ result);+ }++ @Test+ public void testMemberModifyMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(MemberModifyMsType.PDB_ID);+ int accessVal = 3;+ int propertyVal = 2;+ byte[] attributesBuffer = createClassFieldMsAttributesBuffer(accessVal, propertyVal, true,+ true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // base class type definition index+ writer.putNullTerminatedString("memberName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof MemberModifyMsType, true);+ String result = type.toString().trim();+ assertEquals("public static<pseudo, noinherit, noconstruct>: DummyMsType memberName",+ result);+ }++ @Test+ public void testManagedStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ManagedStMsType.PDB_ID);+ writer.putByteLengthPrefixedUtf8String("managedTypeName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ManagedStMsType, true);+ String result = type.toString().trim();+ assertEquals("managedTypeName", result);+ }++ @Test+ public void testManagedMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ManagedMsType.PDB_ID);+ writer.putNullTerminatedUtf8String("managedTypeName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ManagedMsType, true);+ String result = type.toString().trim();+ assertEquals("managedTypeName", result);+ }++ @Test+ public void testAliasStMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(AliasStMsType.PDB_ID);+ writer.putInt(4096); // underlying type index+ writer.putByteLengthPrefixedString("aliasName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof AliasStMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType aliasName", result);+ }++ @Test+ public void testAliasMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(AliasMsType.PDB_ID);+ writer.putInt(4096); // underlying type index+ writer.putNullTerminatedString("aliasName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof AliasMsType, true);+ String result = type.toString().trim();+ assertEquals("DummyMsType aliasName", result);+ }++ @Test+ public void testHighLevelShaderLanguageMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(HighLevelShaderLanguageMsType.PDB_ID);+ writer.putInt(4096); // subtype index (0 if none?)+ writer.putUnsignedShort(0x0200); // kind+ int numberOfNumericProperties = 2;+ // Number of numeric properties (4 bits) + 12 bits of padding (0)+ writer.putUnsignedShort(numberOfNumericProperties & 0x0f);+ // Guess at interpretation of what should follow. API says:+ // "variable-length array of numeric properties followed by byte size"+ for (int i = 0; i < numberOfNumericProperties; i++) {+ writer.putInt(4096); // property. Assuming an unknown-sized integral type. TODO.+ }+ // byte size?+ writer.putBytes(new byte[] { 0x00, 0x00 }); // padding+ //writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof HighLevelShaderLanguageMsType, true);+ String result = type.toString().trim();+ assertEquals("Built-In HLSL: InterfacePointer <numProperties=2>", result);+ }++ @Test+ public void testModifierExMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ModifierExMsType.PDB_ID);+ writer.putInt(4096); // modified type index+ int count = 18;+ writer.putUnsignedShort(count);+ int i;+ for (i = 0; i < count && i < 3; i++) {+ writer.putUnsignedShort(1 + i); // modifier.+ }+ for (; i < count; i++) {+ writer.putUnsignedShort(0x200 - 3 + i); // modifier.+ }+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof ModifierExMsType, true);+ String result = type.toString().trim();+ assertEquals("const volatile __unaligned __uniform__ __line__ __triangle__ __lineadj__" ++ " __triangleadj__ __linear__ __centroid__ __constinterp__ __noperspective__" ++ " __sample__ __center__ __snorm__ __unorm__ __precise__ __uav_globally_coherent__" ++ " DummyMsType", result);+ }++ @Test+ public void testVectorMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(VectorMsType.PDB_ID);+ writer.putInt(4096); // element type index+ int elementSize = 4; // Made up+ long count = 5; // Number of elements in vector+ long size = count * elementSize;+ writer.putUnsignedInt(count);+ // TODO:+ // "Variable length data specifying size in bytes and name"+ // Don't know size of each or if really an array of data or not.+ // Is there a name?+ writer.putNumeric(new BigInteger(String.format("%x", size), 16), 0x800a);+ writer.putNullTerminatedString("vectorName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof VectorMsType, true);+ String result = type.toString().trim();+ assertEquals("vector: vectorName[<DummyMsType> 5]", result);+ }++ @Test+ public void testMatrixMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(MatrixMsType.PDB_ID);+ writer.putInt(4096); // element type index+ boolean rowMajor = true; // default is column-major+ int elementSize = 4; // Made up+ long numRows = 2; // Number of rows in the matrix+ long numColumns = 3; // Number columns in the matrix+ long majorStride = elementSize * (rowMajor ? numColumns : numRows);+ long size = numRows * numColumns * elementSize;+ writer.putUnsignedInt(numRows);+ writer.putUnsignedInt(numColumns);+ writer.putUnsignedInt(majorStride);+ writer.putUnsignedByte(rowMajor ? 0x00 : 0x01);+ writer.putNumeric(new BigInteger(String.format("%x", size), 16), 0x800a);+ writer.putNullTerminatedString("matrixName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof MatrixMsType, true);+ String result = type.toString().trim();+ assertEquals("matrix: matrixName[column<DummyMsType> 3][row<DummyMsType> 2]", result);+ }++ @Test+ public void testFunctionIdMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(FunctionIdMsType.PDB_ID);+ writer.putInt(4096); // scope type index+ writer.putInt(4096); // type index+ writer.putNullTerminatedString("functionIdName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof FunctionIdMsType, true);+ String result = type.toString().trim();+ assertEquals("FunctionId for: DummyMsType ItemDummyMsType::functionIdName", result);+ }++ @Test+ public void testMemberFunctionIdMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(MemberFunctionIdMsType.PDB_ID);+ writer.putInt(4096); // parent type index+ writer.putInt(4096); // type index+ writer.putNullTerminatedString("memberFunctionIdName");+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof MemberFunctionIdMsType, true);+ String result = type.toString().trim();+ assertEquals("MemberFunctionId for: DummyMsType DummyMsType::memberFunctionIdName", result);+ }++ @Test+ public void testUserDefinedTypeSourceAndLineMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(UserDefinedTypeSourceAndLineMsType.PDB_ID);+ writer.putInt(4096); // user defined type, type index+ writer.putInt(stringIdMsType1); // index to StringIdMsType record of source file name.+ writer.putUnsignedInt(1000); // Line number+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof UserDefinedTypeSourceAndLineMsType, true);+ String result = type.toString().trim();+ assertEquals(+ "UserDefinedTypeSourceAndLineMsType, line: 1000, SourceFileNameStringIdIndex:" ++ " String1, type: DummyMsType",+ result);+ }++ @Test+ public void testUserDefinedTypeModuleSourceAndLineMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(UserDefinedTypeModuleSourceAndLineMsType.PDB_ID);+ writer.putInt(4096); // user defined type, type index+ writer.putInt(1); // offset in names table of source file name.+ writer.putUnsignedInt(1000); // Line number+ writer.putUnsignedShort(1); // Module that contributes the UDT definition.+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof UserDefinedTypeModuleSourceAndLineMsType, true);+ String result = type.toString().trim();+ assertEquals("UserDefinedTypeModuleSourceAndLineMsType, module: 1, line: 1000," ++ " sourceFileName: NameTableTestString, type: DummyMsType", result);+ }++ @Test+ public void testBuildInfoMsType() throws PdbException {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(BuildInfoMsType.PDB_ID);+ writer.putUnsignedShort(5); // number of arguments+ writer.putInt(stringIdMsType1); // value for argument 0.+ writer.putInt(stringIdMsType2); // value for argument 1.+ writer.putInt(stringIdMsType1); // value for argument 2.+ writer.putInt(stringIdMsType2); // value for argument 3.+ writer.putInt(stringIdMsType1); // value for argument 4.+ writer.putAlign(2);+ PdbByteReader reader = new PdbByteReader(writer.get());+ AbstractMsType type = typeParser.parse(reader);+ assertEquals(type instanceof BuildInfoMsType, true);+ String result = type.toString().trim();+ assertEquals("CurrentDirectory: String1, BuildTool: String2, SourceFile: String1," ++ " ProgramDatabaseFile: String2, CommandArguments: String1", result);+ }++ //==============================================================================================+ // Private Methods+ //==============================================================================================+ private static byte[] createMsPropertyBuffer() {+ byte[] bytes = new byte[2];+ bytes[0] = 0x03; // packed and ctors/dtors present.+ bytes[1] = 0x00;+ return bytes;+ }++ private static byte[] createFunctionMsAttributesBuffer() {+ byte[] bytes = new byte[1];+ bytes[0] = 0x07;+ return bytes;+ }++ // accessVal:+ // none=0,private=1,protected=2,public=3+ // propertyVal:+ // none=0, virtual=1,static=2,friend=3,<intro>=4,<pure>=5,<intro,pure>=6,reserved=7+ private static byte[] createClassFieldMsAttributesBuffer(int accessVal, int propertyVal,+ boolean compilerGenerateFunctionDoesNotExist, boolean cannotBeInherited,+ boolean cannotBeConstructed, boolean compilerGenerateFunctionDoesExist,+ boolean cannotBeOverriden) {+ int attributes = 0;+ attributes |= (cannotBeOverriden ? 1 : 0);+ attributes <<= 1;+ attributes |= (compilerGenerateFunctionDoesExist ? 1 : 0);+ attributes <<= 1;+ attributes |= (cannotBeConstructed ? 1 : 0);+ attributes <<= 1;+ attributes |= (cannotBeInherited ? 1 : 0);+ attributes <<= 1;+ attributes |= (compilerGenerateFunctionDoesNotExist ? 1 : 0);+ attributes <<= 3;+ attributes |= (propertyVal & 0x0007);+ attributes <<= 2;+ attributes |= (accessVal & 0x0003);+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(attributes);+ return writer.get();+ }++ private static byte[] createMethod16Record(int procedureRecordNumber, int accessVal,+ int propertyVal, int offset) {+ PdbByteWriter writer = new PdbByteWriter();+ byte[] attributesBuffer = createClassFieldMsAttributesBuffer(accessVal, propertyVal, true,+ true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putUnsignedShort(procedureRecordNumber);+ if (propertyVal == 4) {+ writer.putInt(offset);+ }+ return writer.get();+ }++ private static byte[] createMethodRecord(int procedureRecordNumber, int accessVal,+ int propertyVal, int offset) {+ PdbByteWriter writer = new PdbByteWriter();+ byte[] attributesBuffer = createClassFieldMsAttributesBuffer(accessVal, propertyVal, true,+ true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putBytes(new byte[] { 0x00, 0x00 }); // padding+ writer.putInt(procedureRecordNumber);+ if (propertyVal == 4) {+ writer.putInt(offset);+ }+ return writer.get();+ }++ private static byte[] createMethodList16MsTypeBuffer() {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(MethodList16MsType.PDB_ID);+ int count = 2;+ int access = 3;+ int property = 2;+ int procedureRecordNumber = 4096;+ int offset = 8;+ for (int i = 0; i < count; i++) {+ byte[] bytes = createMethod16Record(procedureRecordNumber, access, property, offset);+ writer.putBytes(bytes);+ property = (property == 2) ? 4 : 2; // alternating+ }+ return writer.get();+ }++ private static byte[] createMethodListMsTypeBuffer() {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(MethodListMsType.PDB_ID);+ int count = 2;+ int access = 3;+ int property = 2;+ int procedureRecordNumber = 4096;+ int offset = 8;+ for (int i = 0; i < count; i++) {+ byte[] bytes = createMethodRecord(procedureRecordNumber, access, property,+ (property == 4) ? offset : -1);+ writer.putBytes(bytes);+ property = (property == 2) ? 4 : 2; // alternating+ }+ return writer.get();+ }++ private static byte[] createStringIdMsTypeBuffer(int substringListRecordId, String tailString) {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(StringIdMsType.PDB_ID);+ writer.putUnsignedInt(substringListRecordId);+ writer.putNullTerminatedString(tailString);+ writer.putAlign(2);+ return writer.get();+ }++ private static byte[] createSubstringListMsTypeBuffer(int[] stringIdRecordList) {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(SubstringListMsType.PDB_ID);+ writer.putUnsignedInt(stringIdRecordList.length);+ for (int element : stringIdRecordList) {+ writer.putUnsignedInt(element);+ }+ writer.putAlign(2);+ return writer.get();+ }++ private static byte[] createReferencedSymbolMsTypeBuffer() {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(ReferencedSymbolMsType.PDB_ID);+ // Doing a RegisterMsSymbol here.+ PdbByteWriter symbolWriter = new PdbByteWriter();+ symbolWriter.putUnsignedShort(RegisterMsSymbol.PDB_ID); // symbol record type index+ symbolWriter.putInt(4096); // type index+ symbolWriter.putUnsignedShort(0x01); // register number+ symbolWriter.putNullTerminatedUtf8String("registerSymbolName");+ symbolWriter.putAlign(0);+ byte[] symbolBytes = symbolWriter.get();+ // Write the symbol bytes, including length.+ writer.putUnsignedShort(symbolBytes.length); // length+ writer.putBytes(symbolBytes);+ return writer.get();+ }++ private static byte[] createBaseClass16MsTypeBuffer() {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(BaseClass16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of base class+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putNumeric(new BigInteger("10", 16), 0x8002); //offset of base class within class+ return writer.get();+ }++ private static byte[] createBaseClassMsTypeBuffer() {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(BaseClassMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // type index of base class+ writer.putNumeric(new BigInteger("10", 16), 0x8002); //offset of base class within class+ return writer.get();+ }++ private static byte[] createMember16MsTypeBuffer() {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(Member16MsType.PDB_ID);+ writer.putUnsignedShort(4096); // type index of field.+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // Offset of field.+ writer.putByteLengthPrefixedString("memberName");+ return writer.get();+ }++ private static byte[] createMemberStMsTypeBuffer() {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(MemberStMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // type index of field.+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // Offset of field.+ writer.putByteLengthPrefixedString("memberName");+ return writer.get();+ }++ private static byte[] createMemberMsTypeBuffer() {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(MemberMsType.PDB_ID);+ int attributes = 3;+ int property = 2;+ byte[] attributesBuffer =+ createClassFieldMsAttributesBuffer(attributes, property, true, true, true, true, true);+ writer.putBytes(attributesBuffer);+ writer.putInt(4096); // type index of field.+ writer.putNumeric(new BigInteger("10", 16), 0x8002); // Offset of field.+ writer.putNullTerminatedString("memberName");+ return writer.get();+ }++ private static byte[] createVtShapeMsTypeBuffer() {+ PdbByteWriter writer = new PdbByteWriter();+ writer.putUnsignedShort(VtShapeMsType.PDB_ID);+ writer.putUnsignedShort(0x07); // Count of descriptors.+ writer.putUnsignedByte(0x01); // Two descriptors.+ writer.putUnsignedByte(0x23); // Two descriptors.+ writer.putUnsignedByte(0x45); // Two descriptors.+ writer.putUnsignedByte(0x67); // One descriptor (last is dummy= unused).+ writer.putPadding(2);+ writer.putAlign(2); // TODO: Not sure+ return writer.get();+ }++}