提交 dc9125ae 编写于 作者: A acasey

DevDiv #1019283: Part 2 - Consuming the attributes field on local debug info

On its own, this change seems kind of silly - instead of consuming a mangled name from the PDB, we set the name to null.  The main benefit is that other PDB producers have a way to communicate to the EE that certain locals should not be consumed, regardless of how they are named. (changeset 1332108)
上级 4e7a9566
......@@ -12,7 +12,7 @@ namespace Roslyn.Utilities.Pdb
internal interface ISymUnmanagedVariable
{
void GetName(int cchName, out int pcchName, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] char[] name);
void GetAttributes(out int pRetVal);
void GetAttributes(out uint pRetVal);
void GetSignature(int cSig, out int pcSig, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] sig);
// the following methods are useless (not implemented, or returning a constant):
......
......@@ -31,7 +31,7 @@ internal static ISymUnmanagedMethod GetBaselineMethod(this ISymUnmanagedReader r
/// <summary>
/// Returns local names indexed by slot.
/// </summary>
internal static ImmutableArray<string> GetLocalNames(this ISymUnmanagedReader symReader, int methodToken, int ilOffset, bool isScopeEndInclusive)
internal static ImmutableArray<string> GetLocalNames(this ISymUnmanagedReader symReader, int methodToken, int ilOffset, bool isScopeEndInclusive, uint? attributesToIgnore)
{
if (symReader == null)
{
......@@ -39,15 +39,15 @@ internal static ImmutableArray<string> GetLocalNames(this ISymUnmanagedReader sy
}
var symMethod = symReader.GetBaselineMethod(methodToken);
return symMethod.GetLocalVariableSlots(ilOffset, isScopeEndInclusive);
return symMethod.GetLocalVariableSlots(ilOffset, isScopeEndInclusive, attributesToIgnore);
}
internal static ImmutableArray<string> GetLocalVariableSlots(this ISymUnmanagedMethod method)
{
return GetLocalVariableSlots(method, offset: -1, isScopeEndInclusive: false);
return GetLocalVariableSlots(method, offset: -1, isScopeEndInclusive: false, attributesToIgnoreOpt: null);
}
internal static ImmutableArray<string> GetLocalVariableSlots(this ISymUnmanagedMethod method, int offset, bool isScopeEndInclusive)
internal static ImmutableArray<string> GetLocalVariableSlots(this ISymUnmanagedMethod method, int offset, bool isScopeEndInclusive, uint? attributesToIgnoreOpt)
{
char[] nameBuffer = null;
string[] result = null;
......@@ -57,8 +57,21 @@ internal static ImmutableArray<string> GetLocalVariableSlots(this ISymUnmanagedM
ISymUnmanagedVariable[] localsBuffer = null;
bool haveAttributesToIgnore = attributesToIgnoreOpt.HasValue;
uint attributesToIgnore = attributesToIgnoreOpt.GetValueOrDefault();
ForEachLocalVariableRecursive(rootScope, offset, isScopeEndInclusive, ref localsBuffer, local =>
{
if (haveAttributesToIgnore)
{
uint attributes;
local.GetAttributes(out attributes);
if (attributes == attributesToIgnore)
{
return;
}
}
int nameLength;
local.GetName(0, out nameLength, null);
......@@ -77,7 +90,7 @@ internal static ImmutableArray<string> GetLocalVariableSlots(this ISymUnmanagedM
EnsureBufferSize(ref result, slot + 1);
// nameLength is NUL-terminated
// nameBuffer is NUL-terminated
Debug.Assert(nameBuffer[nameLength - 1] == '\0');
result[slot] = new string(nameBuffer, 0, nameLength - 1);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册