public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) { if (!relocsOnly) { UserDefinedTypeDescriptor userDefinedTypeDescriptor = factory.WindowsDebugData.UserDefinedTypeDescriptor; if (userDefinedTypeDescriptor != null) { List <TypeDesc> typesThatNeedIndices = new List <TypeDesc>(); foreach (TypeDesc type in factory.MetadataManager.GetTypesWithEETypes()) { if (!type.IsGenericDefinition) { typesThatNeedIndices.Add(type); } } typesThatNeedIndices.Sort(new TypeSystemComparer().Compare); foreach (TypeDesc type in typesThatNeedIndices) { // Force creation of type descriptors for _ALL_ EETypes userDefinedTypeDescriptor.GetVariableTypeIndex(type); } } } // There isn't actually any data in this node. Its simply an ObjectNode as that allows this // function to be executed in a defined time during object emission. This does imply embedding a bit of data // into the object file, but the linker should be able to strip it out of the final file, and even if its in the final file // it won't cost significant size. return(new ObjectData(new byte[1], Array.Empty <Relocation>(), 1, new ISymbolDefinitionNode[] { this })); }
public ObjectWriter(string objectFilePath, NodeFactory factory) { _nativeObjectWriter = InitObjWriter(objectFilePath); if (_nativeObjectWriter == IntPtr.Zero) { throw new IOException("Fail to initialize Native Object Writer"); } _nodeFactory = factory; _targetPlatform = _nodeFactory.Target; _userDefinedTypeDescriptor = new UserDefinedTypeDescriptor(this); }
public ObjectWriter(string objectFilePath, NodeFactory factory) { var triple = GetLLVMTripleFromTarget(factory.Target); _nativeObjectWriter = InitObjWriter(objectFilePath, triple); if (_nativeObjectWriter == IntPtr.Zero) { throw new IOException("Fail to initialize Native Object Writer"); } _nodeFactory = factory; _targetPlatform = _nodeFactory.Target; _isSingleFileCompilation = _nodeFactory.CompilationModuleGroup.IsSingleFileCompilation; _userDefinedTypeDescriptor = new UserDefinedTypeDescriptor(this, factory); }
/// <summary> /// Initialize the WindowsDebugData emission pipeline. /// Cannot be called twice /// </summary> /// <param name="nonSectionBasedDebugInfoWriter">debug$T section generation interface. If null, use managed implementation that generates a object file section.</param> /// <param name="mergedAssemblyRecords">record of how assemblies are merged. If null, do not genearate extended debug information</param> /// <param name="graph">Graph to attach WindowsDebugData to</param> public void Init(ITypesDebugInfoWriter nonSectionBasedDebugInfoWriter, MergedAssemblyRecords mergedAssemblyRecords, DependencyAnalyzerBase <NodeFactory> graph) { Debug.Assert(_userDefinedTypeDescriptor == null); // Cannot be called twice Debug.Assert(graph != null); _debugNeedTypeIndicesStore = new WindowsDebugNeedTypeIndicesStoreNode(); if (mergedAssemblyRecords != null) { _debugPseudoAssemblySection = new WindowsDebugPseudoAssemblySection(_nodeFactory.TypeSystemContext); _debugMergedAssembliesSection = new WindowsDebugMergedAssembliesSection(mergedAssemblyRecords); _debugILImagesSection = new WindowsDebugILImagesSection(mergedAssemblyRecords); _debugManagedNativeDictionaryInfoSection = new WindowsDebugManagedNativeDictionaryInfoSection(); } bool is64Bit = _nodeFactory.Target.PointerSize == 8 ? true : false; if (nonSectionBasedDebugInfoWriter != null) { _userDefinedTypeDescriptor = new UserDefinedTypeDescriptor(nonSectionBasedDebugInfoWriter, is64Bit, _nodeFactory.Target.Abi); } else { _debugTypeRecordsSection = new WindowsDebugTypeRecordsSection(new DebugInfoWriter(), _nodeFactory); _userDefinedTypeDescriptor = new UserDefinedTypeDescriptor(_debugTypeRecordsSection, is64Bit, _nodeFactory.Target.Abi); } if (mergedAssemblyRecords != null) { _debugTypeSignatureMapSection = new WindowsDebugTypeSignatureMapSection(_userDefinedTypeDescriptor); _debugMethodSignatureMapSection = new WindowsDebugMethodSignatureMapSection(); } graph.AddRoot(_debugNeedTypeIndicesStore, "Debug Force All EETypes to have type indices"); if (_debugManagedNativeDictionaryInfoSection != null) { graph.AddRoot(_debugManagedNativeDictionaryInfoSection, "Debug Method MDToken map"); } if (_debugMethodSignatureMapSection != null) { graph.AddRoot(_debugMethodSignatureMapSection, "Debug Method MDToken map"); } if (_debugTypeSignatureMapSection != null) { graph.AddRoot(_debugTypeSignatureMapSection, "Debug Type MDToken map"); } if (_debugILImagesSection != null) { graph.AddRoot(_debugILImagesSection, "Debug Merged ILImages"); } if (_debugMergedAssembliesSection != null) { graph.AddRoot(_debugMergedAssembliesSection, "Debug MergedAssemblyRecords"); } if (_debugPseudoAssemblySection != null) { graph.AddRoot(_debugPseudoAssemblySection, "Debug PseudoAssembly"); } if (_debugTypeRecordsSection != null) { graph.AddRoot(_debugTypeRecordsSection, "Debug Type Records"); } }
public WindowsDebugTypeSignatureMapSection(UserDefinedTypeDescriptor userDefinedTypeDescriptor) { _userDefinedTypeDescriptor = userDefinedTypeDescriptor; }