Added stacktrace info in crashlogs

This commit is contained in:
DepressedTWM 2026-06-01 09:26:48 -04:00
parent 92e20199af
commit 87d317c0f7
2 changed files with 6 additions and 2 deletions

View file

@ -314,7 +314,7 @@ source_group("Binding Source" FILES ${BINDING_SOURCE} ${BINDING_HEADERS})
## Setup main executable ## ## Setup main executable ##
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 23)
add_executable(${PROJECT_NAME} MACOSX_BUNDLE WIN32 add_executable(${PROJECT_NAME} MACOSX_BUNDLE WIN32
${MAIN_HEADERS} ${MAIN_HEADERS}

View file

@ -24,6 +24,8 @@
#include <physfs.h> #include <physfs.h>
#include <pixman.h> #include <pixman.h>
#include <boost/stacktrace.hpp>
#ifdef __LINUX__ #ifdef __LINUX__
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "xdg-user-dir-lookup.h" #include "xdg-user-dir-lookup.h"
@ -66,6 +68,8 @@ void crash(const char* reason, Exception::Type t, bool do_exp){
if (out.is_open()){ if (out.is_open()){
out << "[SUNSHINE CRASHDUMP]" << std::endl; out << "[SUNSHINE CRASHDUMP]" << std::endl;
try{ try{
out << boost::stacktrace::stacktrace() << std::endl;
out << "REASON: " << reason << std::endl;
out << "GL Vendor: " << glGetStringInt(GL_VENDOR) << std::endl; out << "GL Vendor: " << glGetStringInt(GL_VENDOR) << std::endl;
out << "GL Renderer: " << glGetStringInt(GL_RENDERER) << std::endl; out << "GL Renderer: " << glGetStringInt(GL_RENDERER) << std::endl;
out << "GL Version: " << glGetStringInt(GL_VERSION) << std::endl; out << "GL Version: " << glGetStringInt(GL_VERSION) << std::endl;
@ -98,7 +102,7 @@ void crash(const char* reason, Exception::Type t, bool do_exp){
out << "OpenAL version: " << AL_VERSION << std::endl; out << "OpenAL version: " << AL_VERSION << std::endl;
out << "Boost versino: " << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000 << "." << BOOST_VERSION % 100 << std::endl; out << "Boost versino: " << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000 << "." << BOOST_VERSION % 100 << std::endl;
out << "Pixman version: " << PIXMAN_VERSION_STRING << std::endl; out << "Pixman version: " << PIXMAN_VERSION_STRING << std::endl;
out << "Stack trace" << std::endl;
out.close(); out.close();
}else{ }else{
printf("[CRASHLOG] Failed to write crashdump file\n"); printf("[CRASHLOG] Failed to write crashdump file\n");