Eric Pouech : winedump: Display function attributes in function/methods codeview records.

Alexandre Julliard julliard at winehq.org
Mon Aug 23 16:24:13 CDT 2021


Module: wine
Branch: master
Commit: 1d9c8846b910eeaff5c5bf92d61b9ece1a8f5eb1
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1d9c8846b910eeaff5c5bf92d61b9ece1a8f5eb1

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Sat Aug 21 10:22:42 2021 +0200

winedump: Display function attributes in function/methods codeview records.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/wine/mscvpdb.h |  8 ++++----
 tools/winedump/msc.c   | 34 +++++++++++++++++++++++++++-------
 2 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h
index 1f7f1f305f2..87156041efa 100644
--- a/include/wine/mscvpdb.h
+++ b/include/wine/mscvpdb.h
@@ -309,7 +309,7 @@ union codeview_type
         short int               id;
         unsigned short int      rvtype;
         unsigned char           call;
-        unsigned char           reserved;
+        unsigned char           funcattr;
         unsigned short int      params;
         unsigned short int      arglist;
     } procedure_v1;
@@ -320,7 +320,7 @@ union codeview_type
         short int               id;
         unsigned int            rvtype;
         unsigned char           call;
-        unsigned char           reserved;
+        unsigned char           funcattr;
         unsigned short int      params;
         unsigned int            arglist;
     } procedure_v2;
@@ -333,7 +333,7 @@ union codeview_type
         unsigned short int      class_type;
         unsigned short int      this_type;
         unsigned char           call;
-        unsigned char           reserved;
+        unsigned char           funcattr;
         unsigned short int      params;
         unsigned short int      arglist;
         unsigned int            this_adjust;
@@ -347,7 +347,7 @@ union codeview_type
         unsigned int            class_type;
         unsigned                this_type;
         unsigned char           call;
-        unsigned char           reserved;
+        unsigned char           funcattr;
         unsigned short          params;
         unsigned int            arglist;
         unsigned int            this_adjust;
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c
index 2155d876696..12229a615f7 100644
--- a/tools/winedump/msc.c
+++ b/tools/winedump/msc.c
@@ -265,6 +265,25 @@ static const char* get_property(unsigned prop)
     return tmp;
 }
 
+static const char* get_funcattr(unsigned attr)
+{
+    static char tmp[1024];
+    unsigned    pos = 0;
+
+    if (!attr) return "none";
+#define X(s) {if (pos) tmp[pos++] = ';'; strcpy(tmp + pos, s); pos += strlen(s);}
+    if (attr & 0x0001) X("C++ReturnUDT");
+    if (attr & 0x0002) X("Ctor");
+    if (attr & 0x0004) X("Ctor-w/virtualbase");
+    if (attr & 0xfff8) pos += sprintf(tmp, "unk:%x", attr & 0xfff8);
+#undef X
+
+    tmp[pos] = '\0';
+    assert(pos < sizeof(tmp));
+
+    return tmp;
+}
+
 static const char* get_machine(unsigned m)
 {
     const char*     machine;
@@ -865,27 +884,28 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
 
     case LF_PROCEDURE_V1:
         /* FIXME: unknown could be the calling convention for the proc */
-        printf("\t%x => Procedure V1 ret_type:%x call:%x (#%u args_type:%x)\n",
+        printf("\t%x => Procedure V1 ret_type:%x call:%x attr:%s (#%u args_type:%x)\n",
                curr_type, type->procedure_v1.rvtype,
-               type->procedure_v1.call, type->procedure_v1.params,
-               type->procedure_v1.arglist);
+               type->procedure_v1.call, get_funcattr(type->procedure_v1.funcattr),
+               type->procedure_v1.params, type->procedure_v1.arglist);
         break;
 
     case LF_PROCEDURE_V2:
-        printf("\t%x => Procedure V2 ret_type:%x unk:%x (#%u args_type:%x)\n",
+        printf("\t%x => Procedure V2 ret_type:%x unk:%x attr:%s (#%u args_type:%x)\n",
                curr_type, type->procedure_v2.rvtype,
-               type->procedure_v2.call, type->procedure_v2.params,
-               type->procedure_v2.arglist);
+               type->procedure_v2.call, get_funcattr(type->procedure_v2.funcattr),
+               type->procedure_v2.params, type->procedure_v2.arglist);
         break;
 
     case LF_MFUNCTION_V2:
-        printf("\t%x => MFunction V2 ret-type:%x call:%x class-type:%x this-type:%x\n"
+        printf("\t%x => MFunction V2 ret-type:%x call:%x class-type:%x this-type:%x attr:%s\n"
                "\t\t#args:%x args-type:%x this_adjust:%x\n",
                curr_type,
                type->mfunction_v2.rvtype,
                type->mfunction_v2.call,
                type->mfunction_v2.class_type,
                type->mfunction_v2.this_type,
+               get_funcattr(type->mfunction_v2.funcattr),
                type->mfunction_v2.params,
                type->mfunction_v2.arglist,
                type->mfunction_v2.this_adjust);




More information about the wine-cvs mailing list