Skip to content

Commit

Permalink
Only print evaluate requests in REPL context
Browse files Browse the repository at this point in the history
This PR checks to see if the `-exec` commands are originally from the
REPL context (e.g. the Debug Console). If so, it will redirect the
output of the -exec command to the REPL window. If it is another
context, it will not print anything.
  • Loading branch information
WardenGnaw committed Aug 9, 2022
1 parent 6118510 commit bbbdb86
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ public enum DAPEvalFlags
/// <summary>
/// Evaluation is for a clipboard context
/// </summary>
CLIPBOARD_CONTEXT = 1
CLIPBOARD_CONTEXT = 1,
/// <summary>
/// Evaluation is for repl context
/// </summary>
REPL = 2
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/MIDebugEngine/Engine.Impl/Variables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ internal async Task Eval(uint radix, enum_EVALFLAGS dwFlags = 0, DAPEvalFlags dw
Value = String.Empty;
this.TypeName = null;

if (!String.IsNullOrEmpty(consoleResults))
if (!String.IsNullOrEmpty(consoleResults) && dwDAPFlags.HasFlag(DAPEvalFlags.REPL))
{
_debuggedProcess.WriteOutput(consoleResults);
}
Expand Down
4 changes: 4 additions & 0 deletions src/OpenDebugAD7/AD7DebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2975,6 +2975,10 @@ protected override void HandleEvaluateRequestAsync(IRequestResponder<EvaluateArg
{
dapEvalFlags |= DAPEvalFlags.CLIPBOARD_CONTEXT;
}
else if (context == EvaluateArguments.ContextValue.Repl)
{
dapEvalFlags |= DAPEvalFlags.REPL;
}

DEBUG_PROPERTY_INFO[] propertyInfo = new DEBUG_PROPERTY_INFO[1];
enum_DEBUGPROP_INFO_FLAGS propertyInfoFlags = GetDefaultPropertyInfoFlags();
Expand Down

0 comments on commit bbbdb86

Please sign in to comment.