Skip to content

Commit cab7f1e

Browse files
kjkclaude
andcommitted
pdb: Add AliasType support (LF_ALIAS/LF_ALIAS_ST)
Port of getsentry/pdb#134. Adds parsing for typedef/alias type records which contain an underlying type index and a name. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2a70501 commit cab7f1e

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

pdb/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export type {
6363
PointerType,
6464
ModifierType,
6565
ArrayType,
66+
AliasType,
6667
BitfieldType,
6768
FieldListType,
6869
ArgumentListType,

pdb/src/tpi/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const LF_ENUM_ST = 0x1007;
4040
export const LF_PROCEDURE = 0x1008;
4141
export const LF_MFUNCTION = 0x1009;
4242
export const LF_COBOL0 = 0x100a;
43+
export const LF_ALIAS_ST = 0x1010;
4344
export const LF_BARRAY = 0x100b;
4445
export const LF_VFTPATH = 0x100d;
4546

pdb/src/tpi/parser.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,13 @@ function parseTypeRecord(buf: ParseBuffer, kind: number): TypeData {
303303
};
304304
}
305305

306+
case C.LF_ALIAS:
307+
case C.LF_ALIAS_ST: {
308+
const underlyingType: TypeIndex = buf.readU32();
309+
const name = readTypeName(buf, kind);
310+
return { kind: "Alias", underlyingType, name };
311+
}
312+
306313
case C.LF_BITFIELD: {
307314
const underlyingType: TypeIndex = buf.readU32();
308315
const length = buf.readU8();

pdb/src/tpi/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,12 @@ export interface ArrayType {
271271
name: string;
272272
}
273273

274+
export interface AliasType {
275+
kind: "Alias";
276+
underlyingType: TypeIndex;
277+
name: string;
278+
}
279+
274280
export interface BitfieldType {
275281
kind: "Bitfield";
276282
underlyingType: TypeIndex;
@@ -387,6 +393,7 @@ export type TypeData =
387393
| PointerType
388394
| ModifierType
389395
| ArrayType
396+
| AliasType
390397
| BitfieldType
391398
| FieldListType
392399
| ArgumentListType

0 commit comments

Comments
 (0)