Eric Pouech : mscvpdb.h: Use bitfield for defrange's variable flag.

Alexandre Julliard julliard at winehq.org
Tue Jul 12 16:45:37 CDT 2022


Module: wine
Branch: master
Commit: 437e73883bd73eb219ba722b2fbba6398fc75343
URL:    https://gitlab.winehq.org/wine/wine/-/commit/437e73883bd73eb219ba722b2fbba6398fc75343

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Tue Jul 12 09:28:57 2022 +0200

mscvpdb.h: Use bitfield for defrange's variable flag.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---

 dlls/dbghelp/msc.c     |  2 +-
 include/wine/mscvpdb.h | 22 ++++++++++++++++++++--
 tools/winedump/msc.c   | 28 ++++++++++++++--------------
 3 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index ce2ad9b4e01..e34853b45e8 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -2569,7 +2569,7 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg,
         case S_LOCAL:
             length += codeview_transform_defrange(msc_dbg, curr_func, sym, &loc);
             symt_add_func_local(msc_dbg->module, curr_func,
-                                sym->local_v3.varflags & 0x0001 ? DataIsParam : DataIsLocal,
+                                sym->local_v3.varflags.is_param ? DataIsParam : DataIsLocal,
                                 &loc, block,
                                 codeview_get_type(sym->local_v3.symtype, FALSE),
                                 sym->local_v3.name);
diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h
index 8fb30d25cc6..994165463f3 100644
--- a/include/wine/mscvpdb.h
+++ b/include/wine/mscvpdb.h
@@ -1374,6 +1374,24 @@ struct cv_addr_gap
     unsigned short              cbRange;
 };
 
+struct cv_local_varflag
+{
+    unsigned short is_param          : 1;
+    unsigned short address_taken     : 1;
+    unsigned short from_compiler     : 1; /* generated by compiler */
+    unsigned short is_aggregate      : 1; /* splitted in several variables by compiler */
+    unsigned short from_aggregate    : 1; /* marks a temporary from an aggregate */
+    unsigned short is_aliased        : 1;
+    unsigned short from_alias        : 1;
+    unsigned short is_return_value   : 1;
+    unsigned short optimized_out     : 1;
+    unsigned short enreg_global      : 1; /* global variable accessed from register */
+    unsigned short enreg_static      : 1;
+
+    unsigned short unused            : 5;
+
+};
+
 union codeview_symbol
 {
     struct
@@ -1874,7 +1892,7 @@ union codeview_symbol
         unsigned short int      len;
         unsigned short int      id;
         cv_typ_t                symtype;
-        unsigned short          varflags;
+        struct cv_local_varflag varflags;
         char                    name[1];
     } local_v3;
 
@@ -2003,7 +2021,7 @@ union codeview_symbol
         unsigned short int      id;
         cv_typ_t                typind;
         unsigned int            modOffset;
-        unsigned short          varflags;
+        struct cv_local_varflag varflags;
         char                    name[1];
     } file_static_v3;
 
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c
index 8c38dd1819e..85bbdfc3487 100644
--- a/tools/winedump/msc.c
+++ b/tools/winedump/msc.c
@@ -275,27 +275,27 @@ static const char* get_funcattr(unsigned attr)
     return tmp;
 }
 
-static const char* get_varflags(unsigned flags)
+static const char* get_varflags(struct cv_local_varflag flags)
 {
     static char tmp[1024];
     unsigned    pos = 0;
 
-    if (!flags) return "none";
 #define X(s) {if (pos) tmp[pos++] = ';'; strcpy(tmp + pos, s); pos += strlen(s);}
-    if (flags & 0x0001) X("param");
-    if (flags & 0x0002) X("addr-taken");
-    if (flags & 0x0004) X("compiler-gen");
-    if (flags & 0x0008) X("aggregated");
-    if (flags & 0x0010) X("in-aggregate");
-    if (flags & 0x0020) X("aliased");
-    if (flags & 0x0040) X("alias");
-    if (flags & 0x0080) X("retval");
-    if (flags & 0x0100) X("optimized-out");
-    if (flags & 0x0200) X("enreg-global");
-    if (flags & 0x0400) X("enreg-static");
-    if (flags & 0xf800) pos += sprintf(tmp, "unk:%x", flags & 0xf800);
+    if (flags.is_param)        X("param");
+    if (flags.address_taken)   X("addr-taken");
+    if (flags.from_compiler)   X("compiler-gen");
+    if (flags.is_aggregate)    X("aggregated");
+    if (flags.from_aggregate)  X("in-aggregate");
+    if (flags.is_aliased)      X("aliased");
+    if (flags.from_alias)      X("alias");
+    if (flags.is_return_value) X("retval");
+    if (flags.optimized_out)   X("optimized-out");
+    if (flags.enreg_global)    X("enreg-global");
+    if (flags.enreg_static)    X("enreg-static");
+    if (flags.unused)          pos += sprintf(tmp, "unk:%x", flags.unused);
 #undef X
 
+    if (!pos) return "none";
     tmp[pos] = '\0';
     assert(pos < sizeof(tmp));
 




More information about the wine-cvs mailing list