Skip to content

Commit

Permalink
Prevent stripping of format specifiers from -exec commands. (#1277)
Browse files Browse the repository at this point in the history
  • Loading branch information
gareth-rees committed Feb 25, 2022
1 parent a109b93 commit 88ecee4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/MIDebugEngine/Engine.Impl/Variables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,12 @@ public enum NodeType
private string StripFormatSpecifier(string exp, out string formatSpecifier)
{
formatSpecifier = null; // will be used with -var-set-format

if (EngineUtils.IsConsoleExecCmd(exp, out string _, out string _))
{
return exp;
}

int lastComma = exp.LastIndexOf(',');
if (lastComma <= 0)
return exp;
Expand Down
3 changes: 2 additions & 1 deletion src/MIDebugEngine/Natvis.Impl/Natvis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ internal IVariableInformation[] Expand(IVariableInformation variable)
internal IVariableInformation GetVariable(string expr, AD7StackFrame frame)
{
IVariableInformation variable;
if (expr.EndsWith(",viz", StringComparison.Ordinal))
if (!EngineUtils.IsConsoleExecCmd(expr, out string _, out string _)
&& expr.EndsWith(",viz", StringComparison.Ordinal))
{
expr = expr.Substring(0, expr.Length - 4);
variable = new VariableInformation(expr, expr, frame.ThreadContext, frame.Engine, frame.Thread);
Expand Down

0 comments on commit 88ecee4

Please sign in to comment.