mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-23 11:15:34 +08:00
add all crash printer tests
This commit is contained in:
parent
7b810764fa
commit
fa59283f1c
@ -12,4 +12,4 @@ void deinit();
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _CRASH_PRINTER_WIN
|
#endif // _CRASH_PRINTER_WIN
|
||||||
|
@ -1,165 +1,165 @@
|
|||||||
// https://stackoverflow.com/a/1925461
|
// https://stackoverflow.com/a/1925461
|
||||||
|
|
||||||
#include "common_helpers/common_helpers.hpp"
|
#include "common_helpers/common_helpers.hpp"
|
||||||
#include "crash_printer/linux.hpp"
|
#include "crash_printer/linux.hpp"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
#include <signal.h> // SIGBUS + SA_SIGINFO ...
|
#include <signal.h> // SIGBUS + SA_SIGINFO ...
|
||||||
#include <string.h> // strsignal
|
#include <string.h> // strsignal
|
||||||
#include <execinfo.h> // backtrace + backtrace_symbols
|
#include <execinfo.h> // backtrace + backtrace_symbols
|
||||||
|
|
||||||
constexpr static const int max_stack_frames = 50;
|
constexpr static const int max_stack_frames = 50;
|
||||||
|
|
||||||
static bool old_SIGILL = false;
|
static bool old_SIGILL = false;
|
||||||
static struct sigaction oldact_SIGILL{};
|
static struct sigaction oldact_SIGILL{};
|
||||||
|
|
||||||
static bool old_SIGSEGV = false;
|
static bool old_SIGSEGV = false;
|
||||||
static struct sigaction oldact_SIGSEGV{};
|
static struct sigaction oldact_SIGSEGV{};
|
||||||
|
|
||||||
static bool old_SIGBUS = false;
|
static bool old_SIGBUS = false;
|
||||||
static struct sigaction oldact_SIGBUS{};
|
static struct sigaction oldact_SIGBUS{};
|
||||||
|
|
||||||
static std::string logs_filepath{};
|
static std::string logs_filepath{};
|
||||||
|
|
||||||
static void restore_handlers()
|
static void restore_handlers()
|
||||||
{
|
{
|
||||||
if (old_SIGILL) {
|
if (old_SIGILL) {
|
||||||
old_SIGILL = false;
|
old_SIGILL = false;
|
||||||
sigaction(SIGILL, &oldact_SIGILL, nullptr);
|
sigaction(SIGILL, &oldact_SIGILL, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_SIGSEGV) {
|
if (old_SIGSEGV) {
|
||||||
old_SIGSEGV = false;
|
old_SIGSEGV = false;
|
||||||
sigaction(SIGSEGV, &oldact_SIGSEGV, nullptr);
|
sigaction(SIGSEGV, &oldact_SIGSEGV, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_SIGBUS) {
|
if (old_SIGBUS) {
|
||||||
old_SIGBUS = false;
|
old_SIGBUS = false;
|
||||||
sigaction(SIGBUS, &oldact_SIGBUS, nullptr);
|
sigaction(SIGBUS, &oldact_SIGBUS, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exception_handler(int signal, siginfo_t *info, void *context, struct sigaction *oldact)
|
static void exception_handler(int signal, siginfo_t *info, void *context, struct sigaction *oldact)
|
||||||
{
|
{
|
||||||
if (!common_helpers::create_dir(logs_filepath)) {
|
if (!common_helpers::create_dir(logs_filepath)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ofstream file(logs_filepath, std::ios::app);
|
std::ofstream file(logs_filepath, std::ios::app);
|
||||||
|
|
||||||
std::string time(common_helpers::get_utc_time());
|
std::string time(common_helpers::get_utc_time());
|
||||||
common_helpers::write(file, "[" + time + "]");
|
common_helpers::write(file, "[" + time + "]");
|
||||||
{
|
{
|
||||||
std::stringstream ss{};
|
std::stringstream ss{};
|
||||||
ss << "Unhandled exception:" << std::endl
|
ss << "Unhandled exception:" << std::endl
|
||||||
<< " code: " << std::dec << signal << " (" << strsignal(signal) << ")" << std::endl;
|
<< " code: " << std::dec << signal << " (" << strsignal(signal) << ")" << std::endl;
|
||||||
common_helpers::write(file, ss.str());
|
common_helpers::write(file, ss.str());
|
||||||
}
|
}
|
||||||
void* stack_frames[max_stack_frames];
|
void* stack_frames[max_stack_frames];
|
||||||
int stack_size = backtrace(stack_frames, max_stack_frames);
|
int stack_size = backtrace(stack_frames, max_stack_frames);
|
||||||
char** stack_symbols = backtrace_symbols(stack_frames, stack_size);
|
char** stack_symbols = backtrace_symbols(stack_frames, stack_size);
|
||||||
|
|
||||||
if (stack_symbols != nullptr) {
|
if (stack_symbols != nullptr) {
|
||||||
// fprintf(stderr, "Stack trace:\n");
|
// fprintf(stderr, "Stack trace:\n");
|
||||||
common_helpers::write(file, "*********** Stack trace ***********");
|
common_helpers::write(file, "*********** Stack trace ***********");
|
||||||
for (int i = 1; i < stack_size; ++i) {
|
for (int i = 1; i < stack_size; ++i) {
|
||||||
char *symbol = stack_symbols[i];
|
char *symbol = stack_symbols[i];
|
||||||
std::stringstream ss{};
|
std::stringstream ss{};
|
||||||
ss << "[frame " << std::dec << (stack_size - i - 1) << "]: "
|
ss << "[frame " << std::dec << (stack_size - i - 1) << "]: "
|
||||||
<< std::hex << stack_frames[i] << " | "
|
<< std::hex << stack_frames[i] << " | "
|
||||||
<< symbol;
|
<< symbol;
|
||||||
common_helpers::write(file, ss.str());
|
common_helpers::write(file, ss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
free(stack_symbols);
|
free(stack_symbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
common_helpers::write(file, "**********************************\n");
|
common_helpers::write(file, "**********************************\n");
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register the signal handler for illegal instruction (SIGILL)
|
// Register the signal handler for illegal instruction (SIGILL)
|
||||||
static void exception_handler_SIGILL(int signal, siginfo_t *info, void *context) {
|
static void exception_handler_SIGILL(int signal, siginfo_t *info, void *context) {
|
||||||
exception_handler(signal, info, context, &oldact_SIGILL);
|
exception_handler(signal, info, context, &oldact_SIGILL);
|
||||||
sigaction(SIGILL, &oldact_SIGILL, nullptr);
|
sigaction(SIGILL, &oldact_SIGILL, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exception_handler_SIGSEGV(int signal, siginfo_t *info, void *context) {
|
static void exception_handler_SIGSEGV(int signal, siginfo_t *info, void *context) {
|
||||||
exception_handler(signal, info, context, &oldact_SIGSEGV);
|
exception_handler(signal, info, context, &oldact_SIGSEGV);
|
||||||
sigaction(SIGSEGV, &oldact_SIGSEGV, nullptr);
|
sigaction(SIGSEGV, &oldact_SIGSEGV, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exception_handler_SIGBUS(int signal, siginfo_t *info, void *context) {
|
static void exception_handler_SIGBUS(int signal, siginfo_t *info, void *context) {
|
||||||
exception_handler(signal, info, context, &oldact_SIGBUS);
|
exception_handler(signal, info, context, &oldact_SIGBUS);
|
||||||
sigaction(SIGBUS, &oldact_SIGBUS, nullptr);
|
sigaction(SIGBUS, &oldact_SIGBUS, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool crash_printer::init(const std::string &log_file)
|
bool crash_printer::init(const std::string &log_file)
|
||||||
{
|
{
|
||||||
logs_filepath = log_file;
|
logs_filepath = log_file;
|
||||||
|
|
||||||
// save old handlers
|
// save old handlers
|
||||||
// https://linux.die.net/man/2/sigaction
|
// https://linux.die.net/man/2/sigaction
|
||||||
if (
|
if (
|
||||||
sigaction(SIGILL, nullptr, &oldact_SIGILL) != 0 ||
|
sigaction(SIGILL, nullptr, &oldact_SIGILL) != 0 ||
|
||||||
sigaction(SIGSEGV, nullptr, &oldact_SIGSEGV) != 0 ||
|
sigaction(SIGSEGV, nullptr, &oldact_SIGSEGV) != 0 ||
|
||||||
sigaction(SIGBUS, nullptr, &oldact_SIGBUS) != 0) {
|
sigaction(SIGBUS, nullptr, &oldact_SIGBUS) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr int sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK | SA_RESETHAND | SA_NOCLDSTOP;
|
constexpr int sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK | SA_RESETHAND | SA_NOCLDSTOP;
|
||||||
|
|
||||||
// https://linux.die.net/man/2/sigaction
|
// https://linux.die.net/man/2/sigaction
|
||||||
// register handler for illegal instruction (SIGILL)
|
// register handler for illegal instruction (SIGILL)
|
||||||
struct sigaction sa_SIGILL{};
|
struct sigaction sa_SIGILL{};
|
||||||
sa_SIGILL.sa_sigaction = exception_handler_SIGILL;
|
sa_SIGILL.sa_sigaction = exception_handler_SIGILL;
|
||||||
sa_SIGILL.sa_flags = sa_flags;
|
sa_SIGILL.sa_flags = sa_flags;
|
||||||
sigemptyset(&sa_SIGILL.sa_mask); // all signals unblocked
|
sigemptyset(&sa_SIGILL.sa_mask); // all signals unblocked
|
||||||
if (sigaction(SIGILL, &sa_SIGILL, nullptr) != 0) {
|
if (sigaction(SIGILL, &sa_SIGILL, nullptr) != 0) {
|
||||||
restore_handlers();
|
restore_handlers();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
old_SIGILL = true;
|
old_SIGILL = true;
|
||||||
|
|
||||||
// register handler for segmentation fault (SIGSEGV)
|
// register handler for segmentation fault (SIGSEGV)
|
||||||
struct sigaction sa_SIGSEGV{};
|
struct sigaction sa_SIGSEGV{};
|
||||||
sa_SIGSEGV.sa_sigaction = exception_handler_SIGSEGV;
|
sa_SIGSEGV.sa_sigaction = exception_handler_SIGSEGV;
|
||||||
sa_SIGSEGV.sa_flags = sa_flags;
|
sa_SIGSEGV.sa_flags = sa_flags;
|
||||||
sigemptyset(&sa_SIGSEGV.sa_mask); // all signals unblocked
|
sigemptyset(&sa_SIGSEGV.sa_mask); // all signals unblocked
|
||||||
if (sigaction(SIGSEGV, &sa_SIGSEGV, nullptr) != 0) {
|
if (sigaction(SIGSEGV, &sa_SIGSEGV, nullptr) != 0) {
|
||||||
restore_handlers();
|
restore_handlers();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
old_SIGSEGV = true;
|
old_SIGSEGV = true;
|
||||||
|
|
||||||
// register handler for bus error (SIGBUS)
|
// register handler for bus error (SIGBUS)
|
||||||
struct sigaction sa_SIGBUS{};
|
struct sigaction sa_SIGBUS{};
|
||||||
sa_SIGBUS.sa_sigaction = exception_handler_SIGBUS;
|
sa_SIGBUS.sa_sigaction = exception_handler_SIGBUS;
|
||||||
sa_SIGBUS.sa_flags = sa_flags;
|
sa_SIGBUS.sa_flags = sa_flags;
|
||||||
sigemptyset(&sa_SIGBUS.sa_mask); // all signals unblocked
|
sigemptyset(&sa_SIGBUS.sa_mask); // all signals unblocked
|
||||||
if (sigaction(SIGBUS, &sa_SIGBUS, nullptr) != 0) {
|
if (sigaction(SIGBUS, &sa_SIGBUS, nullptr) != 0) {
|
||||||
restore_handlers();
|
restore_handlers();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
old_SIGBUS = true;
|
old_SIGBUS = true;
|
||||||
|
|
||||||
// // register handler for floating-point exception (SIGFPE)
|
// // register handler for floating-point exception (SIGFPE)
|
||||||
// if (sigaction(SIGFPE, &sa, nullptr) != 0) {
|
// if (sigaction(SIGFPE, &sa, nullptr) != 0) {
|
||||||
// perror("Error setting up signal handler");
|
// perror("Error setting up signal handler");
|
||||||
// return EXIT_FAILURE;
|
// return EXIT_FAILURE;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void crash_printer::deinit()
|
void crash_printer::deinit()
|
||||||
{
|
{
|
||||||
restore_handlers();
|
restore_handlers();
|
||||||
}
|
}
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
my_dir="$(cd "$(dirname "$0")" && pwd)"
|
|
||||||
|
|
||||||
pushd "$my_dir" > /dev/null
|
|
||||||
|
|
||||||
clang++ -x c++ -rdynamic -std=c++17 -fvisibility=hidden -fexceptions -fno-jump-tables -Og -g3 -fPIE -I../ ../linux.cpp ../common.cpp test_linux_sa_handler.cpp -otest_linux_sa_handler && {
|
|
||||||
./test_linux_sa_handler ;
|
|
||||||
echo "exit code = $?" ;
|
|
||||||
rm -f ./test_linux_sa_handler ;
|
|
||||||
}
|
|
||||||
|
|
||||||
clang++ -x c++ -rdynamic -std=c++17 -fvisibility=hidden -fexceptions -fno-jump-tables -Og -g3 -fPIE -I../ ../linux.cpp ../common.cpp test_linux_sa_sigaction.cpp -otest_linux_sa_sigaction && {
|
|
||||||
./test_linux_sa_sigaction ;
|
|
||||||
echo "exit code = $?" ;
|
|
||||||
rm -f ./test_linux_sa_sigaction ;
|
|
||||||
}
|
|
||||||
|
|
||||||
clang++ -m32 -x c++ -rdynamic -std=c++17 -fvisibility=hidden -fexceptions -fno-jump-tables -Og -g3 -fPIE -I../ ../linux.cpp ../common.cpp test_linux_sa_handler.cpp -otest_linux_sa_handler && {
|
|
||||||
./test_linux_sa_handler ;
|
|
||||||
echo "exit code = $?" ;
|
|
||||||
rm -f ./test_linux_sa_handler ;
|
|
||||||
}
|
|
||||||
|
|
||||||
clang++ -m32 -x c++ -rdynamic -std=c++17 -fvisibility=hidden -fexceptions -fno-jump-tables -Og -g3 -fPIE -I../ ../linux.cpp ../common.cpp test_linux_sa_sigaction.cpp -otest_linux_sa_sigaction && {
|
|
||||||
./test_linux_sa_sigaction ;
|
|
||||||
echo "exit code = $?" ;
|
|
||||||
rm -f ./test_linux_sa_sigaction ;
|
|
||||||
}
|
|
||||||
|
|
||||||
rm -f -r ./crash_test
|
|
||||||
|
|
||||||
popd > /dev/null
|
|
@ -1,47 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
pushd "%~dp0"
|
|
||||||
|
|
||||||
call :cleanup
|
|
||||||
|
|
||||||
setlocal
|
|
||||||
call ..\..\build_win_set_env.bat 64
|
|
||||||
cl.exe /DEBUG:FULL /Z7 /Od /std:c++17 /DYNAMICBASE /errorReport:none /nologo /utf-8 /EHsc /GF /GL- /GS /MT /I../ ../win.cpp ../common.cpp test_win.cpp kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib Iphlpapi.lib Wldap32.lib Winmm.lib Bcrypt.lib Dbghelp.lib /link /DYNAMICBASE /ERRORREPORT:NONE /NOLOGO /OUT:test_win.exe && (
|
|
||||||
call test_win.exe
|
|
||||||
|
|
||||||
setlocal enableDelayedExpansion
|
|
||||||
echo exit code = !errorlevel!
|
|
||||||
endlocal
|
|
||||||
|
|
||||||
call :cleanup
|
|
||||||
)
|
|
||||||
endlocal
|
|
||||||
|
|
||||||
setlocal
|
|
||||||
call ..\..\build_win_set_env.bat 32
|
|
||||||
cl.exe /DEBUG:FULL /Z7 /Od /std:c++17 /DYNAMICBASE /errorReport:none /nologo /utf-8 /EHsc /GF /GL- /GS /MT /I../ ../win.cpp ../common.cpp test_win.cpp kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib Iphlpapi.lib Wldap32.lib Winmm.lib Bcrypt.lib Dbghelp.lib /link /DYNAMICBASE /ERRORREPORT:NONE /NOLOGO /OUT:test_win.exe && (
|
|
||||||
call test_win.exe
|
|
||||||
|
|
||||||
setlocal enableDelayedExpansion
|
|
||||||
echo exit code = !errorlevel!
|
|
||||||
endlocal
|
|
||||||
|
|
||||||
call :cleanup
|
|
||||||
)
|
|
||||||
endlocal
|
|
||||||
|
|
||||||
rmdir /s /q crash_test
|
|
||||||
|
|
||||||
popd
|
|
||||||
|
|
||||||
exit /b 0
|
|
||||||
|
|
||||||
|
|
||||||
:cleanup
|
|
||||||
del /f /q test_win.exe >nul 2>&1
|
|
||||||
del /f /q test_win.ilk >nul 2>&1
|
|
||||||
del /f /q test_win.obj >nul 2>&1
|
|
||||||
del /f /q test_win.pdb >nul 2>&1
|
|
||||||
del /f /q win.obj >nul 2>&1
|
|
||||||
del /f /q common.obj >nul 2>&1
|
|
||||||
exit /b
|
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
static inline bool remove_file(const std::string &file)
|
static inline bool remove_file(const std::string &file)
|
||||||
{
|
{
|
||||||
const std::filesystem::u8path p_file(std::filesystem::u8path(file));
|
const std::filesystem::path p_file(std::filesystem::u8path(file));
|
||||||
if (!std::filesystem::exists(p_file)) {
|
if (!std::filesystem::exists(p_file)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,53 +1,57 @@
|
|||||||
|
|
||||||
#include "crash_printer/win.hpp"
|
#include "crash_printer/win.hpp"
|
||||||
#include "./test_helper.hpp"
|
#include "./test_helper.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
std::wstring logs_filepath = L"./crash_test/zxc.txt";
|
std::wstring logs_filepath = L"./crash_test/zxc.txt";
|
||||||
|
|
||||||
|
|
||||||
static LONG WINAPI exception_handler(LPEXCEPTION_POINTERS ex_pointers)
|
static LONG WINAPI exception_handler(LPEXCEPTION_POINTERS ex_pointers)
|
||||||
{
|
{
|
||||||
std::ifstream file(logs_filepath);
|
std::ifstream file(logs_filepath);
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
std::string line{};
|
std::string line{};
|
||||||
std::getline(file, line);
|
std::getline(file, line);
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
if (line.size()) {
|
if (line.size()) {
|
||||||
std::cout << "Success!" << std::endl;
|
std::cout << "Success!" << std::endl;
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "Failed!" << std::endl;
|
std::cerr << "Failed!" << std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int* get_ptr()
|
||||||
int main()
|
{
|
||||||
{
|
return nullptr;
|
||||||
// simulate the existence of previous handler
|
}
|
||||||
SetUnhandledExceptionFilter(exception_handler);
|
|
||||||
|
int main()
|
||||||
if (!remove_file(logs_filepath)) {
|
{
|
||||||
std::cerr << "failed to remove log" << std::endl;
|
// simulate the existence of previous handler
|
||||||
return 1;
|
SetUnhandledExceptionFilter(exception_handler);
|
||||||
}
|
|
||||||
|
if (!remove_file(logs_filepath)) {
|
||||||
if (!crash_printer::init(logs_filepath)) {
|
std::cerr << "failed to remove log" << std::endl;
|
||||||
std::cerr << "failed to init" << std::endl;
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
if (!crash_printer::init(logs_filepath)) {
|
||||||
// simulate a crash
|
std::cerr << "failed to init" << std::endl;
|
||||||
volatile int * volatile ptr = nullptr;
|
return 1;
|
||||||
*ptr = 42;
|
}
|
||||||
|
|
||||||
return 0;
|
// simulate a crash
|
||||||
}
|
volatile int * volatile ptr = get_ptr();
|
||||||
|
*ptr = 42;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
145
premake5.lua
145
premake5.lua
@ -1441,6 +1441,60 @@ project "tool_file_dos_stub_changer"
|
|||||||
}
|
}
|
||||||
-- End tool_file_dos_stub_changer
|
-- End tool_file_dos_stub_changer
|
||||||
|
|
||||||
|
|
||||||
|
-- Project test_crash_printer
|
||||||
|
---------
|
||||||
|
project "test_crash_printer"
|
||||||
|
kind "ConsoleApp"
|
||||||
|
location "%{wks.location}/%{prj.name}"
|
||||||
|
targetdir("build/" .. os_iden .. "/%{_ACTION}/%{cfg.buildcfg}/tests/crash_printer")
|
||||||
|
targetname "test_crash_printer_%{cfg.platform}"
|
||||||
|
|
||||||
|
|
||||||
|
-- include dir
|
||||||
|
---------
|
||||||
|
-- common include dir
|
||||||
|
filter {} -- reset the filter and remove all active keywords
|
||||||
|
includedirs {
|
||||||
|
'crash_printer',
|
||||||
|
'helpers',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- common source & header files
|
||||||
|
---------
|
||||||
|
filter {} -- reset the filter and remove all active keywords
|
||||||
|
files { -- added to all filters, later defines will be appended
|
||||||
|
'crash_printer/' .. os_iden .. '.cpp', 'crash_printer/crash_printer/' .. os_iden .. '.hpp',
|
||||||
|
'crash_printer/tests/test_helper.hpp',
|
||||||
|
-- helpers
|
||||||
|
'helpers/common_helpers.cpp', 'helpers/common_helpers/**',
|
||||||
|
-- test files
|
||||||
|
'crash_printer/tests/test_win.cpp',
|
||||||
|
}
|
||||||
|
removefiles {
|
||||||
|
'post_build/**',
|
||||||
|
'build/deps/**',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- libs to link
|
||||||
|
---------
|
||||||
|
filter {} -- reset the filter and remove all active keywords
|
||||||
|
-- Windows libs
|
||||||
|
links {
|
||||||
|
'Dbghelp',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- post build
|
||||||
|
---------
|
||||||
|
filter {} -- reset the filter and remove all active keywords
|
||||||
|
postbuildcommands {
|
||||||
|
'%[%{!cfg.buildtarget.abspath}]',
|
||||||
|
}
|
||||||
|
-- End test_crash_printer
|
||||||
|
|
||||||
end
|
end
|
||||||
-- End WINDOWS ONLY TARGETS
|
-- End WINDOWS ONLY TARGETS
|
||||||
|
|
||||||
@ -1518,6 +1572,97 @@ project "steamclient_regular"
|
|||||||
}
|
}
|
||||||
-- End steamclient_regular
|
-- End steamclient_regular
|
||||||
|
|
||||||
|
|
||||||
|
-- Project test_crash_printer_sa_handler
|
||||||
|
---------
|
||||||
|
project "test_crash_printer_sa_handler"
|
||||||
|
kind "ConsoleApp"
|
||||||
|
location "%{wks.location}/%{prj.name}"
|
||||||
|
targetdir("build/" .. os_iden .. "/%{_ACTION}/%{cfg.buildcfg}/tests/crash_printer")
|
||||||
|
targetname "test_crash_printer_sa_handler_%{cfg.platform}"
|
||||||
|
|
||||||
|
|
||||||
|
-- include dir
|
||||||
|
---------
|
||||||
|
-- common include dir
|
||||||
|
filter {} -- reset the filter and remove all active keywords
|
||||||
|
includedirs {
|
||||||
|
'crash_printer',
|
||||||
|
'helpers',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- common source & header files
|
||||||
|
---------
|
||||||
|
filter {} -- reset the filter and remove all active keywords
|
||||||
|
files { -- added to all filters, later defines will be appended
|
||||||
|
'crash_printer/' .. os_iden .. '.cpp', 'crash_printer/crash_printer/' .. os_iden .. '.hpp',
|
||||||
|
'crash_printer/tests/test_helper.hpp',
|
||||||
|
-- helpers
|
||||||
|
'helpers/common_helpers.cpp', 'helpers/common_helpers/**',
|
||||||
|
-- test files
|
||||||
|
'crash_printer/tests/test_linux_sa_handler.cpp',
|
||||||
|
}
|
||||||
|
removefiles {
|
||||||
|
'post_build/**',
|
||||||
|
'build/deps/**',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- post build
|
||||||
|
---------
|
||||||
|
filter {} -- reset the filter and remove all active keywords
|
||||||
|
postbuildcommands {
|
||||||
|
'%[%{!cfg.buildtarget.abspath}]',
|
||||||
|
}
|
||||||
|
|
||||||
|
-- End test_crash_printer_sa_handler
|
||||||
|
|
||||||
|
|
||||||
|
-- Project test_crash_printer_sa_sigaction
|
||||||
|
---------
|
||||||
|
project "test_crash_printer_sa_sigaction"
|
||||||
|
kind "ConsoleApp"
|
||||||
|
location "%{wks.location}/%{prj.name}"
|
||||||
|
targetdir("build/" .. os_iden .. "/%{_ACTION}/%{cfg.buildcfg}/tests/crash_printer")
|
||||||
|
targetname "test_crash_printer_sa_sigaction_%{cfg.platform}"
|
||||||
|
|
||||||
|
|
||||||
|
-- include dir
|
||||||
|
---------
|
||||||
|
-- common include dir
|
||||||
|
filter {} -- reset the filter and remove all active keywords
|
||||||
|
includedirs {
|
||||||
|
'crash_printer',
|
||||||
|
'helpers',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- common source & header files
|
||||||
|
---------
|
||||||
|
filter {} -- reset the filter and remove all active keywords
|
||||||
|
files { -- added to all filters, later defines will be appended
|
||||||
|
'crash_printer/' .. os_iden .. '.cpp', 'crash_printer/crash_printer/' .. os_iden .. '.hpp',
|
||||||
|
'crash_printer/tests/test_helper.hpp',
|
||||||
|
-- helpers
|
||||||
|
'helpers/common_helpers.cpp', 'helpers/common_helpers/**',
|
||||||
|
-- test files
|
||||||
|
'crash_printer/tests/test_linux_sa_sigaction.cpp',
|
||||||
|
}
|
||||||
|
removefiles {
|
||||||
|
'post_build/**',
|
||||||
|
'build/deps/**',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- post build
|
||||||
|
---------
|
||||||
|
filter {} -- reset the filter and remove all active keywords
|
||||||
|
postbuildcommands {
|
||||||
|
'%[%{!cfg.buildtarget.abspath}]',
|
||||||
|
}
|
||||||
|
-- End test_crash_printer_sa_sigaction
|
||||||
|
|
||||||
end
|
end
|
||||||
-- End LINUX ONLY TARGETS
|
-- End LINUX ONLY TARGETS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user