diff options
-rw-r--r-- | floormat/main.hpp | 1 | ||||
-rw-r--r-- | main/debug-break.cpp | 18 | ||||
-rw-r--r-- | main/debug.cpp | 3 | ||||
-rw-r--r-- | src/anim.hpp | 2 |
4 files changed, 22 insertions, 2 deletions
diff --git a/floormat/main.hpp b/floormat/main.hpp index 08d94404..9cc8f9a6 100644 --- a/floormat/main.hpp +++ b/floormat/main.hpp @@ -70,6 +70,7 @@ struct floormat_main static int get_mods() noexcept; [[nodiscard]] static floormat_main* create(floormat_app& app, fm_settings&& options); + [[maybe_unused]] static void debug_break(); protected: float _frame_time1 = 0, _frame_time2 = 0; diff --git a/main/debug-break.cpp b/main/debug-break.cpp new file mode 100644 index 00000000..218dbe41 --- /dev/null +++ b/main/debug-break.cpp @@ -0,0 +1,18 @@ +#include "floormat/main.hpp" +#ifdef _WIN32 +#include <windows.h> +#else +#include <sys/ptrace.h> +#include <signal.h> +#endif + +void floormat::floormat_main::debug_break() +{ +#ifdef _WIN32 + if (IsDebuggerPresent()) [[unlikely]] + DebugBreak(); +#else + if (ptrace(PTRACE_TRACEME, 0, 1, 0) == -1) + ::raise(SIGUSR1); +#endif +} diff --git a/main/debug.cpp b/main/debug.cpp index 70a1b1e8..3f5a7b16 100644 --- a/main/debug.cpp +++ b/main/debug.cpp @@ -48,7 +48,8 @@ void main_impl::debug_callback(unsigned src, unsigned type, unsigned id, unsigne std::abort(); #endif - std::fputs("", stdout); // put breakpoint here + debug_break(); + //std::fputs("", stdout); // put breakpoint here } static void _debug_callback(GL::DebugOutput::Source src, GL::DebugOutput::Type type, UnsignedInt id, diff --git a/src/anim.hpp b/src/anim.hpp index 2927b7e3..c2a2d0d1 100644 --- a/src/anim.hpp +++ b/src/anim.hpp @@ -24,7 +24,7 @@ struct anim_group final { String name, mirror_from; std::vector<anim_frame> frames; - Vector2ui ground; + Vector2ui ground; // for use in anim-crop-tool only Vector3b offset; }; |