Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support emitting PortablePDB #486

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/IKVM.Reflection/Emit/ILGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,8 @@ internal ILGenerator(ModuleBuilder moduleBuilder, int initialCapacity)
this.moduleBuilder = moduleBuilder;
this.locals = SignatureHelper.GetLocalVarSigHelper(moduleBuilder);

#if NETFRAMEWORK
if (moduleBuilder.symbolWriter != null)
scope = new Scope(null);
#endif
}

// non-standard API
Expand Down Expand Up @@ -825,13 +823,11 @@ public void ThrowException(Type excType)

internal int WriteBody(bool initLocals)
{
#if NETFRAMEWORK
if (moduleBuilder.symbolWriter != null)
{
Debug.Assert(scope != null && scope.parent == null);
scope.endOffset = code.Position;
}
#endif

ResolveBranches();

Expand All @@ -854,8 +850,6 @@ internal int WriteBody(bool initLocals)
rva = WriteFatHeaderAndCode(bb, localVarSigTok, initLocals);
}

#if NETFRAMEWORK

if (moduleBuilder.symbolWriter != null)
{
if (sequencePoints.Count != 0)
Expand Down Expand Up @@ -885,8 +879,6 @@ internal int WriteBody(bool initLocals)
WriteScope(scope, localVarSigTok);
}

#endif

return rva;
}

Expand Down Expand Up @@ -1045,7 +1037,6 @@ internal static void AddTokenFixups(int codeOffset, List<int> tokenFixupOffsets,

void WriteScope(Scope scope, int localVarSigTok)
{
#if NETFRAMEWORK
moduleBuilder.symbolWriter.OpenScope(scope.startOffset);

foreach (var local in scope.locals)
Expand All @@ -1071,9 +1062,6 @@ void WriteScope(Scope scope, int localVarSigTok)
WriteScope(child, localVarSigTok);

moduleBuilder.symbolWriter.CloseScope(scope.endOffset);
#else
throw new NotSupportedException();
#endif
}

}
Expand Down
5 changes: 1 addition & 4 deletions src/IKVM.Reflection/Emit/MethodBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,11 @@ public void __ReleaseILGenerator()
{
if (ilgen != null)
{
#if NETFRAMEWORK
ModuleBuilder.symbolWriter?.OpenMethod(new SymbolToken(-pseudoToken | 0x06000000), this);
#endif

rva = ilgen.WriteBody(initLocals);

#if NETFRAMEWORK
ModuleBuilder.symbolWriter?.CloseMethod();
#endif

ilgen = null;
}
Expand Down Expand Up @@ -658,6 +654,7 @@ internal ModuleBuilder ModuleBuilder

internal void WriteMethodDefRecord(int baseRVA, MetadataWriter mw, ref int paramList)
{
RowNumber = mw.GetNewMethodDefRowId();
if (rva != -1)
mw.Write(rva + baseRVA);
else
Expand Down
22 changes: 0 additions & 22 deletions src/IKVM.Reflection/Emit/ModuleBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ public sealed class ModuleBuilder : Module, ITypeOwner
readonly AssemblyBuilder asm;
internal readonly string moduleName;
internal readonly string fileName;
#if NETFRAMEWORK
internal readonly ISymbolWriterImpl symbolWriter;
#endif
readonly TypeBuilder moduleType;
readonly List<TypeBuilder> types = new List<TypeBuilder>();
readonly Dictionary<Type, int> typeTokens = new Dictionary<Type, int>();
Expand Down Expand Up @@ -245,17 +243,13 @@ internal ModuleBuilder(AssemblyBuilder asm, string moduleName, string fileName,
this.moduleName = moduleName;
this.fileName = fileName;

#if NETFRAMEWORK

if (emitSymbolInfo)
{
symbolWriter = SymbolSupport.CreateSymbolWriterFor(this);
if (universe.Deterministic && !symbolWriter.IsDeterministic)
throw new NotSupportedException();
}

#endif

if (!universe.Deterministic)
{
__PEHeaderTimeDateStamp = DateTime.UtcNow;
Expand Down Expand Up @@ -663,11 +657,7 @@ internal override void GetTypesImpl(List<Type> list)

public ISymbolDocumentWriter DefineDocument(string url, Guid language, Guid languageVendor, Guid documentType)
{
#if NETFRAMEWORK
return symbolWriter.DefineDocument(url, language, languageVendor, documentType);
#else
throw new NotSupportedException();
#endif
}

public int __GetAssemblyToken(Assembly assembly)
Expand Down Expand Up @@ -943,7 +933,6 @@ private int FindOrAddAssemblyRef(AssemblyName name, bool alwaysAdd)

internal void WriteSymbolTokenMap()
{
#if NETFRAMEWORK
for (int i = 0; i < resolvedTokens.Count; i++)
{
int newToken = resolvedTokens[i];
Expand All @@ -953,9 +942,6 @@ internal void WriteSymbolTokenMap()
int oldToken = (i + 1) | (newToken & ~0xFFFFFF);
SymbolSupport.RemapToken(symbolWriter, oldToken, newToken);
}
#else
throw new NotSupportedException();
#endif
}

internal void RegisterTokenFixup(int pseudoToken, int realToken)
Expand Down Expand Up @@ -1415,11 +1401,7 @@ public override string ScopeName

public ISymbolWriter GetSymWriter()
{
#if NETFRAMEWORK
return symbolWriter;
#else
return null;
#endif
}

public void DefineUnmanagedResource(string resourceFileName)
Expand All @@ -1443,14 +1425,10 @@ public void SetUserEntryPoint(MethodInfo entryPoint)
token = -token | 0x06000000;
}

#if NETFRAMEWORK

if (symbolWriter != null)
{
symbolWriter.SetUserEntryPoint(new SymbolToken(token));
}

#endif
}

public StringToken GetStringConstant(string str)
Expand Down
Loading
Loading