Skip to content

Commit

Permalink
make radix callback on calling thread (#1234)
Browse files Browse the repository at this point in the history
* make radix callback on calling thread

* review comments

* pass radix as zero when asking for return value
  • Loading branch information
paulmaybee authored Oct 20, 2021
1 parent 80a4800 commit 7393b72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ private async Task HandleBreakModeEvent(ResultEventArgs results, BreakRequest br
if (!string.IsNullOrEmpty(resultVar))
{
ReturnValue = new VariableInformation("$ReturnValue", resultVar, cxt, Engine, (AD7Thread)thread.Client, isParameter: false);
await ReturnValue.Eval();
await ReturnValue.Eval(radix: 0);
}
_callback.OnStepComplete(thread);
}
Expand Down
15 changes: 10 additions & 5 deletions src/MIDebugEngine/Engine.Impl/Variables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal SimpleVariableInformation(string name, bool isParam = false, string val
internal async Task<VariableInformation> CreateMIDebuggerVariable(ThreadContext ctx, AD7Engine engine, AD7Thread thread)
{
VariableInformation vi = new VariableInformation(Name, Name, ctx, engine, thread, IsParameter);
await vi.Eval();
await vi.Eval(engine.CurrentRadix());
return vi;
}
}
Expand Down Expand Up @@ -446,9 +446,10 @@ public void AsyncEval(IDebugEventCallback2 pExprCallback)
engineCallback = _engine.Callback;
}

uint radix = _engine.CurrentRadix();
Task evalTask = Task.Run(async () =>
{
await Eval();
await Eval(radix);
});

Action<Task> onComplete = (Task t) =>
Expand All @@ -473,9 +474,10 @@ public void AsyncError(IDebugEventCallback2 pExprCallback, IDebugProperty2 error

public void SyncEval(enum_EVALFLAGS dwFlags = 0, DAPEvalFlags dwDAPFlags = 0)
{
uint radix = _engine.CurrentRadix();
Task eval = Task.Run(async () =>
{
await Eval(dwFlags, dwDAPFlags);
await Eval(radix, dwFlags, dwDAPFlags);
});
eval.Wait();
}
Expand All @@ -493,11 +495,14 @@ public string EvalDependentExpression(string expr)
return val;
}

internal async Task Eval(enum_EVALFLAGS dwFlags = 0, DAPEvalFlags dwDAPFlags = 0)
internal async Task Eval(uint radix, enum_EVALFLAGS dwFlags = 0, DAPEvalFlags dwDAPFlags = 0)
{
this.VerifyNotDisposed();

await _engine.UpdateRadixAsync(_engine.CurrentRadix()); // ensure the radix value is up-to-date
if (radix != 0)
{
await _engine.UpdateRadixAsync(radix); // ensure the radix value is up-to-date
}

try
{
Expand Down

0 comments on commit 7393b72

Please sign in to comment.