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
…1278)

This prevents MIEngine from stripping (what appear to be) format specifiers from debug console commands prefixed by `-exec` or backtick. Fixes #1277.
  • Loading branch information
gareth-rees authored Mar 3, 2022
1 parent a109b93 commit de6905b
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 de6905b

Please sign in to comment.