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
Why does the call to m_frameHandles.TryGetFirst() or m_frameHandles.TryGet() fail? That's because m_frameHandles was reset by the call to BeforeContinue() in StepInternal() here:
The problem here is that if m_program.Step() fails without running the program, then MIEngine is left without any stack frames. The stack frames will be restored at the next point where HandleStackTraceRequestAsync() is called, but this does not happen until a subsequent successful attempt to run the program. In the mean time, any calls to GetDebugPropertyFromExpression() will result in a fatal error.
Suggested fix
In StepInternal(), wait until the program is known to be running before calling BeforeContinue() to discard the frame handles and other program state, for example:
ErrorBuilder builder = new ErrorBuilder(() => errorMessage);
m_isStepping = true;
// ... some code elided ...
try
{
builder.CheckHR(m_program.Step(thread, stepKind, stepUnit));
}
catch (AD7Exception)
{
m_isStopped = true;
throw;
}
// The program should now be running, so it is safe to discard the
// cached program state.
BeforeContinue();
Previously the cached state was discarded before calling `Step`, but
this meant that if `Step` failed then MIEngine was left with no cached
state, causing a subsequent call to `GetDebugPropertyFromExpression`
to fail with a fatal error.
…icrosoft#1337)
Previously the cached state was discarded before calling `Step`, but
this meant that if `Step` failed then MIEngine was left with no cached
state, causing a subsequent call to `GetDebugPropertyFromExpression`
to fail with a fatal error.
Steps to reproduce
"program"
to point to a suitable executable with debug symbols.main()
, click on Step Out. This fails with an error message like this in the Debug Console:Analysis
The fatal error comes from the lookup of the stack frame in
GetDebugPropertyFromExpression()
here:MIEngine/src/OpenDebugAD7/AD7DebugSession.cs
Lines 441 to 454 in 93c8040
Why does the call to
m_frameHandles.TryGetFirst()
orm_frameHandles.TryGet()
fail? That's becausem_frameHandles
was reset by the call toBeforeContinue()
inStepInternal()
here:MIEngine/src/OpenDebugAD7/AD7DebugSession.cs
Lines 814 to 839 in 93c8040
The problem here is that if
m_program.Step()
fails without running the program, then MIEngine is left without any stack frames. The stack frames will be restored at the next point whereHandleStackTraceRequestAsync()
is called, but this does not happen until a subsequent successful attempt to run the program. In the mean time, any calls toGetDebugPropertyFromExpression()
will result in a fatal error.Suggested fix
In
StepInternal()
, wait until the program is known to be running before callingBeforeContinue()
to discard the frame handles and other program state, for example:Software versions
C/C++ extension: 1.11.5
VSCode: 1.70.1
Commit: 6d9b74a70ca9c7733b29f0456fd8195364076dda
Date: 2022-08-10T06:09:15.055Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Linux x64 5.4.0-122-generic snap
The text was updated successfully, but these errors were encountered: