From de837bfab947e8183909fea02e5477bda3c4b0e7 Mon Sep 17 00:00:00 2001 From: Rakesh Ganesh Date: Mon, 9 Jan 2023 11:29:20 +0100 Subject: [PATCH] MIEngine: Temporary Changes to get L0 debug working IGDB-3452: Changes to disable info thread for each created thread to get L0 working fast. Signed-off-by: intel-rganesh rakesh.ganesh@intel.com --- .../Engine.Impl/DebuggedProcess.cs | 4 +- .../Engine.Impl/DebuggedThread.cs | 43 +------------------ 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs b/src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs index 4a0335f06..f2ae6625f 100755 --- a/src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs +++ b/src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs @@ -408,12 +408,12 @@ public DebuggedProcess(bool bLaunched, LaunchOptions launchOptions, ISampleEngin _callback.OnError(message); }; - ThreadCreatedEvent += async delegate (object o, EventArgs args) + ThreadCreatedEvent += delegate (object o, EventArgs args) { try { ResultEventArgs result = (ResultEventArgs)args; - await ThreadCache.ThreadCreatedEvent(result.Results.FindInt("id"), result.Results.TryFindString("group-id")); + ThreadCache.ThreadCreatedEvent(result.Results.FindInt("id"), result.Results.TryFindString("group-id")); _childProcessHandler?.ThreadCreatedEvent(result.Results); } catch (Exception e) when (ExceptionHelper.BeforeCatch(e, Logger, reportOnlyCorrupting: true)) diff --git a/src/MIDebugEngine/Engine.Impl/DebuggedThread.cs b/src/MIDebugEngine/Engine.Impl/DebuggedThread.cs index 614ef61a9..6ea715c2f 100644 --- a/src/MIDebugEngine/Engine.Impl/DebuggedThread.cs +++ b/src/MIDebugEngine/Engine.Impl/DebuggedThread.cs @@ -178,7 +178,7 @@ internal void MarkDirty() } } - internal async Task ThreadCreatedEvent(int id, string groupId) + internal void ThreadCreatedEvent(int id, string groupId) { // Mark that the threads have changed lock (_threadList) @@ -205,47 +205,6 @@ internal async Task ThreadCreatedEvent(int id, string groupId) } _threadGroups[groupId].Add(id); } - - // Run Thread-info now to get the target-id - ResultValue resVal = null; - if (id >= 0) - { - uint? tid = null; - tid = (uint)id; - Results results = await _debugger.MICommandFactory.ThreadInfo(tid); - if (results.ResultClass != ResultClass.done) - { - // This can happen on some versions of gdb where thread-info is not supported while running, so only assert if we're also not running. - if (this._debugger.ProcessState != ProcessState.Running) - { - Debug.Fail("Thread info not successful"); - } - } - else - { - var tlist = results.Find("threads"); - - // tlist.Content.Length could be 0 when the thread exits between it getting created and we request thread-info - Debug.Assert(tlist.Content.Length <= 1, "Expected at most 1 thread, received more than one thread."); - resVal = tlist.Content.FirstOrDefault(item => item.FindInt("id") == id); - } - } - - if (resVal != null) - { - lock (_threadList) - { - bool bNew = false; - var thread = SetThreadInfoFromResultValue(resVal, out bNew); - Debug.Assert(thread.Id == id, "thread.Id and id should match"); - - if (bNew) - { - NewThreads.Add(thread); - SendThreadEvents(null, null); - } - } - } } internal void ThreadExitedEvent(int id)