Eric Pouech : winedump: Dump calling convention attributes for CodeView.

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


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

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

winedump: Dump calling convention attributes for CodeView.

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

---

 dlls/dbghelp/msc.c     |  8 ++++----
 include/cvconst.h      |  3 +++
 include/wine/mscvpdb.h |  8 ++++----
 tools/winedump/msc.c   | 56 +++++++++++++++++++++++++++++++++++++++++++-------
 4 files changed, 60 insertions(+), 15 deletions(-)

diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index b6811ea97f5..25300aa6f90 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -1288,7 +1288,7 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
         break;
 
     case LF_PROCEDURE_V1:
-        symt = codeview_new_func_signature(ctp, existing, type->procedure_v1.call);
+        symt = codeview_new_func_signature(ctp, existing, type->procedure_v1.callconv);
         if (details)
         {
             codeview_add_type(curr_type, symt);
@@ -1299,7 +1299,7 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
         }
         break;
     case LF_PROCEDURE_V2:
-        symt = codeview_new_func_signature(ctp, existing,type->procedure_v2.call);
+        symt = codeview_new_func_signature(ctp, existing,type->procedure_v2.callconv);
         if (details)
         {
             codeview_add_type(curr_type, symt);
@@ -1314,7 +1314,7 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
         /* FIXME: for C++, this is plain wrong, but as we don't use arg types
          * nor class information, this would just do for now
          */
-        symt = codeview_new_func_signature(ctp, existing, type->mfunction_v1.call);
+        symt = codeview_new_func_signature(ctp, existing, type->mfunction_v1.callconv);
         if (details)
         {
             codeview_add_type(curr_type, symt);
@@ -1328,7 +1328,7 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
         /* FIXME: for C++, this is plain wrong, but as we don't use arg types
          * nor class information, this would just do for now
          */
-        symt = codeview_new_func_signature(ctp, existing, type->mfunction_v2.call);
+        symt = codeview_new_func_signature(ctp, existing, type->mfunction_v2.callconv);
         if (details)
         {
             codeview_add_type(curr_type, symt);
diff --git a/include/cvconst.h b/include/cvconst.h
index 39829c73592..95fdc9c73e5 100644
--- a/include/cvconst.h
+++ b/include/cvconst.h
@@ -720,6 +720,9 @@ typedef enum CV_call_e
     CV_CALL_TRICALL,
     CV_CALL_SH5CALL,
     CV_CALL_M32RCALL,
+    CV_CALL_CLRCALL,
+    CV_CALL_INLINE,
+    CV_CALL_NEAR_VECTOR,
     CV_CALL_RESERVED,
 } CV_call_e;
 
diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h
index 87156041efa..036c65df0c1 100644
--- a/include/wine/mscvpdb.h
+++ b/include/wine/mscvpdb.h
@@ -308,7 +308,7 @@ union codeview_type
         unsigned short int      len;
         short int               id;
         unsigned short int      rvtype;
-        unsigned char           call;
+        unsigned char           callconv;
         unsigned char           funcattr;
         unsigned short int      params;
         unsigned short int      arglist;
@@ -319,7 +319,7 @@ union codeview_type
         unsigned short int      len;
         short int               id;
         unsigned int            rvtype;
-        unsigned char           call;
+        unsigned char           callconv;
         unsigned char           funcattr;
         unsigned short int      params;
         unsigned int            arglist;
@@ -332,7 +332,7 @@ union codeview_type
         unsigned short int      rvtype;
         unsigned short int      class_type;
         unsigned short int      this_type;
-        unsigned char           call;
+        unsigned char           callconv;
         unsigned char           funcattr;
         unsigned short int      params;
         unsigned short int      arglist;
@@ -346,7 +346,7 @@ union codeview_type
         unsigned int            rvtype;
         unsigned int            class_type;
         unsigned                this_type;
-        unsigned char           call;
+        unsigned char           callconv;
         unsigned char           funcattr;
         unsigned short          params;
         unsigned int            arglist;
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c
index 12229a615f7..4885bb6e0b0 100644
--- a/tools/winedump/msc.c
+++ b/tools/winedump/msc.c
@@ -410,6 +410,49 @@ static const char* get_language(unsigned l)
     return lang;
 }
 
+static const char* get_callconv(unsigned cc)
+{
+    const char* callconv;
+
+    switch (cc)
+    {
+    case CV_CALL_NEAR_C:        callconv = "near C"; break;
+    case CV_CALL_FAR_C:         callconv = "far C"; break;
+    case CV_CALL_NEAR_PASCAL:   callconv = "near pascal"; break;
+    case CV_CALL_FAR_PASCAL:    callconv = "far pascal"; break;
+    case CV_CALL_NEAR_FAST:     callconv = "near fast"; break;
+    case CV_CALL_FAR_FAST:      callconv = "far fast"; break;
+    case CV_CALL_SKIPPED:       callconv = "skipped"; break;
+    case CV_CALL_NEAR_STD:      callconv = "near std"; break;
+    case CV_CALL_FAR_STD:       callconv = "far std"; break;
+    case CV_CALL_NEAR_SYS:      callconv = "near sys"; break;
+    case CV_CALL_FAR_SYS:       callconv = "far sys"; break;
+    case CV_CALL_THISCALL:      callconv = "this call"; break;
+    case CV_CALL_MIPSCALL:      callconv = "mips call"; break;
+    case CV_CALL_GENERIC:       callconv = "generic"; break;
+    case CV_CALL_ALPHACALL:     callconv = "alpha call"; break;
+    case CV_CALL_PPCCALL:       callconv = "ppc call"; break;
+    case CV_CALL_SHCALL:        callconv = "sh call"; break;
+    case CV_CALL_ARMCALL:       callconv = "arm call"; break;
+    case CV_CALL_AM33CALL:      callconv = "am33 call"; break;
+    case CV_CALL_TRICALL:       callconv = "tri call"; break;
+    case CV_CALL_SH5CALL:       callconv = "sh5 call"; break;
+    case CV_CALL_M32RCALL:      callconv = "m32r call"; break;
+    case CV_CALL_CLRCALL:       callconv = "clr call"; break;
+    case CV_CALL_INLINE:        callconv = "inline"; break;
+    case CV_CALL_NEAR_VECTOR:   callconv = "near vector"; break;
+    case CV_CALL_RESERVED:      callconv = "reserved"; break;
+    default:
+        {
+            static char tmp[16];
+            sprintf(tmp, "callconv=%x", cc);
+            callconv = tmp;
+        }
+        break;
+    }
+    return callconv;
+}
+
 static void do_field(const unsigned char* start, const unsigned char* end)
 {
     /*
@@ -883,26 +926,25 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
         break;
 
     case LF_PROCEDURE_V1:
-        /* FIXME: unknown could be the calling convention for the proc */
-        printf("\t%x => Procedure V1 ret_type:%x call:%x attr:%s (#%u args_type:%x)\n",
+        printf("\t%x => Procedure V1 ret_type:%x callconv:%s attr:%s (#%u args_type:%x)\n",
                curr_type, type->procedure_v1.rvtype,
-               type->procedure_v1.call, get_funcattr(type->procedure_v1.funcattr),
+               get_callconv(type->procedure_v1.callconv), 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 attr:%s (#%u args_type:%x)\n",
+        printf("\t%x => Procedure V2 ret_type:%x callconv:%s attr:%s (#%u args_type:%x)\n",
                curr_type, type->procedure_v2.rvtype,
-               type->procedure_v2.call, get_funcattr(type->procedure_v2.funcattr),
+               get_callconv(type->procedure_v2.callconv), get_funcattr(type->procedure_v1.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 attr:%s\n"
+        printf("\t%x => MFunction V2 ret-type:%x callconv:%s 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,
+               get_callconv(type->mfunction_v2.callconv),
                type->mfunction_v2.class_type,
                type->mfunction_v2.this_type,
                get_funcattr(type->mfunction_v2.funcattr),




More information about the wine-cvs mailing list