diff options
author | David KarlasĖ <david.karlas@xamarin.com> | 2015-09-08 12:37:36 +0300 |
---|---|---|
committer | joj <joaquinjares@hotmail.com> | 2016-02-29 15:03:24 +0300 |
commit | ccb50d1b3afb1f1ffbdea71b0f757f112c03e4e7 (patch) | |
tree | 36ae7cc6c872552d20ef23841a371b268235410b | |
parent | 03c4af4b2e552b7381a5a172c52ab69607565510 (diff) |
Bug 33614 - [Roslyn] Crash in debugger after pausing
Problem was outdated threads list in ProcessInfo... And when this threads were mapped to ThreadMirrors outdated thread(which was now dead) was converted into null which caused NRE...
1. OnFetchFrames now handles this possibility and excludes null references from list
2. ProcessInfo is no longer caching threads instead they are requested from DebuggerSession which should do caching as it already does...
3. current_threads cache in SoftDebuggerSession wasn't invalidated on threads start/stop events as it should be...
-rw-r--r-- | Mono.Debugging.Soft/SoftDebuggerSession.cs | 14 | ||||
-rw-r--r-- | Mono.Debugging/Mono.Debugging.Client/ProcessInfo.cs | 11 |
2 files changed, 11 insertions, 14 deletions
diff --git a/Mono.Debugging.Soft/SoftDebuggerSession.cs b/Mono.Debugging.Soft/SoftDebuggerSession.cs index 7a3213b..96b97ab 100644 --- a/Mono.Debugging.Soft/SoftDebuggerSession.cs +++ b/Mono.Debugging.Soft/SoftDebuggerSession.cs @@ -720,11 +720,15 @@ namespace Mono.Debugging.Soft return name; } - protected override void OnFetchFrames (ThreadInfo[] threads) + protected override void OnFetchFrames (ThreadInfo [] threads) { - var mirrorThreads = new ThreadMirror[threads.Length]; - for (int i = 0; i < threads.Length; i++) - mirrorThreads [i] = GetThread (threads [i].Id); + var mirrorThreads = new List<ThreadMirror> (threads.Length); + for (int i = 0; i < threads.Length; i++) { + var thread = GetThread (threads [i].Id); + if (thread != null) { + mirrorThreads.Add (thread); + } + } ThreadMirror.FetchFrames (mirrorThreads); } @@ -1912,6 +1916,7 @@ namespace Mono.Debugging.Soft void HandleThreadStartEvents (ThreadStartEvent[] events) { + current_threads = null; var thread = events [0].Thread; if (events.Length > 1 && events.Any (a => a.Thread != thread)) throw new InvalidOperationException ("Simultaneous ThreadStartEvents for multiple threads"); @@ -1926,6 +1931,7 @@ namespace Mono.Debugging.Soft void HandleThreadDeathEvents (ThreadDeathEvent[] events) { + current_threads = null; var thread = events [0].Thread; if (events.Length > 1 && events.Any (a => a.Thread != thread)) throw new InvalidOperationException ("Simultaneous ThreadDeathEvents for multiple threads"); diff --git a/Mono.Debugging/Mono.Debugging.Client/ProcessInfo.cs b/Mono.Debugging/Mono.Debugging.Client/ProcessInfo.cs index a972965..cf14162 100644 --- a/Mono.Debugging/Mono.Debugging.Client/ProcessInfo.cs +++ b/Mono.Debugging/Mono.Debugging.Client/ProcessInfo.cs @@ -36,18 +36,11 @@ namespace Mono.Debugging.Client string name; [NonSerialized] - ThreadInfo[] currentThreads; - - [NonSerialized] DebuggerSession session; internal void Attach (DebuggerSession session) { this.session = session; - if (currentThreads != null) { - foreach (ThreadInfo t in currentThreads) - t.Attach (session); - } } public long Id { @@ -70,9 +63,7 @@ namespace Mono.Debugging.Client public ThreadInfo[] GetThreads () { - if (currentThreads == null) - currentThreads = session.GetThreads (id); - return currentThreads; + return session.GetThreads (id); } } } |