Partager via


IeXdi2Exec::GetRunStatus (Windows Embedded CE 6.0)

1/5/2010

This method returns the current run status.

Syntax

HRESULT GetRunStatus(
  [out] RUN_STATUS_TYPE2* pers2Current,
  [out] DWORD* pdwNbOfHaltReasons,
  [out, size_is (,* pdwNbOfHaltReasons)] HALT_REASON_TYPE2** ppehr2List,
  [out] ADDRESS_TYPE* pCurrentExecAddress,
  [out] DWORD64* pdw64CycleSinceLastRun
);

Parameters

  • pers2Current
    Run status type.
  • pdwNbOfHaltReasons
    Number of halt reasons that are provided in pehr2List.
  • pehr2List
    Pointer to an array that lists possible reasons for halt.

    If the status is not a halt, the pointer to the list should be NULL.

    The elements in this array must be values listed in HALT_REASON_TYPE2.

    The buffer for this value is allocated by CoTaskMemAlloc.

  • pCurrentExecAddress
    Program or instruction pointer if run status is halted; undefined otherwise.
  • pdw64CycleSinceLastRun
    Number of clock cycles executed since target resumed execution.

Return Value

The following table shows return values for this method.

Value Description

S_OK

Indicates the function was successful.

E_FAIL

Indicates an unspecified failure.

EXDI_E_COMMUNICATION

Indicates a communication error between host driver and debugging target.

Remarks

To avoid resource leaking, use CoTaskMemFree to free the task memory used by the buffer that this function uses to return the array of reasons for the halt, pehr2List, and the pet member of HALT_REASON_TYPE2, which indicates the exception type code and the notification phase of the exception that caused the halt.

In addition, the pieXdi2CodeBp and pieXdi2DataBp members of the HALT_REASON_TYPE2 structure must be released, if non-NULL.

The following example shows how you might use CoTaskMemFree to release the memory held for the return buffers.

RUN_STATE_TYPE2 rst2;
DWORD dwNbHaltReasons;
HALT_REASON_TYPE2 *ppehr2List;
ADDRESS_TYPE CurrentAddress;
DWORD64 dw64Cycles;
HRESULT hr = pieXdi2Exec->GetRunStatus (&rst2, &dwNbHaltReasons, &ppehr2List,
        &CurrentAddress, &dw64Cycles);
if (SUCCEEDED (hr))
{
    // Use status ..
    for (DWORD i = 0; i < dwNbHaltReasons; ++i)
    {
        if (phrt2Array[i].pieXdi2CodeBp)
        {
            phrt2Array[i].pieXdi2CodeBp->Release ();
            phrt2Array[i].pieXdi2CodeBp = 0;
        }
        if (phrt2Array[i].pieXdi2DataBp)
        {
phrt2Array[i].pieXdi2DataBp->Release ();
phrt2Array[i].pieXdi2DataBp = 0;
        }
        if (ppehr2List[i].pet)
        {
            CoTaskMemFree (ppehr2List[i].pet);
            ppehr2List[i].pet = 0;
        }
    }
    CoTaskMemFree (ppehr2List);
    phrt2Array = 0;
}

Requirements

Header eXDI2.h
Library ole32.lib, oleaut32.lib
Windows Embedded CE Windows CE 5.0 and later

See Also

Reference

IeXdi2Exec
IeXDI2 Interfaces