From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/msc.c | 60 ++++++++++++++++++++-------------------- include/wine/mscvpdb.h | 63 ++++++++++++++++++------------------------ tools/winedump/msc.c | 46 ++++++++++++++---------------- 3 files changed, 78 insertions(+), 91 deletions(-)
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 815bcedb04a..73d5a8e23f4 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -728,31 +728,31 @@ static BOOL codeview_type_extract_name(const union codeview_type* cvtype, { case LF_STRUCTURE_V1: case LF_CLASS_V1: - leaf_len = numeric_leaf(&value, &cvtype->struct_v1.structlen); - p_name = (const struct p_string*)((const unsigned char*)&cvtype->struct_v1.structlen + leaf_len); + leaf_len = numeric_leaf(&value, cvtype->struct_v1.data); + p_name = (const struct p_string*)&cvtype->struct_v1.data[leaf_len]; break; case LF_STRUCTURE_V2: case LF_CLASS_V2: - leaf_len = numeric_leaf(&value, &cvtype->struct_v2.structlen); - p_name = (const struct p_string*)((const unsigned char*)&cvtype->struct_v2.structlen + leaf_len); + leaf_len = numeric_leaf(&value, cvtype->struct_v2.data); + p_name = (const struct p_string*)&cvtype->struct_v2.data[leaf_len]; break; case LF_STRUCTURE_V3: case LF_CLASS_V3: - leaf_len = numeric_leaf(&value, &cvtype->struct_v3.structlen); - c_name = (const char*)&cvtype->struct_v3.structlen + leaf_len; + leaf_len = numeric_leaf(&value, cvtype->struct_v3.data); + c_name = (const char*)&cvtype->struct_v3.data[leaf_len]; decorated = cvtype->struct_v3.property.has_decorated_name; break; case LF_UNION_V1: - leaf_len = numeric_leaf(&value, &cvtype->union_v1.un_len); - p_name = (const struct p_string*)((const unsigned char*)&cvtype->union_v1.un_len + leaf_len); + leaf_len = numeric_leaf(&value, cvtype->union_v1.data); + p_name = (const struct p_string*)&cvtype->union_v1.data[leaf_len]; break; case LF_UNION_V2: - leaf_len = numeric_leaf(&value, &cvtype->union_v2.un_len); - p_name = (const struct p_string*)((const unsigned char*)&cvtype->union_v2.un_len + leaf_len); + leaf_len = numeric_leaf(&value, cvtype->union_v2.data); + p_name = (const struct p_string*)&cvtype->union_v2.data[leaf_len]; break; case LF_UNION_V3: - leaf_len = numeric_leaf(&value, &cvtype->union_v3.un_len); - c_name = (const char*)&cvtype->union_v3.un_len + leaf_len; + leaf_len = numeric_leaf(&value, cvtype->union_v3.data); + c_name = (const char*)&cvtype->union_v3.data[leaf_len]; decorated = cvtype->union_v3.property.has_decorated_name; break; case LF_ENUM_V1: @@ -1268,23 +1268,23 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp, break;
case LF_ARRAY_V1: - leaf_len = numeric_leaf(&value, &type->array_v1.arrlen); - p_name = (const struct p_string*)((const unsigned char*)&type->array_v1.arrlen + leaf_len); + leaf_len = numeric_leaf(&value, type->array_v1.data); + p_name = (const struct p_string*)&type->array_v1.data[leaf_len]; symt = codeview_add_type_array(ctp, terminate_string(p_name), type->array_v1.elemtype, type->array_v1.idxtype, value); break; case LF_ARRAY_V2: - leaf_len = numeric_leaf(&value, &type->array_v2.arrlen); - p_name = (const struct p_string*)((const unsigned char*)&type->array_v2.arrlen + leaf_len); + leaf_len = numeric_leaf(&value, type->array_v2.data); + p_name = (const struct p_string*)&type->array_v2.data[leaf_len];
symt = codeview_add_type_array(ctp, terminate_string(p_name), type->array_v2.elemtype, type->array_v2.idxtype, value); break; case LF_ARRAY_V3: - leaf_len = numeric_leaf(&value, &type->array_v3.arrlen); - c_name = (const char*)&type->array_v3.arrlen + leaf_len; + leaf_len = numeric_leaf(&value, type->array_v3.data); + c_name = (const char*)&type->array_v3.data[leaf_len];
symt = codeview_add_type_array(ctp, c_name, type->array_v3.elemtype, @@ -1418,43 +1418,43 @@ static struct symt* codeview_load_forwardable_type(struct codeview_type_parse* c { case LF_STRUCTURE_V1: case LF_CLASS_V1: - leaf_len = numeric_leaf(&value, &type->struct_v1.structlen); - p_name = (const struct p_string*)((const unsigned char*)&type->struct_v1.structlen + leaf_len); + leaf_len = numeric_leaf(&value, type->struct_v1.data); + p_name = (const struct p_string*)&type->struct_v1.data[leaf_len]; symt = &symt_new_udt(ctp->module, terminate_string(p_name), value, type->generic.id == LF_CLASS_V1 ? UdtClass : UdtStruct)->symt; break;
case LF_STRUCTURE_V2: case LF_CLASS_V2: - leaf_len = numeric_leaf(&value, &type->struct_v2.structlen); - p_name = (const struct p_string*)((const unsigned char*)&type->struct_v2.structlen + leaf_len); + leaf_len = numeric_leaf(&value, type->struct_v2.data); + p_name = (const struct p_string*)&type->struct_v2.data[leaf_len]; symt = &symt_new_udt(ctp->module, terminate_string(p_name), value, type->generic.id == LF_CLASS_V2 ? UdtClass : UdtStruct)->symt; break;
case LF_STRUCTURE_V3: case LF_CLASS_V3: - leaf_len = numeric_leaf(&value, &type->struct_v3.structlen); - c_name = (const char*)&type->struct_v3.structlen + leaf_len; + leaf_len = numeric_leaf(&value, type->struct_v3.data); + c_name = (const char*)&type->struct_v3.data[leaf_len]; symt = &symt_new_udt(ctp->module, c_name, value, type->generic.id == LF_CLASS_V3 ? UdtClass : UdtStruct)->symt; break;
case LF_UNION_V1: - leaf_len = numeric_leaf(&value, &type->union_v1.un_len); - p_name = (const struct p_string*)((const unsigned char*)&type->union_v1.un_len + leaf_len); + leaf_len = numeric_leaf(&value, type->union_v1.data); + p_name = (const struct p_string*)&type->union_v1.data[leaf_len]; symt = &symt_new_udt(ctp->module, terminate_string(p_name), value, UdtUnion)->symt; break;
case LF_UNION_V2: - leaf_len = numeric_leaf(&value, &type->union_v2.un_len); - p_name = (const struct p_string*)((const unsigned char*)&type->union_v2.un_len + leaf_len); + leaf_len = numeric_leaf(&value, type->union_v2.data); + p_name = (const struct p_string*)&type->union_v2.data[leaf_len]; symt = &symt_new_udt(ctp->module, terminate_string(p_name), value, UdtUnion)->symt; break;
case LF_UNION_V3: - leaf_len = numeric_leaf(&value, &type->union_v3.un_len); - c_name = (const char*)&type->union_v3.un_len + leaf_len; + leaf_len = numeric_leaf(&value, type->union_v3.data); + c_name = (const char*)&type->union_v3.data[leaf_len]; symt = &symt_new_udt(ctp->module, c_name, value, UdtUnion)->symt; break;
diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index 4d0380ee429..560d3cc08d6 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -183,10 +183,9 @@ union codeview_type unsigned short int id; cv_typ16_t elemtype; cv_typ16_t idxtype; - unsigned short int arrlen; /* numeric leaf */ -#if 0 - struct p_string p_name; -#endif + unsigned char data[]; + /* <numeric leaf> arrlen; */ + /* struct p_string p_name; */ } array_v1;
struct @@ -195,10 +194,9 @@ union codeview_type unsigned short int id; cv_typ_t elemtype; cv_typ_t idxtype; - unsigned short int arrlen; /* numeric leaf */ -#if 0 - struct p_string p_name; -#endif + unsigned char data[]; + /* <numeric leaf> arrlen; */ + /* struct p_string p_name; */ } array_v2;
struct @@ -207,10 +205,9 @@ union codeview_type unsigned short int id; cv_typ_t elemtype; cv_typ_t idxtype; - unsigned short int arrlen; /* numeric leaf */ -#if 0 - char name[1]; -#endif + unsigned char data[]; + /* <numeric leaf> arrlen; */ + /* char name[]; */ } array_v3;
struct @@ -222,10 +219,9 @@ union codeview_type cv_property_t property; cv_typ16_t derived; cv_typ16_t vshape; - unsigned short int structlen; /* numeric leaf */ -#if 0 - struct p_string p_name; -#endif + unsigned char data[]; + /* <numeric leaf> structlen; */ + /* struct p_string p_name; */ } struct_v1;
struct @@ -237,10 +233,9 @@ union codeview_type cv_typ_t fieldlist; cv_typ_t derived; cv_typ_t vshape; - unsigned short int structlen; /* numeric leaf */ -#if 0 - struct p_string p_name; -#endif + unsigned char data[]; + /* <numeric leaf> structlen; */ + /* struct p_string p_name; */ } struct_v2;
struct @@ -252,10 +247,9 @@ union codeview_type cv_typ_t fieldlist; cv_typ_t derived; cv_typ_t vshape; - unsigned short int structlen; /* numeric leaf */ -#if 0 - char name[1]; -#endif + unsigned char data[]; + /* <numeric leaf> structlen; */ + /* char name[]; */ } struct_v3;
struct @@ -265,10 +259,9 @@ union codeview_type short int count; cv_typ16_t fieldlist; cv_property_t property; - unsigned short int un_len; /* numeric leaf */ -#if 0 - struct p_string p_name; -#endif + unsigned char data[]; + /* <numeric leaf> unionlen; */ + /* struct p_string p_name; */ } union_v1;
struct @@ -278,10 +271,9 @@ union codeview_type short int count; cv_property_t property; cv_typ_t fieldlist; - unsigned short int un_len; /* numeric leaf */ -#if 0 - struct p_string p_name; -#endif + unsigned char data[]; + /* <numeric leaf> unionlen; */ + /* struct p_string p_name; */ } union_v2;
struct @@ -291,10 +283,9 @@ union codeview_type short int count; cv_property_t property; cv_typ_t fieldlist; - unsigned short int un_len; /* numeric leaf */ -#if 0 - char name[1]; -#endif + unsigned char data[]; + /* <numeric leaf> unionlen; */ + /* char name[]; */ } union_v3;
struct diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c index 0a638d4bf9f..997daab501b 100644 --- a/tools/winedump/msc.c +++ b/tools/winedump/msc.c @@ -52,9 +52,7 @@ struct full_value } v; };
-/* wrapper for migration to FAM */ -#define full_numeric_leaf(f, l) _full_numeric_leaf((f), (const unsigned char *)(l)) -static int _full_numeric_leaf(struct full_value *fv, const unsigned char *leaf) +static int full_numeric_leaf(struct full_value *fv, const unsigned char *leaf) { unsigned short int type = *(const unsigned short *)leaf; int length = 2; @@ -187,12 +185,10 @@ static const char* full_value_string(const struct full_value* fv) return tmp; }
-/* wrapper for migration to FAM */ -#define numeric_leaf(v, l) _numeric_leaf((v), (const unsigned char *)(l)) -static int _numeric_leaf(int* value, const unsigned char* leaf) +static int numeric_leaf(int* value, const unsigned char* leaf) { struct full_value fv; - int len = _full_numeric_leaf(&fv, leaf); + int len = full_numeric_leaf(&fv, leaf);
switch (fv.type) { @@ -831,20 +827,20 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type curr_type, type->pointer_v2.datatype); break; case LF_ARRAY_V1: - leaf_len = numeric_leaf(&value, &type->array_v1.arrlen); + leaf_len = numeric_leaf(&value, type->array_v1.data); printf("\t%x => Array V1-'%s'[%u type:%x] type:%x\n", - curr_type, p_string(PSTRING(&type->array_v1.arrlen, leaf_len)), + curr_type, p_string((const struct p_string *)&type->array_v1.data[leaf_len]), value, type->array_v1.idxtype, type->array_v1.elemtype); break; case LF_ARRAY_V2: - leaf_len = numeric_leaf(&value, &type->array_v2.arrlen); + leaf_len = numeric_leaf(&value, type->array_v2.data); printf("\t%x => Array V2-'%s'[%u type:%x] type:%x\n", - curr_type, p_string(PSTRING(&type->array_v2.arrlen, leaf_len)), + curr_type, p_string((const struct p_string *)&type->array_v2.data[leaf_len]), value, type->array_v2.idxtype, type->array_v2.elemtype); break; case LF_ARRAY_V3: - leaf_len = numeric_leaf(&value, &type->array_v3.arrlen); - str = (const char*)&type->array_v3.arrlen + leaf_len; + leaf_len = numeric_leaf(&value, type->array_v3.data); + str = (const char*)&type->array_v3.data[leaf_len]; printf("\t%x => Array V3-'%s'[%u type:%x] type:%x\n", curr_type, str, value, type->array_v3.idxtype, type->array_v3.elemtype); @@ -875,10 +871,10 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
case LF_STRUCTURE_V1: case LF_CLASS_V1: - leaf_len = numeric_leaf(&value, &type->struct_v1.structlen); + leaf_len = numeric_leaf(&value, type->struct_v1.data); printf("\t%x => %s V1 '%s' elts:%u property:%s fieldlist-type:%x derived-type:%x vshape:%x size:%u\n", curr_type, type->generic.id == LF_CLASS_V1 ? "Class" : "Struct", - p_string(PSTRING(&type->struct_v1.structlen, leaf_len)), + p_string((const struct p_string *)&type->struct_v1.data[leaf_len]), type->struct_v1.n_element, get_property(type->struct_v1.property), type->struct_v1.fieldlist, type->struct_v1.derived, type->struct_v1.vshape, value); @@ -886,11 +882,11 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
case LF_STRUCTURE_V2: case LF_CLASS_V2: - leaf_len = numeric_leaf(&value, &type->struct_v2.structlen); + leaf_len = numeric_leaf(&value, type->struct_v2.data); printf("\t%x => %s V2 '%s' elts:%u property:%s\n" " fieldlist-type:%x derived-type:%x vshape:%x size:%u\n", curr_type, type->generic.id == LF_CLASS_V2 ? "Class" : "Struct", - p_string(PSTRING(&type->struct_v2.structlen, leaf_len)), + p_string((const struct p_string *)&type->struct_v2.data[leaf_len]), type->struct_v2.n_element, get_property(type->struct_v2.property), type->struct_v2.fieldlist, type->struct_v2.derived, type->struct_v2.vshape, value); @@ -898,8 +894,8 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
case LF_STRUCTURE_V3: case LF_CLASS_V3: - leaf_len = numeric_leaf(&value, &type->struct_v3.structlen); - str = (const char*)&type->struct_v3.structlen + leaf_len; + leaf_len = numeric_leaf(&value, type->struct_v3.data); + str = (const char*)&type->struct_v3.data[leaf_len]; printf("\t%x => %s V3 '%s' elts:%u property:%s\n" " fieldlist-type:%x derived-type:%x vshape:%x size:%u\n", curr_type, type->generic.id == LF_CLASS_V3 ? "Class" : "Struct", @@ -911,24 +907,24 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type break;
case LF_UNION_V1: - leaf_len = numeric_leaf(&value, &type->union_v1.un_len); + leaf_len = numeric_leaf(&value, type->union_v1.data); printf("\t%x => Union V1 '%s' count:%u property:%s fieldlist-type:%x size:%u\n", - curr_type, p_string(PSTRING(&type->union_v1.un_len, leaf_len)), + curr_type, p_string((const struct p_string *)&type->union_v1.data[leaf_len]), type->union_v1.count, get_property(type->union_v1.property), type->union_v1.fieldlist, value); break;
case LF_UNION_V2: - leaf_len = numeric_leaf(&value, &type->union_v2.un_len); + leaf_len = numeric_leaf(&value, type->union_v2.data); printf("\t%x => Union V2 '%s' count:%u property:%s fieldlist-type:%x size:%u\n", - curr_type, p_string(PSTRING(&type->union_v2.un_len, leaf_len)), + curr_type, p_string((const struct p_string *)&type->union_v2.data[leaf_len]), type->union_v2.count, get_property(type->union_v2.property), type->union_v2.fieldlist, value); break;
case LF_UNION_V3: - leaf_len = numeric_leaf(&value, &type->union_v3.un_len); - str = (const char*)&type->union_v3.un_len + leaf_len; + leaf_len = numeric_leaf(&value, type->union_v3.data); + str = (const char*)&type->union_v3.data[leaf_len]; printf("\t%x => Union V3 '%s' count:%u property:%s fieldlist-type:%x size:%u\n", curr_type, str, type->union_v3.count, get_property(type->union_v3.property),