> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IXtfConsoleControlClient::GenerateStackDump

> IXtfConsoleControlClient::GenerateStackDump

# IXtfConsoleControlClient::GenerateStackDump

產生堆疊傾印。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
HRESULT GenerateStackDump(
         UINT32 ProcessId,
         UINT32 DumpType,
         LPCWSTR ImageName,
         LPBSTR FilePath  
)  
```

<a id="parametersSection" />

### 參數

*ProcessId*\
類型：UINT32

要為其建立堆疊傾印之處理序的識別碼。

*DumpType*\
類型：UINT32

要建立的堆疊傾印類型。有效的傾印類型如下：

| 值 | 描述 |
| - | - |
| 0 | Triage |
| 1 | Mini |
| 2 | Heap |

*ImageName*\
類型：LPCWSTR

映像的名稱。

*FilePath*\
類型：LPBSTR

指向字串的指標，該字串會接收所建立之堆疊傾印檔案的檔案路徑。

<a id="retvalSection" />

### 傳回值

類型：HRESULT

如果成功，則傳回 `S_OK`；否則傳回 HRESULT 錯誤碼。如果函式在等待堆疊傾印完成時逾時，此函式會傳回 `E_MESSAGE_TIMED_OUT`。

<a id="remarksSection" />

## 備註

此函式會針對開發主機上的可執行映像，從指定的處理序產生堆疊傾印。堆疊傾印會以檔案形式儲存在主機的暫存磁碟機上，位於 `FilePath` 中所傳回的檔案路徑。

堆疊傾印所擷取的資訊以及擷取該資訊所需的時間，取決於 `DumpType` 中指定的傾印類型。此函式會在 5 分鐘後逾時；如果主機在函式逾時之前未傳回堆疊傾印，此函式會傳回 `E_MESSAGE_TIMED_OUT`。下表說明每種堆疊傾印類型所傳回的資訊。

| 傾印類型 | 描述 |
| - | - |
| Triage | 收集所有執行緒的堆疊追蹤、作用中的 OS 控制代碼、執行緒資訊，以及已卸載模組的相關資訊。Triage 傾印會清除個人識別資訊 (PII)。 |
| Mini | 收集所有已載入模組的資料區段、安全性權杖相關資料、執行緒資訊，以及已卸載模組的相關資訊。Mini 傾印不會清除 PII。 |
| Heap | 提供在 Game OS 中執行之所有處理序與記憶體的完整使用者模式損毀傾印。雖然此選項提供最多資訊，但寫出所有資料可能需要幾分鐘的時間。 |

如需可用工具與自動化 API (例如 XBOX Tools Framework (XTF)) 的詳細資訊，請參閱[工具與自動化 API (NDA 主題)](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/debug/atoc-api-tools-dev-env)。

<a id="remarks_output" />

### 處理 LPBSTR 指標

如需處理此函式所傳回之 LPBSTR 指標的詳細資訊，請參閱[為 BSTR 配置及釋放記憶體](https://learn.microsoft.com/cpp/atl-mfc-shared/allocating-and-releasing-memory-for-a-bstr?view=vs-2019)。

<a id="requirementsSection" />

## 需求

**標頭：** xtfconsolecontrol.h

**程式庫：** xtfconsolecontrol.lib

**支援的平台：** Windows (適用於 XBOX 主機工具)

<a id="seealsoSection" />

## 另請參閱

[XtfConsoleControl](/zh-TW/reference/tools/xtf/xtfconsolecontrol/xtfconsolecontrol_members)\
[XBOX Tools Framework](/zh-TW/reference/tools/xtf/atoc-xbox-tools-framework)


## Related topics

- [IXtfConsoleControlClient](/zh-TW/reference/tools/xtf/xtfconsolecontrol/interfaces/IXtfConsoleControlClient/ixtfconsolecontrolclient.md)
- [IXtfConsoleControlClient::ShutdownConsole](/zh-TW/reference/tools/xtf/xtfconsolecontrol/interfaces/IXtfConsoleControlClient/methods/ixtfconsolecontrolclient_shutdownconsole.md)
- [IXtfConsoleControlClient::UpdatesPending](/zh-TW/reference/tools/xtf/xtfconsolecontrol/interfaces/IXtfConsoleControlClient/methods/ixtfconsolecontrolclient_updatespending.md)
- [IXtfConsoleControlClient::SetConfigValue](/zh-TW/reference/tools/xtf/xtfconsolecontrol/interfaces/IXtfConsoleControlClient/methods/ixtfconsolecontrolclient_setconfigvalue.md)
- [IXtfConsoleControlClient::GetAllSettings](/zh-TW/reference/tools/xtf/xtfconsolecontrol/interfaces/IXtfConsoleControlClient/methods/ixtfconsolecontrolclient_getallsettings.md)
