Пример #1
0
		public SequencePoint(ISymUnmanagedDocument document, uint offset, uint line, uint column, uint endLine, uint endColumn)
		{
			this.document = document;
			this.offset = offset;
			this.line = line;
			this.column = column;
			this.endLine = endLine;
			this.endColumn = endColumn;
		}
		static string GetFilenameFromSymDocument(Module module, ISymUnmanagedDocument symDoc)
		{
			if (File.Exists(symDoc.URL)) return symDoc.URL;
			
			List<string> searchPaths = new List<string>();
			
			searchPaths.AddRange(module.Process.Options.SymbolsSearchPaths);
			
			string modulePath = module.FullPath;
			while (true) {
				// Get parent directory
				int index = modulePath.LastIndexOf('\\');
				if (index == -1) break;
				modulePath = modulePath.Substring(0, index);
				// Add the directory to search path list
				if (modulePath.Length == 2 && modulePath[1] == ':') {
					searchPaths.Add(modulePath + '\\');
				} else {
					searchPaths.Add(modulePath);
				}
			}
			
			List<string> filenames = new List<string>();
			string filename = symDoc.URL;
			while (true) {
				// Remove start of the path
				int index = filename.IndexOf('\\');
				if (index == -1) break;
				filename = filename.Substring(index + 1);
				// Add the filename as candidate
				filenames.Add(filename);
			}
			
			List<string> candidates = new List<string>();
			foreach(string path in searchPaths) {
				foreach(string name in filenames) {
					candidates.Add(Path.Combine(path, name));
				}
			}
			
			foreach(string candiate in candidates) {
				if (File.Exists(candiate)) {
					return candiate;
				}
			}
			
			return symDoc.URL;
		}