Module: wine Branch: master Commit: 88a28aa5757ae74d9997b470d70216f10974247f URL: https://gitlab.winehq.org/wine/wine/-/commit/88a28aa5757ae74d9997b470d70216f...
Author: Eric Pouech epouech@codeweavers.com Date: Tue Jun 18 16:57:51 2024 +0200
include/mscvpdb.h: Use flexible array members for the rest of structures.
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