diff --git a/src/MIDebugEngine/Engine.Impl/Variables.cs b/src/MIDebugEngine/Engine.Impl/Variables.cs index 14455eb0b..1aab34563 100644 --- a/src/MIDebugEngine/Engine.Impl/Variables.cs +++ b/src/MIDebugEngine/Engine.Impl/Variables.cs @@ -421,20 +421,41 @@ public string EvalDependentExpression(string expr) return val; } + /// + /// This allows console commands to be sent through the eval channel via a '-exec ' or '`' preface + /// + /// raw command + /// command stripped of the preface ('-exec ' or '`') + /// true if it is a console command + private bool IsConsoleExecCmd(string command, out string strippedCommand) + { + strippedCommand = string.Empty; + string execCommandString = "-exec "; + if (command.StartsWith(execCommandString, StringComparison.Ordinal)) + { + strippedCommand = command.Substring(execCommandString.Length); + return true; + } + else if (command[0] == '`') + { + strippedCommand = command.Substring(1).TrimStart(); // remove spaces if any + return true; + } + return false; + } + internal async Task Eval(enum_EVALFLAGS dwFlags = 0) { this.VerifyNotDisposed(); await _engine.UpdateRadixAsync(_engine.CurrentRadix()); // ensure the radix value is up-to-date - string execCommandString = "-exec "; - try { - if (_strippedName.StartsWith(execCommandString)) + string consoleCommand; + if (IsConsoleExecCmd(_strippedName, out consoleCommand)) { // special case for executing raw mi commands. - string consoleCommand = _strippedName.Substring(execCommandString.Length); string consoleResults = null; consoleResults = await MIDebugCommandDispatcher.ExecuteCommand(consoleCommand, _debuggedProcess, ignoreFailures: true); diff --git a/src/OpenDebugAD7/AD7DebugSession.cs b/src/OpenDebugAD7/AD7DebugSession.cs index 54a938ec3..10f905902 100644 --- a/src/OpenDebugAD7/AD7DebugSession.cs +++ b/src/OpenDebugAD7/AD7DebugSession.cs @@ -527,7 +527,7 @@ private void StepInternal(int threadId, enum_STEPKIND stepKind, enum_STEPUNIT st #region DebugAdapterBase protected override void HandleInitializeRequestAsync(IRequestResponder responder) - { + { InitializeArguments arguments = responder.Arguments; m_engineConfiguration = EngineConfiguration.TryGet(arguments.AdapterID); @@ -1825,10 +1825,12 @@ protected override void HandleEvaluateRequestAsync(IRequestResponder