Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/debugger-libs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ward <matt.ward@microsoft.com>2022-02-23 18:16:33 +0300
committerGitHub <noreply@github.com>2022-02-23 18:16:33 +0300
commit656eac83caac2bcce973df1eec8c30414d02f2dd (patch)
treea95937dd7a9536554887d5f04e8696ebfc0e9d6c
parent3997eb9e5108bc5f96c989d2ce298d62ea1f018b (diff)
parentfb039a6f4576b65733d6e30b80e2677a54d64d3e (diff)
Merge pull request #355 from marshall-lerner/main
Make sure that the only real paths get resolved
-rw-r--r--Mono.Debugging/Mono.Debugging.Client/BreakpointStore.cs9
-rw-r--r--UnitTests/Mono.Debugging.Tests/Shared/BreakpointsAndSteppingTests.cs18
2 files changed, 27 insertions, 0 deletions
diff --git a/Mono.Debugging/Mono.Debugging.Client/BreakpointStore.cs b/Mono.Debugging/Mono.Debugging.Client/BreakpointStore.cs
index 883e169..f853183 100644
--- a/Mono.Debugging/Mono.Debugging.Client/BreakpointStore.cs
+++ b/Mono.Debugging/Mono.Debugging.Client/BreakpointStore.cs
@@ -471,8 +471,17 @@ namespace Mono.Debugging.Client
[DllImport ("libc")]
static extern IntPtr realpath (string path, IntPtr buffer);
+ /// <summary>
+ /// Resolves the full path of the given file
+ /// </summary>
+ /// <param name="path"></param>
+ /// <returns>The full path if a file is given, or returns the parameter if it is null or empty</returns>
static string ResolveFullPath (string path)
{
+ // If there is no path given, return the same path back
+ if (string.IsNullOrEmpty (path))
+ return path;
+
if (IsWindows)
return Path.GetFullPath (path);
diff --git a/UnitTests/Mono.Debugging.Tests/Shared/BreakpointsAndSteppingTests.cs b/UnitTests/Mono.Debugging.Tests/Shared/BreakpointsAndSteppingTests.cs
index ced8211..5f61924 100644
--- a/UnitTests/Mono.Debugging.Tests/Shared/BreakpointsAndSteppingTests.cs
+++ b/UnitTests/Mono.Debugging.Tests/Shared/BreakpointsAndSteppingTests.cs
@@ -1317,5 +1317,23 @@ namespace Mono.Debugging.Tests
Assert.AreEqual (1, bps.Count);
Assert.AreEqual (Path.Combine(Environment.CurrentDirectory, "fileName2.cs"), bps [0].FileName);
}
+
+ [Test]
+ public void NullFileName ()
+ {
+ var store = new BreakpointStore ();
+ store.Add (new Breakpoint (null, 10));
+ var bps = store.GetBreakpoints ();
+ Assert.AreEqual (1, bps.Count);
+ }
+
+ [Test]
+ public void EmptyFileName ()
+ {
+ var store = new BreakpointStore ();
+ store.Add (new Breakpoint ("", 10));
+ var bps = store.GetBreakpoints ();
+ Assert.AreEqual (1, bps.Count);
+ }
}
}