Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIEngine: Disable individual info threads call for each thread created #1460

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
43 changes: 1 addition & 42 deletions src/MIDebugEngine/Engine.Impl/DebuggedThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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<ValueListValue>("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)
Expand Down