public static DkmResolvedDocument[] FindDocuments(DkmModule module, DkmSourceFileId sourceFileId) { DkmDocumentMatchStrength matchStrength; if (string.Equals(module.Name, sourceFileId.DocumentName, StringComparison.OrdinalIgnoreCase)) { matchStrength = DkmDocumentMatchStrength.FullPath; } else { // Either the module path is relative, or it's absolute but on a different filesystem (i.e. remote debugging). // Walk the local filesystem up starting from source file path, matching it against the module path component // by component, stopping once __init__.py is no longer seen on the same level. The intent is to approximate // a match on module names by matching the tails of the two paths that contribute to the fully qualified names // of the modules. string sourcePath = sourceFileId.DocumentName; string modulePath = module.Name; int levels = 0; do { try { string sourceFile = Path.GetFileName(sourcePath); string moduleFile = Path.GetFileName(modulePath); if (!string.Equals(sourceFile, moduleFile, StringComparison.OrdinalIgnoreCase)) { return new DkmResolvedDocument[0]; } sourcePath = Path.GetDirectoryName(sourcePath); modulePath = Path.GetDirectoryName(modulePath); } catch (ArgumentException) { return new DkmResolvedDocument[0]; } ++levels; } while (File.Exists(Path.Combine(sourcePath, "__init__.py"))); matchStrength = (levels == 1) ? DkmDocumentMatchStrength.FileName : DkmDocumentMatchStrength.SubPath; } return new[] { DkmResolvedDocument.Create(module, module.Name, null, matchStrength, DkmResolvedDocumentWarning.None, false, null) }; }
public InspectionScope(DkmClrInstructionAddress address, InspectionSession session) { InstructionAddress = address; SymModule = address.ModuleInstance.Module; CurrentMethodToken = address.MethodId.Token; Session = session; }
public static ComPtr<IDiaSymbol> GetRootSymbol(DkmModule module) { ComPtr<IDiaSession> session; Guid diaSessionGuid = typeof(IDiaSession).GUID; using (session = ComPtr.Create((IDiaSession)module.GetSymbolInterface(diaSessionGuid))) { IDiaEnumSymbols enumerator; session.Ptr.findChildren(null, SymTagEnum.SymTagExe, null, 0, out enumerator); if (enumerator.count == 0) return new ComPtr<IDiaSymbol>(); return ComPtr.Create(enumerator.Item(0)); } }
public DkmClrModuleInstance(DkmClrRuntimeInstance runtimeInstance, Assembly assembly, DkmModule module) : base(module) { _runtimeInstance = runtimeInstance; this.Assembly = assembly; }
internal DkmModuleInstance(DkmModule module) { this.Module = module; }