mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Debug Log: can output to debugger. Added ImGuiDebugLogFlags_OutputToDebugger.
This commit is contained in:
parent
9d4fafa671
commit
ded52c71d9
3 changed files with 15 additions and 3 deletions
|
|
@ -72,6 +72,7 @@ Other Changes:
|
||||||
- Debug Tools:
|
- Debug Tools:
|
||||||
- Debug Log: fixed incorrectly printing characters in IO log when submitting
|
- Debug Log: fixed incorrectly printing characters in IO log when submitting
|
||||||
non-ASCII values to io.AddInputCharacter(). (#9099)
|
non-ASCII values to io.AddInputCharacter(). (#9099)
|
||||||
|
- Debug Log: can output to debugger on Windows. (#5855)
|
||||||
- Backends:
|
- Backends:
|
||||||
- SDL_GPU3: macOS version can use MSL shaders in order to support macOS 10.14+
|
- SDL_GPU3: macOS version can use MSL shaders in order to support macOS 10.14+
|
||||||
(vs Metallib shaders requiring macOS 14+). Requires application calling
|
(vs Metallib shaders requiring macOS 14+). Requires application calling
|
||||||
|
|
|
||||||
14
imgui.cpp
14
imgui.cpp
|
|
@ -17560,14 +17560,23 @@ void ImGui::DebugLogV(const char* fmt, va_list args)
|
||||||
g.DebugLogBuf.appendf("[%05d] ", g.FrameCount);
|
g.DebugLogBuf.appendf("[%05d] ", g.FrameCount);
|
||||||
g.DebugLogBuf.appendfv(fmt, args);
|
g.DebugLogBuf.appendfv(fmt, args);
|
||||||
g.DebugLogIndex.append(g.DebugLogBuf.c_str(), old_size, g.DebugLogBuf.size());
|
g.DebugLogIndex.append(g.DebugLogBuf.c_str(), old_size, g.DebugLogBuf.size());
|
||||||
|
|
||||||
|
const char* str = g.DebugLogBuf.begin() + old_size;
|
||||||
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY)
|
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY)
|
||||||
IMGUI_DEBUG_PRINTF("%s", g.DebugLogBuf.begin() + old_size);
|
IMGUI_DEBUG_PRINTF("%s", str);
|
||||||
|
#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
|
||||||
|
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToDebugger)
|
||||||
|
{
|
||||||
|
::OutputDebugStringA("[imgui] ");
|
||||||
|
::OutputDebugStringA(str);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
// IMGUI_TEST_ENGINE_LOG() adds a trailing \n automatically
|
// IMGUI_TEST_ENGINE_LOG() adds a trailing \n automatically
|
||||||
const int new_size = g.DebugLogBuf.size();
|
const int new_size = g.DebugLogBuf.size();
|
||||||
const bool trailing_carriage_return = (g.DebugLogBuf[new_size - 1] == '\n');
|
const bool trailing_carriage_return = (g.DebugLogBuf[new_size - 1] == '\n');
|
||||||
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTestEngine)
|
if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTestEngine)
|
||||||
IMGUI_TEST_ENGINE_LOG("%.*s", new_size - old_size - (trailing_carriage_return ? 1 : 0), g.DebugLogBuf.begin() + old_size);
|
IMGUI_TEST_ENGINE_LOG("%.*s", new_size - old_size - (trailing_carriage_return ? 1 : 0), str);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -17647,6 +17656,7 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
|
||||||
if (BeginPopup("Outputs"))
|
if (BeginPopup("Outputs"))
|
||||||
{
|
{
|
||||||
CheckboxFlags("OutputToTTY", &g.DebugLogFlags, ImGuiDebugLogFlags_OutputToTTY);
|
CheckboxFlags("OutputToTTY", &g.DebugLogFlags, ImGuiDebugLogFlags_OutputToTTY);
|
||||||
|
CheckboxFlags("OutputToDebugger", &g.DebugLogFlags, ImGuiDebugLogFlags_OutputToDebugger);
|
||||||
#ifndef IMGUI_ENABLE_TEST_ENGINE
|
#ifndef IMGUI_ENABLE_TEST_ENGINE
|
||||||
BeginDisabled();
|
BeginDisabled();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2078,7 +2078,8 @@ enum ImGuiDebugLogFlags_
|
||||||
|
|
||||||
ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventError | ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventClipper | ImGuiDebugLogFlags_EventSelection | ImGuiDebugLogFlags_EventIO | ImGuiDebugLogFlags_EventFont | ImGuiDebugLogFlags_EventInputRouting | ImGuiDebugLogFlags_EventDocking | ImGuiDebugLogFlags_EventViewport,
|
ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventError | ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventClipper | ImGuiDebugLogFlags_EventSelection | ImGuiDebugLogFlags_EventIO | ImGuiDebugLogFlags_EventFont | ImGuiDebugLogFlags_EventInputRouting | ImGuiDebugLogFlags_EventDocking | ImGuiDebugLogFlags_EventViewport,
|
||||||
ImGuiDebugLogFlags_OutputToTTY = 1 << 20, // Also send output to TTY
|
ImGuiDebugLogFlags_OutputToTTY = 1 << 20, // Also send output to TTY
|
||||||
ImGuiDebugLogFlags_OutputToTestEngine = 1 << 21, // Also send output to Test Engine
|
ImGuiDebugLogFlags_OutputToDebugger = 1 << 21, // Also send output to Debugger Console [Windows only]
|
||||||
|
ImGuiDebugLogFlags_OutputToTestEngine = 1 << 22, // Also send output to Dear ImGui Test Engine
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiDebugAllocEntry
|
struct ImGuiDebugAllocEntry
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue