GCC 14.1 emits a bunch of warning when compiling (winedump & dbghelp).
This stems from some of the structures attempting to reflect file layout (after serialisation), whereas the variable length of some contiguous fields make it impossible (in C).
So use flexible array members for variable length arrays, and use an FAM as well for packing the more complicated bits. This keeps these data blocks as C structures for the fields that can be directly mapped, and leave to the caller the responsability of deserializing the rest.
This seem to be enough to get rid of these GCC warnings.
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/msc.c | 4 +- include/wine/mscvpdb.h | 96 +++++++++++++++++++++--------------------- 2 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index b14af240302..546b9d83d74 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -3296,12 +3296,12 @@ static void pdb_convert_symbol_file(const PDB_SYMBOLS* symbols, sfile->symbol_size = sym_file->symbol_size; sfile->lineno_size = sym_file->lineno_size; sfile->lineno2_size = sym_file->lineno2_size; - *size = sizeof(PDB_SYMBOL_FILE) - 1; + *size = sizeof(PDB_SYMBOL_FILE); } else { memcpy(sfile, image, sizeof(PDB_SYMBOL_FILE_EX)); - *size = sizeof(PDB_SYMBOL_FILE_EX) - 1; + *size = sizeof(PDB_SYMBOL_FILE_EX); } }
diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index 08353f11811..72626a23a2d 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -104,7 +104,7 @@ struct p_string { unsigned char namelen; - char name[1]; + char name[]; };
typedef unsigned short cv_typ16_t; @@ -327,7 +327,7 @@ union codeview_type cv_property_t property; cv_typ_t type; cv_typ_t fieldlist; - char name[1]; + char name[]; } enumeration_v3;
struct @@ -387,7 +387,7 @@ union codeview_type unsigned short int id; /* LF_FUNC_ID */ cv_itemid_t scopeId; cv_typ_t type; - char name[1]; + char name[]; } func_id_v3;
struct @@ -396,7 +396,7 @@ union codeview_type unsigned short int id; /* LF_MFUNC_ID */ cv_typ_t parentType; cv_typ_t type; - char name[1]; + char name[]; } mfunc_id_v3;
struct @@ -404,7 +404,7 @@ union codeview_type unsigned short int len; unsigned short int id; /* LF_STRING_ID */ cv_itemid_t strid; - char name[1]; + char name[]; } string_id_v3;
struct @@ -431,7 +431,7 @@ union codeview_type unsigned short int len; unsigned short int id; /* LF_BUILDINFO */ unsigned short count; - cv_itemid_t arg[1]; + cv_itemid_t arg[]; } buildinfo_v3;
}; @@ -448,7 +448,7 @@ union codeview_reftype { unsigned short int len; unsigned short int id; - unsigned char list[1]; + unsigned char list[]; } fieldlist;
struct @@ -474,7 +474,7 @@ union codeview_reftype unsigned short int len; unsigned short int id; unsigned short num; - cv_typ16_t args[1]; + cv_typ16_t args[]; } arglist_v1;
struct @@ -482,7 +482,7 @@ union codeview_reftype unsigned short int len; unsigned short int id; unsigned num; - cv_typ_t args[1]; + cv_typ_t args[]; } arglist_v2;
struct @@ -490,7 +490,7 @@ union codeview_reftype unsigned short int len; unsigned short int id; unsigned short num; - cv_typ16_t drvdcls[1]; + cv_typ16_t drvdcls[]; } derived_v1;
struct @@ -498,7 +498,7 @@ union codeview_reftype unsigned short int len; unsigned short int id; unsigned num; - cv_typ_t drvdcls[1]; + cv_typ_t drvdcls[]; } derived_v2;
struct @@ -509,7 +509,7 @@ union codeview_reftype cv_typ_t baseVftable; unsigned offsetInObjectLayout; unsigned cbstr; - char names[1]; /* array of len 0-terminated strings (size of cbstr in char:s) */ + char names[]; /* array of len 0-terminated strings (size of cbstr in char:s) */ } vftable_v3; };
@@ -600,7 +600,7 @@ union codeview_fieldtype unsigned short int id; short int _pad0; cv_typ_t type; - char name[1]; + char name[]; } friendfcn_v3;
struct @@ -658,7 +658,7 @@ union codeview_fieldtype unsigned short int id; short int attribute; cv_typ_t type; - char name[1]; + char name[]; } stmember_v3;
struct @@ -682,7 +682,7 @@ union codeview_fieldtype unsigned short int id; short int count; cv_typ_t mlist; - char name[1]; + char name[]; } method_v3;
struct @@ -705,7 +705,7 @@ union codeview_fieldtype unsigned short int id; short int _pad0; cv_typ_t type; - char name[1]; + char name[]; } nesttype_v3;
struct @@ -755,7 +755,7 @@ union codeview_fieldtype unsigned short int id; short int attribute; cv_typ_t type; - char name[1]; + char name[]; } onemethod_v3;
struct @@ -782,7 +782,7 @@ union codeview_fieldtype short int attribute; cv_typ_t type; unsigned int vtab_offset; - char name[1]; + char name[]; } onemethod_virt_v3;
struct @@ -1426,7 +1426,7 @@ union codeview_symbol cv_typ_t symtype; unsigned int offset; unsigned short segment; - char name[1]; + char name[]; } data_v3;
struct @@ -1454,7 +1454,7 @@ union codeview_symbol unsigned short segment; unsigned short thunk_len; unsigned char thtype; - char name[1]; + char name[]; } thunk_v3;
struct @@ -1505,7 +1505,7 @@ union codeview_symbol unsigned int offset; unsigned short segment; unsigned char flags; - char name[1]; + char name[]; } proc_v3;
struct @@ -1535,7 +1535,7 @@ union codeview_symbol unsigned int pubsymflags; unsigned int offset; unsigned short segment; - char name[1]; + char name[]; } public_v3;
struct @@ -1562,7 +1562,7 @@ union codeview_symbol unsigned short int id; /* Always S_BPREL32 */ int offset; /* Stack offset relative to BP */ cv_typ_t symtype; - char name[1]; + char name[]; } stack_v3;
struct @@ -1572,7 +1572,7 @@ union codeview_symbol int offset; /* Stack offset relative to BP */ cv_typ_t symtype; unsigned short reg; - char name[1]; + char name[]; } regrel_v3;
struct @@ -1601,7 +1601,7 @@ union codeview_symbol unsigned short int id; /* Always S_REGISTER */ cv_typ_t type; /* check whether type & reg are correct */ unsigned short reg; - char name[1]; + char name[]; /* don't handle register tracking */ } register_v3;
@@ -1626,7 +1626,7 @@ union codeview_symbol unsigned int length; unsigned int offset; unsigned short segment; - char name[1]; + char name[]; } block_v3;
struct @@ -1658,7 +1658,7 @@ union codeview_symbol unsigned int offset; unsigned short segment; unsigned char flags; - char name[1]; + char name[]; } label_v3;
struct @@ -1715,7 +1715,7 @@ union codeview_symbol unsigned short int len; unsigned short int id; cv_typ_t type; - char name[1]; + char name[]; } udt_v3;
struct @@ -1731,7 +1731,7 @@ union codeview_symbol unsigned short int len; unsigned short int id; unsigned signature; - char name[1]; + char name[]; } objname_v3;
struct @@ -1783,7 +1783,7 @@ union codeview_symbol unsigned short be_major; unsigned short be_minor; unsigned short be_build; - char name[1]; + char name[]; } compile2_v3;
struct @@ -1804,7 +1804,7 @@ union codeview_symbol unsigned short be_minor; unsigned short be_build; unsigned short be_qfe; - char name[1]; + char name[]; } compile3_v3;
struct @@ -1834,7 +1834,7 @@ union codeview_symbol cv_typ_t symtype; unsigned int offset; unsigned short segment; - char name[1]; + char name[]; } thread_v3;
struct @@ -1844,7 +1844,7 @@ union codeview_symbol unsigned int sumName; unsigned int ibSym; unsigned short imod; - char name[1]; + char name[]; } refsym2_v3;
struct @@ -1892,7 +1892,7 @@ union codeview_symbol unsigned short int id; cv_typ_t symtype; struct cv_local_varflag varflags; - char name[1]; + char name[]; } local_v3;
struct @@ -2021,7 +2021,7 @@ union codeview_symbol cv_typ_t typind; unsigned int modOffset; struct cv_local_varflag varflags; - char name[1]; + char name[]; } file_static_v3;
struct @@ -2035,7 +2035,7 @@ union codeview_symbol { unsigned short int len; unsigned short int id; - char name[1]; + char name[]; } unamespace_v3;
struct @@ -2059,7 +2059,7 @@ union codeview_symbol unsigned int off; unsigned short int seg; unsigned short int csz; /* number of bytes in following array */ - char rgsz[1]; /* array of null terminated strings (bounded by csz) */ + char rgsz[]; /* array of null terminated strings (bounded by csz) */ } annotation_v3;
struct @@ -2389,7 +2389,7 @@ struct PDB_JG_HEADER unsigned short free_list_block; unsigned short total_alloc; struct PDB_JG_STREAM toc; - unsigned short toc_block[1]; + unsigned short toc_block[]; };
struct PDB_DS_HEADER @@ -2406,13 +2406,13 @@ struct PDB_DS_HEADER struct PDB_JG_TOC { unsigned int num_streams; - struct PDB_JG_STREAM streams[1]; + struct PDB_JG_STREAM streams[]; };
struct PDB_DS_TOC { unsigned int num_streams; - unsigned int stream_size[1]; + unsigned int stream_size[]; };
struct PDB_JG_ROOT @@ -2421,7 +2421,7 @@ struct PDB_JG_ROOT unsigned int TimeDateStamp; unsigned int Age; unsigned int cbNames; - char names[1]; + char names[]; };
struct PDB_DS_ROOT @@ -2431,7 +2431,7 @@ struct PDB_DS_ROOT unsigned int Age; GUID guid; unsigned int cbNames; - char names[1]; + char names[]; };
typedef struct _PDB_TYPES_OLD @@ -2498,7 +2498,7 @@ typedef struct _PDB_SYMBOL_FILE unsigned int lineno2_size; unsigned int nSrcFiles; unsigned int attribute; - char filename[1]; + char filename[]; } PDB_SYMBOL_FILE, *PPDB_SYMBOL_FILE;
typedef struct _PDB_SYMBOL_FILE_EX @@ -2513,14 +2513,14 @@ typedef struct _PDB_SYMBOL_FILE_EX unsigned int nSrcFiles; unsigned int attribute; unsigned int reserved[2]; - char filename[1]; + char filename[]; } PDB_SYMBOL_FILE_EX, *PPDB_SYMBOL_FILE_EX;
typedef struct _PDB_SYMBOL_SOURCE { unsigned short nModules; unsigned short nSrcFiles; - unsigned short table[1]; + unsigned short table[]; } PDB_SYMBOL_SOURCE, *PPDB_SYMBOL_SOURCE;
typedef struct _PDB_SYMBOL_IMPORT @@ -2529,7 +2529,7 @@ typedef struct _PDB_SYMBOL_IMPORT unsigned int unknown2; unsigned int TimeDateStamp; unsigned int Age; - char filename[1]; + char filename[]; } PDB_SYMBOL_IMPORT, *PPDB_SYMBOL_IMPORT;
typedef struct _PDB_SYMBOLS_OLD @@ -2683,7 +2683,7 @@ typedef struct OMFSignatureRSDS char Signature[4]; GUID guid; unsigned int age; - char name[1]; + char name[]; } OMFSignatureRSDS;
typedef struct _CODEVIEW_PDB_DATA @@ -2692,7 +2692,7 @@ typedef struct _CODEVIEW_PDB_DATA int filepos; unsigned int timestamp; unsigned int age; - char name[1]; + char name[]; } CODEVIEW_PDB_DATA, *PCODEVIEW_PDB_DATA;
typedef struct OMFDirHeader
From: Eric Pouech epouech@codeweavers.com
This will avoid GCC compiler warnings.
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/msc.c | 54 +++++++++++++++++++++++------------------ include/wine/mscvpdb.h | 55 +++++++++++++++++++----------------------- tools/winedump/msc.c | 51 +++++++++++++++++++++------------------ 3 files changed, 83 insertions(+), 77 deletions(-)
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 546b9d83d74..04de7f6491f 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -269,10 +269,13 @@ static void codeview_init_basic_types(struct module* module) cv_basic_types[T_PUINT8] = &symt_new_pointer(module, cv_basic_types[T_UINT8], ptrsz)->symt; }
-static int leaf_as_variant(VARIANT* v, const unsigned short int* leaf) +/* wrapper for migration to FAM */ +#define leaf_as_variant(v, l) _leaf_as_variant((v), (const unsigned char*)(l)) +static int _leaf_as_variant(VARIANT *v, const unsigned char *leaf) { - unsigned short int type = *leaf++; + unsigned short int type = *(const unsigned short *)leaf; int length = 2; + leaf += length;
if (type < LF_NUMERIC) { @@ -394,10 +397,13 @@ static int leaf_as_variant(VARIANT* v, const unsigned short int* leaf) return length; }
-static int numeric_leaf(int* value, const unsigned short int* leaf) +/* 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) { - unsigned short int type = *leaf++; + unsigned short int type = *(const unsigned short int *)leaf; int length = 2; + leaf += length;
if (type < LF_NUMERIC) { @@ -888,8 +894,8 @@ static BOOL codeview_add_type_enum_field_list(struct codeview_type_parse* ctp, { case LF_ENUMERATE_V1: { - int value, vlen = numeric_leaf(&value, &type->enumerate_v1.value); - const struct p_string* p_name = (const struct p_string*)((const unsigned char*)&type->enumerate_v1.value + vlen); + int value, vlen = numeric_leaf(&value, type->enumerate_v1.data); + const struct p_string* p_name = (const struct p_string*)&type->enumerate_v1.data[vlen];
symt_add_enum_element(ctp->module, symt, terminate_string(p_name), value); ptr += 2 + 2 + vlen + (1 + p_name->namelen); @@ -897,8 +903,8 @@ static BOOL codeview_add_type_enum_field_list(struct codeview_type_parse* ctp, } case LF_ENUMERATE_V3: { - int value, vlen = numeric_leaf(&value, &type->enumerate_v3.value); - const char* name = (const char*)&type->enumerate_v3.value + vlen; + int value, vlen = numeric_leaf(&value, type->enumerate_v3.data); + const char* name = (const char*)&type->enumerate_v3.data[vlen];
symt_add_enum_element(ctp->module, symt, name, value); ptr += 2 + 2 + vlen + (1 + strlen(name)); @@ -990,7 +996,7 @@ static int codeview_add_type_struct_field_list(struct codeview_type_parse* ctp, switch (type->generic.id) { case LF_BCLASS_V1: - leaf_len = numeric_leaf(&value, &type->bclass_v1.offset); + leaf_len = numeric_leaf(&value, type->bclass_v1.data);
/* FIXME: ignored for now */
@@ -998,7 +1004,7 @@ static int codeview_add_type_struct_field_list(struct codeview_type_parse* ctp, break;
case LF_BCLASS_V2: - leaf_len = numeric_leaf(&value, &type->bclass_v2.offset); + leaf_len = numeric_leaf(&value, type->bclass_v2.data);
/* FIXME: ignored for now */
@@ -1008,10 +1014,10 @@ static int codeview_add_type_struct_field_list(struct codeview_type_parse* ctp, case LF_VBCLASS_V1: case LF_IVBCLASS_V1: { - const unsigned short int* p_vboff; + const unsigned char* p_vboff; int vpoff, vplen; - leaf_len = numeric_leaf(&value, &type->vbclass_v1.vbpoff); - p_vboff = (const unsigned short int*)((const char*)&type->vbclass_v1.vbpoff + leaf_len); + leaf_len = numeric_leaf(&value, type->vbclass_v1.data); + p_vboff = &type->vbclass_v1.data[leaf_len]; vplen = numeric_leaf(&vpoff, p_vboff);
/* FIXME: ignored for now */ @@ -1023,10 +1029,10 @@ static int codeview_add_type_struct_field_list(struct codeview_type_parse* ctp, case LF_VBCLASS_V2: case LF_IVBCLASS_V2: { - const unsigned short int* p_vboff; + const unsigned char* p_vboff; int vpoff, vplen; - leaf_len = numeric_leaf(&value, &type->vbclass_v2.vbpoff); - p_vboff = (const unsigned short int*)((const char*)&type->vbclass_v2.vbpoff + leaf_len); + leaf_len = numeric_leaf(&value, type->vbclass_v2.data); + p_vboff = &type->vbclass_v2.data[leaf_len]; vplen = numeric_leaf(&vpoff, p_vboff);
/* FIXME: ignored for now */ @@ -1036,28 +1042,28 @@ static int codeview_add_type_struct_field_list(struct codeview_type_parse* ctp, break;
case LF_MEMBER_V1: - leaf_len = numeric_leaf(&value, &type->member_v1.offset); - p_name = (const struct p_string*)((const char*)&type->member_v1.offset + leaf_len); + leaf_len = numeric_leaf(&value, type->member_v1.data); + p_name = (const struct p_string*)&type->member_v1.data[leaf_len];
- codeview_add_udt_element(ctp, symt, terminate_string(p_name), value, + codeview_add_udt_element(ctp, symt, terminate_string(p_name), value, type->member_v1.type);
ptr += 2 + 2 + 2 + leaf_len + (1 + p_name->namelen); break;
case LF_MEMBER_V2: - leaf_len = numeric_leaf(&value, &type->member_v2.offset); - p_name = (const struct p_string*)((const unsigned char*)&type->member_v2.offset + leaf_len); + leaf_len = numeric_leaf(&value, type->member_v2.data); + p_name = (const struct p_string*)&type->member_v2.data[leaf_len];
- codeview_add_udt_element(ctp, symt, terminate_string(p_name), value, + codeview_add_udt_element(ctp, symt, terminate_string(p_name), value, type->member_v2.type);
ptr += 2 + 2 + 4 + leaf_len + (1 + p_name->namelen); break;
case LF_MEMBER_V3: - leaf_len = numeric_leaf(&value, &type->member_v3.offset); - c_name = (const char*)&type->member_v3.offset + leaf_len; + leaf_len = numeric_leaf(&value, type->member_v3.data); + c_name = (const char*)&type->member_v3.data[leaf_len];
codeview_add_udt_element(ctp, symt, c_name, value, type->member_v3.type);
diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index 72626a23a2d..da66b2c2416 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -525,7 +525,8 @@ union codeview_fieldtype unsigned short int id; cv_typ16_t type; short int attribute; - unsigned short int offset; /* numeric leaf */ + unsigned char data[]; + /* <numeric leaf> offset; */ } bclass_v1;
struct @@ -533,7 +534,8 @@ union codeview_fieldtype unsigned short int id; short int attribute; cv_typ_t type; - unsigned short int offset; /* numeric leaf */ + unsigned char data[]; + /* <numeric leaf> offset; */ } bclass_v2;
struct @@ -542,10 +544,9 @@ union codeview_fieldtype cv_typ16_t btype; cv_typ16_t vbtype; short int attribute; - unsigned short int vbpoff; /* numeric leaf */ -#if 0 - unsigned short int vboff; /* numeric leaf */ -#endif + unsigned char data[]; + /* <numeric leaf> vbpoff; */ + /* <numeric leaf> vboff; */ } vbclass_v1;
struct @@ -554,30 +555,27 @@ union codeview_fieldtype short int attribute; cv_typ_t btype; cv_typ_t vbtype; - unsigned short int vbpoff; /* numeric leaf */ -#if 0 - unsigned short int vboff; /* numeric leaf */ -#endif + unsigned char data[]; + /* <numeric leaf> vbpoff; */ + /* <numeric leaf> vboff; */ } vbclass_v2;
struct { unsigned short int id; short int attribute; - unsigned short int value; /* numeric leaf */ -#if 0 - struct p_string p_name; -#endif + unsigned char data[]; + /* <numeric leaf> value; */ + /* struct p_string p_name; */ } enumerate_v1;
struct { unsigned short int id; short int attribute; - unsigned short int value; /* numeric leaf */ -#if 0 - char name[1]; -#endif + unsigned char data[]; + /* <numeric leaf> value; */ + /* char name[]; */ } enumerate_v3;
struct @@ -608,10 +606,9 @@ union codeview_fieldtype unsigned short int id; cv_typ16_t type; short int attribute; - unsigned short int offset; /* numeric leaf */ -#if 0 - struct p_string p_name; -#endif + unsigned char data[]; + /* <numeric leaf> offset; */ + /* struct p_string p_name; */ } member_v1;
struct @@ -619,10 +616,9 @@ union codeview_fieldtype unsigned short int id; short int attribute; cv_typ_t type; - unsigned short int offset; /* numeric leaf */ -#if 0 - struct p_string p_name; -#endif + unsigned char data[]; + /* <numeric leaf> offset; */ + /* struct p_string p_name; */ } member_v2;
struct @@ -630,10 +626,9 @@ union codeview_fieldtype unsigned short int id; short int attribute; cv_typ_t type; - unsigned short int offset; /* numeric leaf */ -#if 0 - char name[1]; -#endif + unsigned char data[]; + /* <numeric leaf> offset; */ + /* char name[]; */ } member_v3;
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c index cb5fbb0b9ad..5e274b730dd 100644 --- a/tools/winedump/msc.c +++ b/tools/winedump/msc.c @@ -52,11 +52,14 @@ struct full_value } v; };
-static int full_numeric_leaf(struct full_value* fv, const unsigned short int* leaf) +/* 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) { - unsigned short int type = *leaf++; + unsigned short int type = *(const unsigned short *)leaf; int length = 2;
+ leaf += length; fv->type = fv_integer; if (type < LF_NUMERIC) { @@ -184,10 +187,12 @@ static const char* full_value_string(const struct full_value* fv) return tmp; }
-static int numeric_leaf(int* value, const unsigned short int* leaf) +/* 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) { struct full_value fv; - int len = full_numeric_leaf(&fv, leaf); + int len = _full_numeric_leaf(&fv, leaf);
switch (fv.type) { @@ -518,24 +523,24 @@ static void do_field(const unsigned char* start, const unsigned char* end) switch (fieldtype->generic.id) { case LF_ENUMERATE_V1: - leaf_len = full_numeric_leaf(&full_value, &fieldtype->enumerate_v1.value); - pstr = PSTRING(&fieldtype->enumerate_v1.value, leaf_len); + leaf_len = full_numeric_leaf(&full_value, fieldtype->enumerate_v1.data); + pstr = (const struct p_string*)&fieldtype->enumerate_v1.data[leaf_len]; printf("\t\tEnumerate V1: '%s' value:%s\n", p_string(pstr), full_value_string(&full_value)); ptr += 2 + 2 + leaf_len + 1 + pstr->namelen; break;
case LF_ENUMERATE_V3: - leaf_len = full_numeric_leaf(&full_value, &fieldtype->enumerate_v3.value); - cstr = (const char*)&fieldtype->enumerate_v3.value + leaf_len; + leaf_len = full_numeric_leaf(&full_value, fieldtype->enumerate_v3.data); + cstr = (const char*)&fieldtype->enumerate_v3.data[leaf_len]; printf("\t\tEnumerate V3: '%s' value:%s\n", cstr, full_value_string(&full_value)); ptr += 2 + 2 + leaf_len + strlen(cstr) + 1; break;
case LF_MEMBER_V1: - leaf_len = numeric_leaf(&value, &fieldtype->member_v1.offset); - pstr = PSTRING(&fieldtype->member_v1.offset, leaf_len); + leaf_len = numeric_leaf(&value, fieldtype->member_v1.data); + pstr = (const struct p_string *)&fieldtype->member_v1.data[leaf_len]; printf("\t\tMember V1: '%s' type:%x attr:%s @%d\n", p_string(pstr), fieldtype->member_v1.type, get_attr(fieldtype->member_v1.attribute), value); @@ -543,8 +548,8 @@ static void do_field(const unsigned char* start, const unsigned char* end) break;
case LF_MEMBER_V2: - leaf_len = numeric_leaf(&value, &fieldtype->member_v2.offset); - pstr = PSTRING(&fieldtype->member_v2.offset, leaf_len); + leaf_len = numeric_leaf(&value, fieldtype->member_v2.data); + pstr = (const struct p_string *)&fieldtype->member_v2.data[leaf_len]; printf("\t\tMember V2: '%s' type:%x attr:%s @%d\n", p_string(pstr), fieldtype->member_v2.type, get_attr(fieldtype->member_v2.attribute), value); @@ -552,10 +557,10 @@ static void do_field(const unsigned char* start, const unsigned char* end) break;
case LF_MEMBER_V3: - leaf_len = numeric_leaf(&value, &fieldtype->member_v3.offset); - cstr = (const char*)&fieldtype->member_v3.offset + leaf_len; + leaf_len = numeric_leaf(&value, fieldtype->member_v3.data); + cstr = (const char*)&fieldtype->member_v3.data[leaf_len]; printf("\t\tMember V3: '%s' type:%x attr:%s @%d\n", - cstr, fieldtype->member_v3.type, + cstr, fieldtype->member_v3.type, get_attr(fieldtype->member_v3.attribute), value); ptr += 2 + 2 + 4 + leaf_len + strlen(cstr) + 1; break; @@ -693,43 +698,43 @@ static void do_field(const unsigned char* start, const unsigned char* end) break;
case LF_BCLASS_V1: - leaf_len = numeric_leaf(&value, &fieldtype->bclass_v1.offset); + leaf_len = numeric_leaf(&value, fieldtype->bclass_v1.data); printf("\t\tBase class V1: type:%x attr:%s @%d\n", - fieldtype->bclass_v1.type, + fieldtype->bclass_v1.type, get_attr(fieldtype->bclass_v1.attribute), value); ptr += 2 + 2 + 2 + leaf_len; break;
case LF_BCLASS_V2: - leaf_len = numeric_leaf(&value, &fieldtype->bclass_v2.offset); + leaf_len = numeric_leaf(&value, fieldtype->bclass_v2.data); printf("\t\tBase class V2: type:%x attr:%s @%d\n", - fieldtype->bclass_v2.type, + fieldtype->bclass_v2.type, get_attr(fieldtype->bclass_v2.attribute), value); ptr += 2 + 2 + 4 + leaf_len; break;
case LF_VBCLASS_V1: case LF_IVBCLASS_V1: - leaf_len = numeric_leaf(&value, &fieldtype->vbclass_v1.vbpoff); + leaf_len = numeric_leaf(&value, fieldtype->vbclass_v1.data); printf("\t\t%sirtual base class V1: type:%x (ptr:%x) attr:%s vbpoff:%d ", (fieldtype->generic.id == LF_VBCLASS_V2) ? "V" : "Indirect v", fieldtype->vbclass_v1.btype, fieldtype->vbclass_v1.vbtype, get_attr(fieldtype->vbclass_v1.attribute), value); ptr += 2 + 2 + 2 + 2 + leaf_len; - leaf_len = numeric_leaf(&value, (const unsigned short*)ptr); + leaf_len = numeric_leaf(&value, ptr); printf("vboff:%d\n", value); ptr += leaf_len; break;
case LF_VBCLASS_V2: case LF_IVBCLASS_V2: - leaf_len = numeric_leaf(&value, &fieldtype->vbclass_v1.vbpoff); + leaf_len = numeric_leaf(&value, fieldtype->vbclass_v1.data); printf("\t\t%sirtual base class V2: type:%x (ptr:%x) attr:%s vbpoff:%d ", (fieldtype->generic.id == LF_VBCLASS_V2) ? "V" : "Indirect v", fieldtype->vbclass_v2.btype, fieldtype->vbclass_v2.vbtype, get_attr(fieldtype->vbclass_v2.attribute), value); ptr += 2 + 2 + 4 + 4 + leaf_len; - leaf_len = numeric_leaf(&value, (const unsigned short*)ptr); + leaf_len = numeric_leaf(&value, ptr); printf("vboff:%d\n", value); ptr += leaf_len; break;
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/msc.c | 12 ++++++------ include/wine/mscvpdb.h | 36 ++++++++++++++++-------------------- tools/winedump/msc.c | 18 +++++++++++------- 3 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 04de7f6491f..815bcedb04a 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -2585,8 +2585,8 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, struct symt* se; VARIANT v;
- vlen = leaf_as_variant(&v, &sym->constant_v1.cvalue); - name = (const struct p_string*)((const char*)&sym->constant_v1.cvalue + vlen); + vlen = leaf_as_variant(&v, sym->constant_v1.data); + name = (const struct p_string*)&sym->constant_v1.data[vlen]; se = codeview_get_type(sym->constant_v1.type, FALSE);
TRACE("S-Constant-V1 %u %s %x\n", V_INT(&v), terminate_string(name), sym->constant_v1.type); @@ -2601,8 +2601,8 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, struct symt* se; VARIANT v;
- vlen = leaf_as_variant(&v, &sym->constant_v2.cvalue); - name = (const struct p_string*)((const char*)&sym->constant_v2.cvalue + vlen); + vlen = leaf_as_variant(&v, sym->constant_v2.data); + name = (const struct p_string*)&sym->constant_v2.data[vlen]; se = codeview_get_type(sym->constant_v2.type, FALSE);
TRACE("S-Constant-V2 %u %s %x\n", V_INT(&v), terminate_string(name), sym->constant_v2.type); @@ -2617,8 +2617,8 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, struct symt* se; VARIANT v;
- vlen = leaf_as_variant(&v, &sym->constant_v3.cvalue); - name = (const char*)&sym->constant_v3.cvalue + vlen; + vlen = leaf_as_variant(&v, sym->constant_v3.data); + name = (const char*)&sym->constant_v3.data[vlen]; se = codeview_get_type(sym->constant_v3.type, FALSE);
TRACE("S-Constant-V3 %u %s %x\n", V_INT(&v), name, sym->constant_v3.type); diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index da66b2c2416..4d0380ee429 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -1661,10 +1661,9 @@ union codeview_symbol unsigned short int len; unsigned short int id; cv_typ16_t type; - unsigned short cvalue; /* numeric leaf */ -#if 0 - struct p_string p_name; -#endif + unsigned char data[]; + /* <numeric leaf> cvalue; */ + /* struct p_string p_name; */ } constant_v1;
struct @@ -1672,10 +1671,9 @@ union codeview_symbol unsigned short int len; unsigned short int id; cv_typ_t type; - unsigned short cvalue; /* numeric leaf */ -#if 0 - struct p_string p_name; -#endif + unsigned char data[]; + /* <numeric leaf> cvalue; */ + /* struct p_string p_name; */ } constant_v2;
struct @@ -1683,10 +1681,9 @@ union codeview_symbol unsigned short int len; unsigned short int id; cv_typ_t type; - unsigned short cvalue; -#if 0 - char name[1]; -#endif + unsigned char data[]; + /* <numeric leaf> cvalue; */ + /* char name; */ } constant_v3;
struct @@ -1896,7 +1893,7 @@ union codeview_symbol unsigned short int id; unsigned int program; struct cv_addr_range range; - struct cv_addr_gap gaps[0]; + struct cv_addr_gap gaps[]; } defrange_v3;
struct @@ -1906,7 +1903,7 @@ union codeview_symbol unsigned int program; unsigned int offParent; struct cv_addr_range range; - struct cv_addr_gap gaps[0]; + struct cv_addr_gap gaps[]; } defrange_subfield_v3;
struct @@ -1916,7 +1913,7 @@ union codeview_symbol unsigned short reg; unsigned short attr; struct cv_addr_range range; - struct cv_addr_gap gaps[0]; + struct cv_addr_gap gaps[]; } defrange_register_v3;
struct @@ -1925,7 +1922,7 @@ union codeview_symbol unsigned short int id; int offFramePointer; struct cv_addr_range range; - struct cv_addr_gap gaps[0]; + struct cv_addr_gap gaps[]; } defrange_frameptrrel_v3;
struct @@ -2003,10 +2000,9 @@ union codeview_symbol unsigned short int len; unsigned short int id; unsigned int count; - cv_typ_t funcs[0]; /* array of cuntions, count entries */ -#if 0 - unsigned int invocations[0]; /* array of count entries, paires with funcs */ -#endif + unsigned char data[]; + /* cv_typ_t functions[count]; */ + /* unsigned int invocations[count]; */ } function_list_v3;
struct diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c index 5e274b730dd..0a638d4bf9f 100644 --- a/tools/winedump/msc.c +++ b/tools/winedump/msc.c @@ -1703,9 +1703,9 @@ BOOL codeview_dump_symbols(const void* root, unsigned long start, unsigned long int vlen; struct full_value fv;
- vlen = full_numeric_leaf(&fv, &sym->constant_v2.cvalue); + vlen = full_numeric_leaf(&fv, sym->constant_v2.data); printf("Constant V2 '%s' = %s type:%x\n", - p_string(PSTRING(&sym->constant_v2.cvalue, vlen)), + p_string((const struct p_string *)&sym->constant_v2.data[vlen]), full_value_string(&fv), sym->constant_v2.type); } break; @@ -1715,9 +1715,9 @@ BOOL codeview_dump_symbols(const void* root, unsigned long start, unsigned long int vlen; struct full_value fv;
- vlen = full_numeric_leaf(&fv, &sym->constant_v3.cvalue); + vlen = full_numeric_leaf(&fv, sym->constant_v3.data); printf("Constant V3 '%s' = %s type:%x\n", - (const char*)&sym->constant_v3.cvalue + vlen, + (const char*)&sym->constant_v3.data[vlen], full_value_string(&fv), sym->constant_v3.type); } break; @@ -1893,6 +1893,7 @@ BOOL codeview_dump_symbols(const void* root, unsigned long start, unsigned long case S_INLINEES: { unsigned i, ninvoc; + const cv_typ_t *functions; const unsigned* invoc; const char* tag;
@@ -1900,12 +1901,15 @@ BOOL codeview_dump_symbols(const void* root, unsigned long start, unsigned long else if (sym->generic.id == S_CALLEES) tag = "Callees"; else tag = "Inlinees"; printf("%s V3 count:%u\n", tag, sym->function_list_v3.count); - invoc = (const unsigned*)&sym->function_list_v3.funcs[sym->function_list_v3.count]; + functions = (const cv_typ_t *)&sym->function_list_v3.data; + invoc = (const unsigned*)&functions[sym->function_list_v3.count]; ninvoc = (const unsigned*)get_last(sym) - invoc; + if (ninvoc < sym->function_list_v3.count) ninvoc = sym->function_list_v3.count;
- for (i = 0; i < sym->function_list_v3.count; ++i) + for (i = 0; i < ninvoc; ++i) printf("%*s| func:%x invoc:%u\n", - indent, "", sym->function_list_v3.funcs[i], i < ninvoc ? invoc[i] : 0); + indent, "", functions[i], invoc[i]); + if (i < sym->function_list_v3.count) printf("Number of entries exceed symbol serialized size\n"); } break;
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),
From: Eric Pouech epouech@codeweavers.com
Removing the migration helpers. Adding some documentation bits.
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/msc.c | 16 +++++++--------- include/wine/mscvpdb.h | 17 +++++++++++------ 2 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 73d5a8e23f4..6250061296e 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -269,9 +269,7 @@ static void codeview_init_basic_types(struct module* module) cv_basic_types[T_PUINT8] = &symt_new_pointer(module, cv_basic_types[T_UINT8], ptrsz)->symt; }
-/* wrapper for migration to FAM */ -#define leaf_as_variant(v, l) _leaf_as_variant((v), (const unsigned char*)(l)) -static int _leaf_as_variant(VARIANT *v, const unsigned char *leaf) +static int leaf_as_variant(VARIANT *v, const unsigned char *leaf) { unsigned short int type = *(const unsigned short *)leaf; int length = 2; @@ -397,9 +395,7 @@ static int _leaf_as_variant(VARIANT *v, const unsigned char *leaf) return length; }
-/* 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) { unsigned short int type = *(const unsigned short int *)leaf; int length = 2; @@ -1581,6 +1577,7 @@ static void codeview_snarf_linetab(const struct msc_debug_info* msc_dbg, const B unsigned int k; const unsigned int* filetab; const unsigned int* lt_ptr; + const unsigned int* offsets; const unsigned short* linenos; const struct startend* start; unsigned source; @@ -1609,13 +1606,14 @@ static void codeview_snarf_linetab(const struct msc_debug_info* msc_dbg, const B for (j = 0; j < nseg; j++) { ltb = (const struct codeview_linetab_block*)(linetab + *lt_ptr++); - linenos = (const unsigned short*)<b->offsets[ltb->num_lines]; + offsets = (const unsigned int*)<b->data; + linenos = (const unsigned short*)&offsets[ltb->num_lines]; func_addr0 = codeview_get_address(msc_dbg, ltb->seg, start[j].start); if (!func_addr0) continue; for (func = NULL, k = 0; k < ltb->num_lines; k++) { /* now locate function (if any) */ - addr = func_addr0 + ltb->offsets[k] - start[j].start; + addr = func_addr0 + offsets[k] - start[j].start; /* unfortunately, we can have several functions in the same block, if there's no * gap between them... find the new function if needed */ @@ -1626,7 +1624,7 @@ static void codeview_snarf_linetab(const struct msc_debug_info* msc_dbg, const B if (!symt_check_tag(&func->symt, SymTagFunction) && !symt_check_tag(&func->symt, SymTagInlineSite)) { WARN("--not a func at %04x:%08x %Ix tag=%d\n", - ltb->seg, ltb->offsets[k], addr, func ? func->symt.tag : -1); + ltb->seg, offsets[k], addr, func ? func->symt.tag : -1); func = NULL; break; } diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index 560d3cc08d6..d389d5d22d0 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -83,10 +83,11 @@ * symbol size (to be greater than 256), which was likely needed for * complex C++ types (nested + templates). * - * It's somehow difficult to represent the layout of those types on - * disk because: - * - some integral values are stored as numeric leaf, which size is - * variable depending on its value + * It's not possible to represent some disk layout with C structures + * as there are several contiguous entries of variable length. + * Of example of them is called 'numeric leaf' and represent several + * leaf values (integers, reals...). + * All of these contiguous values are packed in a flexible array member. * * Symbols internal stream * ----------------------- @@ -101,6 +102,9 @@ * Internal types * ======================================== */
+/* First versions (v1, v2) of CV data is stored as Pascal strings. + * Third version uses C string instead. + */ struct p_string { unsigned char namelen; @@ -2342,8 +2346,9 @@ struct codeview_linetab_block { unsigned short seg; unsigned short num_lines; - unsigned int offsets[1]; /* in fact num_lines */ -/* unsigned short linenos[]; */ + unsigned char data[]; + /* unsigned int offsets[num_lines]; */ + /* unsigned short linenos[]; */ };
struct startend
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147052
Your paranoid android.
=== debian11b (64 bit WoW report) ===
ddraw: ddraw1.c:3645: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31969).