From 8a9117ef681db7b2d2330b3dc97cc3fd45cb21e3 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Tue, 24 Aug 2021 11:12:39 +0200 Subject: [PATCH] winedump: Add support for dumping CodeView types records found in IPI stream (#4). Signed-off-by: Eric Pouech Signed-off-by: Alexandre Julliard --- include/wine/mscvpdb.h | 67 ++++++++++++++++++++++++++++++++++++++++++ tools/winedump/msc.c | 44 +++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index a72e0b58158..35143291f22 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -124,6 +124,7 @@ union codeview_type unsigned short int id; } generic; + /* types found in TPI stream (#2) */ struct { unsigned short int len; @@ -360,6 +361,61 @@ union codeview_type cv_typ_t arglist; unsigned int this_adjust; } mfunction_v2; + + /* types found in IPI stream (#4) */ + struct + { + unsigned short int len; + unsigned short int id; /* LF_FUNC_ID */ + cv_itemid_t scopeId; + cv_typ_t type; + char name[1]; + } func_id_v3; + + struct + { + unsigned short int len; + unsigned short int id; /* LF_MFUNC_ID */ + cv_typ_t parentType; + cv_typ_t type; + char name[1]; + } mfunc_id_v3; + + struct + { + unsigned short int len; + unsigned short int id; /* LF_STRING_ID */ + cv_itemid_t strid; + char name[1]; + } string_id_v3; + + struct + { + unsigned short int len; + unsigned short int id; /* LF_UDT_SRC_LINE */ + cv_typ_t type; + cv_itemid_t src; + unsigned int line; + } udt_src_line_v3; + + struct + { + unsigned short int len; + unsigned short int id; /* LF_UDT_MOD_SRC_LINE */ + cv_typ_t type; + cv_itemid_t src; + unsigned int line; + unsigned short imod; + } udt_mod_src_line_v3; + + struct + { + unsigned short int len; + unsigned short int id; /* LF_BUILDINFO */ + unsigned short count; + cv_itemid_t arg[1]; + } buildinfo_v3; + }; union codeview_reftype @@ -1216,6 +1272,17 @@ union codeview_fieldtype #define LF_NESTTYPE_V3 0x1510 #define LF_ONEMETHOD_V3 0x1511 +/* leaves found in second type type (aka IPI) + * for simplicity, stored in the same union as other TPI leaves + */ +#define LF_FUNC_ID 0x1601 +#define LF_MFUNC_ID 0x1602 +#define LF_BUILDINFO 0x1603 +#define LF_SUBSTR_LIST 0x1604 +#define LF_STRING_ID 0x1605 +#define LF_UDT_SRC_LINE 0x1606 +#define LF_UDT_MOD_SRC_LINE 0x1607 + #define LF_NUMERIC 0x8000 /* numeric leaf types */ #define LF_CHAR 0x8000 #define LF_SHORT 0x8001 diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c index 65e6beb1006..25cfcba0630 100644 --- a/tools/winedump/msc.c +++ b/tools/winedump/msc.c @@ -814,6 +814,7 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type switch (type->generic.id) { + /* types from TPI (aka #2) stream */ case LF_POINTER_V1: printf("\t%x => Pointer V1 to type:%x\n", curr_type, type->pointer_v1.datatype); @@ -1099,6 +1100,49 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type printf("\n"); break; + /* types from IPI (aka #4) stream */ + case LF_FUNC_ID: + printf("\t%x => FuncId %s scopeId:%04x type:%04x\n", + curr_type, type->func_id_v3.name, + type->func_id_v3.scopeId, type->func_id_v3.type); + break; + case LF_MFUNC_ID: + printf("\t%x => MFuncId %s parent:%04x type:%04x\n", + curr_type, type->mfunc_id_v3.name, + type->mfunc_id_v3.parentType, type->mfunc_id_v3.type); + break; + case LF_BUILDINFO: + printf("\t%x => BuildInfo count:%d\n", curr_type, type->buildinfo_v3.count); + if (type->buildinfo_v3.count >= 1) printf("\t\tcurrent dir: %04x\n", type->buildinfo_v3.arg[0]); + if (type->buildinfo_v3.count >= 2) printf("\t\tbuild tool: %04x\n", type->buildinfo_v3.arg[1]); + if (type->buildinfo_v3.count >= 3) printf("\t\tsource file: %04x\n", type->buildinfo_v3.arg[2]); + if (type->buildinfo_v3.count >= 4) printf("\t\tPDB file: %04x\n", type->buildinfo_v3.arg[3]); + if (type->buildinfo_v3.count >= 5) printf("\t\tArguments: %04x\n", type->buildinfo_v3.arg[4]); + break; + case LF_SUBSTR_LIST: + printf("\t%x => SubstrList V3(#%u):", curr_type, reftype->arglist_v2.num); + for (j = 0; j < reftype->arglist_v2.num; j++) + { + printf("\t %x", reftype->arglist_v2.args[j]); + } + printf("\t\n"); + break; + case LF_STRING_ID: + printf("\t%x => StringId %s strid:%04x\n", + curr_type, type->string_id_v3.name, type->string_id_v3.strid); + break; + case LF_UDT_SRC_LINE: + printf("\t%x => Udt-SrcLine type:%04x src:%04x line:%d\n", + curr_type, type->udt_src_line_v3.type, + type->udt_src_line_v3.src, type->udt_src_line_v3.line); + break; + case LF_UDT_MOD_SRC_LINE: + printf("\t%x => Udt-ModSrcLine type:%04x src:%04x line:%d mod:%d\n", + curr_type, type->udt_mod_src_line_v3.type, + type->udt_mod_src_line_v3.src, type->udt_mod_src_line_v3.line, + type->udt_mod_src_line_v3.imod); + break; + default: printf(">>> Unsupported type-id %x for %x\n", type->generic.id, curr_type); dump_data((const void*)type, type->generic.len + 2, "");