[PATCH 08/13] [DbgHelp]: MSC handling of function signature's parameters

Eric Pouech eric.pouech at wanadoo.fr
Sat Mar 18 06:33:00 CST 2006


- now correctly parsing parameters types for a function
  signature and storing them in dbghelp internal structures

A+
---

 dlls/dbghelp/msc.c     |   53 +++++++++++++++++++++++++++++++++++++-----------
 dlls/dbghelp/mscvpdb.h |   16 ++++++++++++++
 2 files changed, 57 insertions(+), 12 deletions(-)

diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index aa1122a..c8db442 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -684,14 +684,39 @@ static int codeview_add_type_struct(stru
     return codeview_add_type(typeno, &symt->symt);
 }
 
-static int codeview_new_func_signature(struct module* module, unsigned typeno,
-                                       unsigned ret_type, enum CV_call_e call_conv)
-{
-    struct symt* symt;
-    symt = &symt_new_function_signature(module, 
-                                        codeview_get_type(ret_type, FALSE),
-                                        call_conv)->symt;
-    return codeview_add_type(typeno, symt);
+static int codeview_new_func_signature(struct codeview_type_parse* ctp, 
+                                       unsigned typeno, unsigned ret_type,
+                                       unsigned args_list, enum CV_call_e call_conv)
+{
+    struct symt_function_signature*     sym;
+    const union codeview_reftype*       reftype;
+
+    sym = symt_new_function_signature(ctp->module, codeview_get_type(ret_type, FALSE),
+                                      call_conv);
+    reftype = codeview_jump_to_type(ctp, args_list);
+    if (reftype)
+    {
+        int i;
+        switch (reftype->generic.id)
+        {
+        case LF_ARGLIST_V1:
+            for (i = 0; i < reftype->arglist_v1.num; i++)
+                symt_add_function_signature_parameter(ctp->module, sym,
+                                                      codeview_get_type(reftype->arglist_v1.args[i],
+                                                                        FALSE));
+            break;
+        case LF_ARGLIST_V2:
+            for (i = 0; i < reftype->arglist_v2.num; i++)
+                symt_add_function_signature_parameter(ctp->module, sym,
+                                                      codeview_get_type(reftype->arglist_v2.args[i],
+                                                                        FALSE));
+            break;
+        default:
+            FIXME("Unexpected leaf %x for signature's pmt\n", reftype->generic.id);
+        }
+    }
+
+    return codeview_add_type(typeno, &sym->symt);
 }
 
 static int codeview_parse_type_table(struct codeview_type_parse* ctp)
@@ -854,29 +879,33 @@ static int codeview_parse_type_table(str
             break;
 
         case LF_PROCEDURE_V1:
-            retv = codeview_new_func_signature(ctp->module, curr_type, 
+            retv = codeview_new_func_signature(ctp, curr_type, 
                                                type->procedure_v1.rvtype,
+                                               type->procedure_v1.arglist,
                                                type->procedure_v1.call);
             break;
         case LF_PROCEDURE_V2:
-            retv = codeview_new_func_signature(ctp->module, curr_type, 
+            retv = codeview_new_func_signature(ctp, curr_type, 
                                                type->procedure_v2.rvtype,
+                                               type->procedure_v2.arglist,
                                                type->procedure_v2.call);
             break;
         case LF_MFUNCTION_V1:
             /* FIXME: for C++, this is plain wrong, but as we don't use arg types
              * nor class information, this would just do for now
              */
-            retv = codeview_new_func_signature(ctp->module, curr_type,
+            retv = codeview_new_func_signature(ctp, curr_type,
                                                type->mfunction_v1.rvtype,
+                                               type->mfunction_v1.arglist,
                                                type->mfunction_v1.call);
             break;
         case LF_MFUNCTION_V2:
             /* FIXME: for C++, this is plain wrong, but as we don't use arg types
              * nor class information, this would just do for now
              */
-            retv = codeview_new_func_signature(ctp->module, curr_type,
+            retv = codeview_new_func_signature(ctp, curr_type,
                                                type->mfunction_v2.rvtype,
+                                               type->mfunction_v2.arglist,
                                                type->mfunction_v2.call);
             break;
 
diff --git a/dlls/dbghelp/mscvpdb.h b/dlls/dbghelp/mscvpdb.h
index f106ba7..01796dd 100644
--- a/dlls/dbghelp/mscvpdb.h
+++ b/dlls/dbghelp/mscvpdb.h
@@ -387,6 +387,22 @@ union codeview_reftype
         unsigned char           bitoff;
     } bitfield_v2;
 
+    struct
+    {
+        unsigned short int      len;
+        short int               id;
+        unsigned short          num;
+        unsigned short          args[1];
+    } arglist_v1;
+
+    struct
+    {
+        unsigned short int      len;
+        short int               id;
+        unsigned                num;
+        unsigned                args[1];
+    } arglist_v2;
+
 };
 
 union codeview_fieldtype





More information about the wine-patches mailing list