IDebugControl3::Execute method (dbgeng.h)

The Execute method executes the specified debugger commands.


HRESULT Execute(
  [in] ULONG OutputControl,
  [in] PCSTR Command,
  [in] ULONG Flags


[in] OutputControl

Specifies the output control to use while executing the command. For possible values, see DEBUG_OUTCTL_XXX. For more information about output, see Input and Output.

[in] Command

Specifies the command string to execute. The command is interpreted like those typed into a debugger command window. This command string can contain multiple commands for the engine to execute. See Debugger Commands for the command reference.

[in] Flags

Specifies a bit field of execution options for the command. The default options are to log the command but to not send it to the output. The following table lists the bits that can be set.

Value Description
DEBUG_EXECUTE_ECHO The command string is sent to the output.
DEBUG_EXECUTE_NOT_LOGGED The command string is not logged. This is overridden by DEBUG_EXECUTE_ECHO.
DEBUG_EXECUTE_NO_REPEAT If Command is an empty string, do not repeat the last command, and do not save the current command string for repeat execution later.

Return value

This method can also return error values. See Return Values for more details.

Return code Description
The method was successful.


This method executes the given command string. If the string has multiple commands, this method will not return until all of the commands have been executed. If the sequence of commands involves waiting for the target to execute, this method can take an arbitrary amount of time to complete.

Note  It is important to understand what it means for a step command to execute. A step command initiates a stepping action but does not wait for the stepping to complete. For example, suppose you call IDebugControl::Execute and pass a command string that contains the single command pct. The pct command initiates a step to the next call or return instruction, but pct completes its execution before the stepping takes place. Consequently, IDebugControl::Execute returns before the stepping takes place. Trace and go commands behave in a similar way. Examples of commands that have this behavior include g, gh, ta, tb, tct, pa, and pc.


Target Platform Desktop
Header dbgeng.h (include Dbgeng.h)

See also