You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When entering an -exec command in the DEBUG CONSOLE in Visual Studio Code, I expect the remainder of the command to be passed as-is to GDB. In particular, if I enter the command
-exec echo abc,d
then I expect GDB to execute the command echo abc,d, producing the output abc,d in the DEBUG CONSOLE. But what I see instead is the output abc without the ,d. See screenshot below (using Visual Studio Code 1.64.2 and C/C++ extension v1.8.4):
The chain of calls that lead to this bug is:
AD7DebugSession.HandleEvaluateRequestAsync receives expression="-exec echo abc,d" and calls:
but this context has been lost by the time we get to the StripFormatSpecifier call.
Solution ideas:
Pass the isExecInConsole flag down through ParseText and GetVariable to the VariableInformation constructor which can use it to skip the StripFormatSpecifier call. The problem with this approach is that ParseText implements the IDebugExpressionContext2::ParseText interface which we can't change.
Test the -exec and backtick cases again inside StripFormatSpecifier and avoid stripping the specifier if these are found. The problem with this is that the test gets duplicated and so there is a risk of changing it in one place and not the other. Also, might there be a legitimate expression starting with -exec (meaning the negation of the value of a variable starting exec).
Append a comma to expression in HandleEvaluateRequestAsync whose only purpose is to be stripped by StripFormatSpecifier.
I will prepare a pull request implementing solution (3) but if you have a better suggestion then let me know.
The text was updated successfully, but these errors were encountered:
…1278)
This prevents MIEngine from stripping (what appear to be) format specifiers from debug console commands prefixed by `-exec` or backtick. Fixes#1277.
When entering an
-exec
command in the DEBUG CONSOLE in Visual Studio Code, I expect the remainder of the command to be passed as-is to GDB. In particular, if I enter the commandthen I expect GDB to execute the command
echo abc,d
, producing the outputabc,d
in the DEBUG CONSOLE. But what I see instead is the outputabc
without the,d
. See screenshot below (using Visual Studio Code 1.64.2 and C/C++ extension v1.8.4):The chain of calls that lead to this bug is:
AD7DebugSession.HandleEvaluateRequestAsync
receivesexpression="-exec echo abc,d"
and calls:MIEngine/src/OpenDebugAD7/AD7DebugSession.cs
Line 2918 in a109b93
IDebugExpression2.ParseText
receivespszCode="-exec echo abc,d"
and calls:MIEngine/src/MIDebugEngine/AD7.Impl/AD7StackFrame.cs
Line 595 in a109b93
GetVariable
receivesexpr="-exec echo abc,d"
and calls:MIEngine/src/MIDebugEngine/Natvis.Impl/Natvis.cs
Line 441 in a109b93
The
VariableInformation
constructor receivesexpr="-exec echo abc,d"
and calls:MIEngine/src/MIDebugEngine/Engine.Impl/Variables.cs
Line 216 in a109b93
StripFormatSpecifier
receivesexp="-exec echo abc,d"
and strips the,d
by executing:MIEngine/src/MIDebugEngine/Engine.Impl/Variables.cs
Line 421 in a109b93
Note that the code in
AD7DebugSession.HandleEvaluateRequestAsync
already tests for the-exec
case:MIEngine/src/OpenDebugAD7/AD7DebugSession.cs
Lines 2863 to 2865 in a109b93
but this context has been lost by the time we get to the
StripFormatSpecifier
call.Solution ideas:
Pass the
isExecInConsole
flag down throughParseText
andGetVariable
to theVariableInformation
constructor which can use it to skip theStripFormatSpecifier
call. The problem with this approach is thatParseText
implements theIDebugExpressionContext2::ParseText
interface which we can't change.Test the
-exec
and backtick cases again insideStripFormatSpecifier
and avoid stripping the specifier if these are found. The problem with this is that the test gets duplicated and so there is a risk of changing it in one place and not the other. Also, might there be a legitimate expression starting with-exec
(meaning the negation of the value of a variable startingexec
).Append a comma to
expression
inHandleEvaluateRequestAsync
whose only purpose is to be stripped byStripFormatSpecifier
.I will prepare a pull request implementing solution (3) but if you have a better suggestion then let me know.
The text was updated successfully, but these errors were encountered: