Fix 'this' pointer in struct methods (#10668)
authorIgor Kulaychuk <igor.kulaychuk@gmail.com>
Tue, 4 Apr 2017 00:10:40 +0000 (03:10 +0300)
committerJan Vorlicek <janvorli@microsoft.com>
Tue, 4 Apr 2017 00:10:40 +0000 (02:10 +0200)
The 'this' method argument should always be a pointer.

src/vm/gdbjit.cpp

index 30a6a38..1f2bedf 100644 (file)
@@ -398,7 +398,10 @@ HRESULT FunctionMember::GetLocalsDebugInfo(NotifyGdb::PTK_TypeInfoMap pTypeMap,
     {
         if (FindNativeInfoInILVariable(0, startNativeOffset, &locals.pVars, locals.countVars, &nativeVar) == S_OK)
         {
-            vars[0].m_var_type = GetTypeInfoFromTypeHandle(TypeHandle(md->GetMethodTable()), pTypeMap, method);
+            TypeHandle th = TypeHandle(md->GetMethodTable());
+            if (th.IsValueType())
+                th = th.MakePointer();
+            vars[0].m_var_type = GetTypeInfoFromTypeHandle(th, pTypeMap, method);
             vars[0].m_var_name = new char[strlen("this") + 1];
             strcpy(vars[0].m_var_name, "this");
             vars[0].m_il_index = 0;