mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
WIP POC
This commit is contained in:
parent
54053f7e24
commit
161edef2a8
@ -111,7 +111,44 @@ void set_exception_handler() {
|
|||||||
SetUnhandledExceptionFilter(windows_exception_handler);
|
SetUnhandledExceptionFilter(windows_exception_handler);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void print_trace()
|
||||||
|
{
|
||||||
|
auto uid = geteuid ();
|
||||||
|
|
||||||
|
std::cout << "running as user id " << uid << std::endl;
|
||||||
|
|
||||||
|
char pid_buf[30];
|
||||||
|
sprintf(pid_buf, "%d", getpid());
|
||||||
|
char name_buf[512];
|
||||||
|
name_buf[readlink("/proc/self/exe", name_buf, 511)] = 0;
|
||||||
|
int child_pid = fork();
|
||||||
|
if (!child_pid) {
|
||||||
|
dup2(2, 1); // redirect output to stderr
|
||||||
|
fprintf(stdout, "stack trace for %s pid=%s\n", name_buf, pid_buf);
|
||||||
|
if (uid == 0) {
|
||||||
|
execlp("gdb", "gdb", "--batch", "-n", "-ex", "thread", "-ex", "bt", name_buf, pid_buf, NULL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
execlp("sudo", "gdb", "gdb", "--batch", "-n", "-ex", "thread", "-ex", "bt", name_buf, pid_buf, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
abort(); /* If gdb failed to start */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
waitpid(child_pid, NULL, 0);
|
||||||
|
}
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// crash is off or an unhandled platform
|
// crash is off or an unhandled platform
|
||||||
void set_exception_handler() {
|
void set_exception_handler()
|
||||||
|
{
|
||||||
|
signal(SIGSEGV, reinterpret_cast<void (*)(int)>(print_trace));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -34,6 +34,9 @@ bool EQEmu::ProfanityManager::LoadProfanityList(DBcore *db) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* gpf = 0;
|
||||||
|
memcpy(gpf, "Ready to crash", 30);
|
||||||
|
|
||||||
if (!load_database_entries(db))
|
if (!load_database_entries(db))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user