diff options
author | Jeffrey Stedfast <jestedfa@microsoft.com> | 2020-04-20 22:29:14 +0300 |
---|---|---|
committer | Jeffrey Stedfast <jestedfa@microsoft.com> | 2020-04-20 22:29:14 +0300 |
commit | 4369b78b9ab12ca68b843c3793b1dd40b0d28cfe (patch) | |
tree | d6f055a3eb88a0db43f10431c8bfde1d27c02b59 | |
parent | f1b1f8989d42d1760be1bd2e1ece99482ef0d755 (diff) |
Added ThreadInfo.PrefetchBacktrace()
-rw-r--r-- | Mono.Debugging/Mono.Debugging.Client/ThreadInfo.cs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/Mono.Debugging/Mono.Debugging.Client/ThreadInfo.cs b/Mono.Debugging/Mono.Debugging.Client/ThreadInfo.cs index 68b3ab2..e2c4341 100644 --- a/Mono.Debugging/Mono.Debugging.Client/ThreadInfo.cs +++ b/Mono.Debugging/Mono.Debugging.Client/ThreadInfo.cs @@ -61,9 +61,9 @@ namespace Mono.Debugging.Client public string Location { get { if (location == null) { - Backtrace bt = Backtrace; - if (bt != null && bt.FrameCount > 0) - location = bt.GetFrame (0).ToString (); + PrefetchBacktrace (); + if (backtrace != null && backtrace.FrameCount > 0) + location = backtrace.GetFrame (0).ToString (); } return location; } @@ -75,15 +75,14 @@ namespace Mono.Debugging.Client public Backtrace Backtrace { get { - if (backtrace == null) - backtrace = session.GetBacktrace (processId, id); + PrefetchBacktrace (); return backtrace; } } public long ElapsedTime { get { - long elapsedTime = session.GetElapsedTime (processId, id); + var elapsedTime = session.GetElapsedTime (processId, id); return elapsedTime; } } @@ -92,6 +91,12 @@ namespace Mono.Debugging.Client { session.ActiveThread = this; } + + public void PrefetchBacktrace () + { + if (backtrace == null) + backtrace = session.GetBacktrace (processId, id); + } public ThreadInfo (long processId, long id, string name, string location): this (processId, id, name, location, null) { @@ -108,10 +113,9 @@ namespace Mono.Debugging.Client public override bool Equals (object obj) { - ThreadInfo ot = obj as ThreadInfo; - if (ot == null) - return false; - return id == ot.id && processId == ot.processId && session == ot.session; + if (obj is ThreadInfo ot) + return id == ot.id && processId == ot.processId && session == ot.session; + return false; } public override int GetHashCode () @@ -134,7 +138,7 @@ namespace Mono.Debugging.Client { if (object.ReferenceEquals (t1, t2)) return false; - if ((object)t1 == null || (object)t2 == null) + if (t1 == null || t2 == null) return true; return !t1.Equals (t2); } |