Skip to content

EntropyEngine::Core::Debug

Name
classEntropyEngine::Core::Debug::ScopedTimer
Scoped debug timer for measuring execution time.
classEntropyEngine::Core::Debug::Named
Simple implementation of INamed that can be inherited.
classEntropyEngine::Core::Debug::INamed
Interface for objects that support debug naming.
classEntropyEngine::Core::Debug::DebugSystem
Central command center for all debugging operations.
classEntropyEngine::Core::Debug::DebugScope
RAII helper for debug scope tracking.
classEntropyEngine::Core::Debug::DebugRegistry
Registry for runtime object tracking and discovery.
classEntropyEngine::Core::Debug::AutoDebugRegistered
RAII wrapper for automatic debug registration.
Name
template <typename T >
bool
validatePointer(T * ptr, std::string_view name, const std::source_location & loc =std::source_location::current())
Validate a pointer and log if null.
boolisDebuggerAttached()
Check if a debugger is attached to the process.
template <typename… Args>
std::string
debugFormat(std::format_string< Args… > fmt, Args &&… args)
Helper to create formatted debug strings.
voiddebugBreak()
Trigger a debugger breakpoint.
template <typename T >
bool validatePointer(
T * ptr,
std::string_view name,
const std::source_location & loc =std::source_location::current()
)

Validate a pointer and log if null.

Parameters:

  • ptr The pointer to validate
  • name Human-readable name for the pointer
  • loc Source location (captured automatically)

Template Parameters:

  • T The pointed-to type

Return: true if pointer is valid, false if null

Validates pointers and logs error with source location when null. Uses C++20 source_location for automatic location capture.

void processWidget(Widget* widget) {
if (!validatePointer(widget, "widget")) {
return; // Error logged with file:line information
}
// Pointer is valid
widget->update();
}
inline bool isDebuggerAttached()

Check if a debugger is attached to the process.

Return: true if a debugger is attached, false otherwise

Useful for conditional behavior like enhanced validation during debugging. Works on Windows (IsDebuggerPresent), macOS (sysctl), and Linux (/proc).

if (isDebuggerAttached()) {
// Enable additional validation when debugging
validateAllInvariants();
dumpDetailedState();
}
template <typename... Args>
std::string debugFormat(
std::format_string< Args... > fmt,
Args &&... args
)

Helper to create formatted debug strings.

Parameters:

  • fmt Format string using std::format syntax
  • args Arguments to format

Template Parameters:

  • Args Variadic template arguments

Return: Formatted string

Type-safe string formatting using C++20’s std::format.

auto msg = debugFormat("Object {} at position ({}, {}) has {} children",
obj.getName(), obj.x, obj.y, obj.getChildCount());
LOG_DEBUG(msg);
inline void debugBreak()

Trigger a debugger breakpoint.

Stops execution when a debugger is attached. Uses platform-specific intrinsics for clean breakpoint handling.

if (criticalErrorOccurred) {
LOG_ERROR("Critical error detected");
debugBreak(); // Stop execution for debugging
}

Updated on 2026-01-26 at 17:14:35 -0500