Skip to content

Commit

Permalink
Misc: added imgui.gdb and imgui.natstepfilter debugger helpers for gd…
Browse files Browse the repository at this point in the history
…b and msvc.
  • Loading branch information
rokups authored and ocornut committed Mar 12, 2021
1 parent 033dfd9 commit 1bc6f82
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 12 deletions.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ Other Changes:
in e.g. hi-dpi settings will generally look better. (#3491) [@thedmd]
- ImDrawList: AddCircle, AddCircleFilled(): Tweaked default segment count calculation to honor MaxError
with more accuracy. Made default segment count always even for better looking result. (#3808) [@thedmd]
- Misc: Added 'debuggers/imgui.gdb' and 'debuggers/imgui.natstepfilter' (along with existing 'imgui.natvis')
scriptss to configure popular debuggers into skipping trivial functions when using StepInto. [@rokups]
- Backends: Android: Added native Android backend. (#3446) [@duddel]
- Backends: Win32: Added ImGui_ImplWin32_EnableAlphaCompositing() to facilitate experimenting with
alpha compositing and transparent windows. (#2766, #3447 etc.).
Expand Down
2 changes: 1 addition & 1 deletion imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Index of this file:
// Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
#define IMGUI_VERSION "1.82 WIP"
#define IMGUI_VERSION_NUM 18101
#define IMGUI_VERSION_NUM 18102
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
#define IMGUI_HAS_TABLE

Expand Down
13 changes: 11 additions & 2 deletions misc/debuggers/README.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@

HELPER FILES FOR POPULAR DEBUGGERS

imgui.gdb
GDB: disable stepping into trivial functions.
(read comments inside file for details)

imgui.natstepfilter
Visual Studio Debugger: disable stepping into trivial functions.
(read comments inside file for details)

imgui.natvis
Natvis file to describe dear imgui types in the Visual Studio debugger.
Visual Studio Debugger: describe Dear ImGui types for better display.
With this, types like ImVector<> will be displayed nicely in the debugger.
You can include this easily in your Visual Studio project files.
(read comments inside file for details)

12 changes: 12 additions & 0 deletions misc/debuggers/imgui.gdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# GDB configuration to aid debugging experience

# To enable these customizations edit $HOME/.gdbinit (or ./.gdbinit if local gdbinit is enabled) and add:
# add-auto-load-safe-path /path/to/imgui.gdb
# source /path/to/imgui.gdb
#
# More Information at:
# * https://sourceware.org/gdb/current/onlinedocs/gdb/gdbinit-man.html
# * https://sourceware.org/gdb/current/onlinedocs/gdb/Init-File-in-the-Current-Directory.html#Init-File-in-the-Current-Directory

# Disable stepping into trivial functions
skip -rfunction Im(Vec2|Vec4|Strv|Vector|Span)::.+
30 changes: 30 additions & 0 deletions misc/debuggers/imgui.natstepfilter
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
.natstepfilter file for Visual Studio debugger.
Purpose: instruct debugger to skip some functions when using StepInto (F11)
To enable:
* copy in %USERPROFILE%\Documents\Visual Studio XXXX\Visualizers (current user)
* or copy in %VsInstallDirectory%\Common7\Packages\Debugger\Visualizers (all users)
If you have multiple VS version installed, the version that matters is the one you are using the IDE/debugger of (not the compiling toolset).
This is supported since Visual Studio 2012.
Unfortunately, unlike .natvis files, it isn't yet possible to include this file in your project :(
You may upvote this: https://developercommunity.visualstudio.com/t/allow-natstepfilter-and-natjmc-to-be-included-as-p/561718
More information at: https://docs.microsoft.com/en-us/visualstudio/debugger/just-my-code?view=vs-2019#BKMK_C___Just_My_Code
-->

<StepFilter xmlns="http://schemas.microsoft.com/vstudio/debugger/natstepfilter/2010">

<!-- Disable stepping into trivial functions -->
<Function>
<Name>(ImVec2|ImVec4|ImStrv)::.+</Name>
<Action>NoStepInto</Action>
</Function>
<Function>
<Name>(ImVector|ImSpan).*::operator.+</Name>
<Action>NoStepInto</Action>
</Function>

</StepFilter>
16 changes: 7 additions & 9 deletions misc/debuggers/imgui.natvis
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
natvis file for Visual Studio debugger
Provide nicer views on data types used by Dear ImGui.
To enable:
- include file in your VS project (recommended: not intrusive and always kept up to date)
- copy in %USERPROFILE%\Documents\Visual Studio XXXX\Visualizers (current user)
- copy in %VsInstallDirectory%\Common7\Packages\Debugger\Visualizers (all users)
.natvis file for Visual Studio debugger.
Purpose: provide nicer views on data types used by Dear ImGui.
More references? See https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2019
To enable:
* include file in your VS project (most recommended: not intrusive and always kept up to date!)
* or copy in %USERPROFILE%\Documents\Visual Studio XXXX\Visualizers (current user)
* or copy in %VsInstallDirectory%\Common7\Packages\Debugger\Visualizers (all users)
More information at: https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2019
-->

<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
Expand Down

0 comments on commit 1bc6f82

Please sign in to comment.