Debug Break Buttons

omar 2024-01-10 16:58:53 +01:00
parent 22ac56ae33
commit a05269eed3

@ -4,18 +4,25 @@
- [Debug Configuration Flags](#debug-configuration-flags)
- [Metrics/Debugger window](#metricsdebugger-window)
- [Debug Log](#debug-log)
- [Debug Break Buttons](#debug-break-buttons)
- [ID Stack Tool](#id-stack-tool)
- [Item Picker](#item-picker)
- [UTF-8 Encoding Viewer](utf-8-encoding-viewer)
----
### Debug Configuration Flags
## Debug Configuration Flags
![Debug configuration flags](https://github.com/ocornut/imgui/assets/8225057/031b9f5a-372d-46da-b5cf-17549e95f994)
![image](https://github.com/ocornut/imgui/assets/8225057/2b94e38b-e5ca-45ce-a562-ce6612c82535)
Runtime flags available in `ImGuiIO` (and exposed in Demo->Configuration):
```cpp
// Option to enable various debug tools showing buttons that will call the IM_DEBUG_BREAK() macro.
// - The Item Picker tool will be available regardless of this being enabled, in order to maximize its discoverability.
// - Requires a debugger being attached, otherwise IM_DEBUG_BREAK() options will appear to crash your application.
// e.g. io.ConfigDebugIsDebuggerPresent = ::IsDebuggerPresent() on Win32, or refer to ImOsIsDebuggerPresent() imgui_test_engine/imgui_te_utils.cpp for a Unix compatible version).
bool ConfigDebugIsDebuggerPresent; // = false // Enable various tools calling IM_DEBUG_BREAK().
// Tools to test correct Begin/End and BeginChild/EndChild behaviors.
// Presently Begin()/End() and BeginChild()/EndChild() needs to ALWAYS be called in tandem, regardless of return value of BeginXXX()
// This is inconsistent with other BeginXXX functions and create confusion for many users.
@ -25,14 +32,13 @@ bool ConfigDebugBeginReturnValueLoop; // Some calls to Begin()/BeginChild() will
// Option to deactivate io.AddFocusEvent(false) handling. May facilitate interactions with a debugger when focus loss leads to clearing inputs data.
// Backends may have other side-effects on focus loss, so this will reduce side-effects but not necessary remove all of them.
// Consider using e.g. Win32's IsDebuggerPresent() as an additional filter (or see ImOsIsDebuggerPresent() in imgui_test_engine/imgui_te_utils.cpp for a Unix compatible version).
bool ConfigDebugIgnoreFocusLoss; // Ignore io.AddFocusEvent(false), consequently not calling io.ClearInputKeys() in input processing.
// Options to audit .ini data
bool ConfigDebugIniSettings; // Save .ini data with extra comments (particularly helpful for Docking, but makes saving slower)
```
### Metrics/Debugger window
## Metrics/Debugger window
Access the Metrics/Debugger window via `Demo->Tools->Metrics/Debugger` or by calling `ShowMetricsWindow()` from your code.
@ -45,7 +51,7 @@ Many internal state and tools are exposed in the Metrics window. They will help
![debug tools](https://user-images.githubusercontent.com/8225057/174845561-ee9ba6ad-9f48-478c-944d-85334aae0af7.png)
_Some of the debug tools_
### Debug Log
## Debug Log
Access the Debug Log window via `Demo->Tools->Debug Log` or `Metrics->Tools->Debug Log` or by calling `ShowDebugLogWindow()`. Also see [#5855](https://github.com/ocornut/imgui/issues/5855).
@ -64,7 +70,27 @@ Inside the log, if you hover an ImGuiID identifier (formatted as `0xXXXXXXXX`) i
![image](https://user-images.githubusercontent.com/8225057/200007998-4d3066c5-50d5-4168-aeaa-2c9d514dc122.png)
### ID Stack Tool
If `io.ConfigDebugIsDebuggerPresent` is enabled, an additional tooltip will appear after some time:
![image](https://github.com/ocornut/imgui/assets/8225057/b4292cf6-88a9-4f27-a502-a00c38d923e3)
![image](https://github.com/ocornut/imgui/assets/8225057/a8f992a7-71dc-48c4-82da-6594ee08d65a)
## Debug Break Buttons
When `io.ConfigDebugIsDebuggerPresent` is enabled, various `**DebugBreak**` buttons will appears in debug tools. Clicking them will attempt to break you in debugger in the desired location:
- Request a debug break in a Begin() call.
- Request a debug break in a ItemAdd() call via debug log and hovering 0xXXXXXX identifiers.
- Request a debug break in a BeginTable() call.
- Request a debug break in a SetShortcutRouting()/Shortcut() call. [Internal]
![image](https://github.com/ocornut/imgui/assets/8225057/960de69e-3e7d-467a-b805-a30b1e78bebf)
![image](https://github.com/ocornut/imgui/assets/8225057/9e70ed99-8598-452f-95cb-3162cc50184a)
In the Debug Log you can also hover a 0xXXXXXXXX identifier and press the `Pause/Break` keyboard key to attempt to break in the ItemAdd() function for this item.
## ID Stack Tool
https://github.com/ocornut/imgui/issues/4631
@ -74,7 +100,7 @@ ImGui::ShowIdStackToolWindow();
![stack_tool_03](https://user-images.githubusercontent.com/8225057/136235657-a0ea5665-dcd1-423f-9be6-dc3f8ced8f12.png)
### Item Picker
## Item Picker
https://github.com/ocornut/imgui/issues/2673
@ -83,7 +109,7 @@ You can find it in _Metrics>Tools>Item Picker_ or expose it in your own UI by ca
![Item Picker](https://user-images.githubusercontent.com/8225057/61412736-7d2e5b80-a89e-11e9-9bb3-54c097025abe.png)
### UTF-8 Encoding Viewer
## UTF-8 Encoding Viewer
See https://github.com/ocornut/imgui/blob/master/docs/FONTS.md#about-utf-8-encoding