EntropyEngine::Core::Debug
EntropyEngine::Core::Debug
Section titled “EntropyEngine::Core::Debug”Classes
Section titled “Classes”| Name | |
|---|---|
| class | EntropyEngine::Core::Debug::ScopedTimer Scoped debug timer for measuring execution time. |
| class | EntropyEngine::Core::Debug::Named Simple implementation of INamed that can be inherited. |
| class | EntropyEngine::Core::Debug::INamed Interface for objects that support debug naming. |
| class | EntropyEngine::Core::Debug::DebugSystem Central command center for all debugging operations. |
| class | EntropyEngine::Core::Debug::DebugScope RAII helper for debug scope tracking. |
| class | EntropyEngine::Core::Debug::DebugRegistry Registry for runtime object tracking and discovery. |
| class | EntropyEngine::Core::Debug::AutoDebugRegistered RAII wrapper for automatic debug registration. |
Functions
Section titled “Functions”| 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. |
| bool | isDebuggerAttached() 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. |
| void | debugBreak() Trigger a debugger breakpoint. |
Functions Documentation
Section titled “Functions Documentation”function validatePointer
Section titled “function validatePointer”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();}function isDebuggerAttached
Section titled “function isDebuggerAttached”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();}function debugFormat
Section titled “function debugFormat”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);function debugBreak
Section titled “function debugBreak”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