X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Flocation.cs;h=658f3b765fa4f48f4e9e1bce1787cca9a387e215;hb=a3539b2ecb5743cc6ea219692399fae70d2cc8f1;hp=79cee3cbf7db1dc87fb77e5acfa57ccfa3259f10;hpb=57b34f6b074e29b584dab15f49f9460e70ade195;p=mono.git diff --git a/mcs/mcs/location.cs b/mcs/mcs/location.cs index 79cee3cbf7d..658f3b765fa 100644 --- a/mcs/mcs/location.cs +++ b/mcs/mcs/location.cs @@ -15,6 +15,7 @@ using System.Collections.Generic; using Mono.CompilerServices.SymbolWriter; using System.Diagnostics; using System.Linq; +using System.IO; namespace Mono.CSharp { @@ -55,7 +56,7 @@ namespace Mono.CSharp static readonly byte[] MD5Algorith = { 96, 166, 110, 64, 207, 100, 130, 76, 182, 240, 66, 212, 129, 114, 167, 153 }; public readonly string Name; - public readonly string FullPathName; + public readonly string OriginalFullPathName; public readonly int Index; public bool AutoGenerated; @@ -67,7 +68,7 @@ namespace Mono.CSharp { this.Index = index; this.Name = name; - this.FullPathName = path; + this.OriginalFullPathName = path; } public byte[] Checksum { @@ -99,21 +100,43 @@ namespace Mono.CSharp this.checksum = checksum; } - public SourceFileEntry CreateSymbolInfo (MonoSymbolFile symwriter) + public SourceFileEntry CreateSymbolInfo (MonoSymbolFile symwriter, List> pathMap) { if (hidden_lines != null) hidden_lines.Sort (); - file = new SourceFileEntry (symwriter, FullPathName, algGuid, checksum); + file = new SourceFileEntry (symwriter, GetFullPathName (pathMap), OriginalFullPathName, algGuid, checksum); if (AutoGenerated) file.SetAutoGenerated (); return file; } + public string GetFullPathName (List> pathMap) + { + var path = OriginalFullPathName; + if (pathMap != null) { + foreach (var map in pathMap) { + var prefix = map.Key; + if (path.Length <= prefix.Length) + continue; + + if (path [prefix.Length] != Path.DirectorySeparatorChar) + continue; + + if (!path.StartsWith (prefix, StringComparison.Ordinal)) + continue; + + path = map.Value + path.Substring (prefix.Length); + } + } + + return path; + } + public bool Equals (SourceFile other) { - return FullPathName == other.FullPathName; + return OriginalFullPathName == other.OriginalFullPathName; } public bool IsHiddenLocation (Location loc) @@ -142,7 +165,7 @@ namespace Mono.CSharp public override string ToString () { - return String.Format ("SourceFile ({0}:{1}:{2})", Name, FullPathName, Index); + return String.Format ("SourceFile ({0}:{1}:{2})", Name, OriginalFullPathName, Index); } } @@ -326,10 +349,10 @@ namespace Mono.CSharp public string NameFullPath { get { int index = File; - if (token == 0 || index <= 0) + if (index <= 0) return null; - return source_list[index - 1].FullPathName; + return source_list[index - 1].OriginalFullPathName; } } @@ -369,18 +392,6 @@ if (checkpoints.Length <= CheckpointIndex) throw new Exception (String.Format (" } } - // The ISymbolDocumentWriter interface is used by the symbol writer to - // describe a single source file - for each source file there's exactly - // one corresponding ISymbolDocumentWriter instance. - // - // This class has an internal hash table mapping source document names - // to such ISymbolDocumentWriter instances - so there's exactly one - // instance per document. - // - // This property returns the ISymbolDocumentWriter instance which belongs - // to the location's source file. - // - // If we don't have a symbol writer, this property is always null. public SourceFile SourceFile { get { int index = File;