mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 13:05:47 +00:00
Diagnostic: log kill, prctl and thread exit
This commit is contained in:
1 parent
e691375eea
commit
730fe7e7c6
1 file changed
+67
-2
@@ -85,8 +85,57 @@ index d2626fd..1dc85de 100644
|
||||
switch (ActionMasked) {
|
||||
// Unknown actions behave like RET_KILL_PROCESS.
|
||||
default:
|
||||
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp
|
||||
index 602e175..de49917 100644
|
||||
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp
|
||||
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Passthrough.cpp
|
||||
@@ -13,6 +13,7 @@ $end_info$
|
||||
#include "LinuxSyscalls/SignalTrace.h"
|
||||
|
||||
#include <errno.h>
|
||||
+#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
@@ -303,6 +304,7 @@ static void RegisterCommon(FEX::HLE::SyscallHandler* Handler) {
|
||||
if (SigTrace::Enabled()) {
|
||||
SigTrace::Log(::syscall(SYS_gettid), SigTrace::Kill, sig, pid, 0);
|
||||
}
|
||||
+ ::dprintf(2, "DDPT %d/%ld kill pid=%d sig=%d\n", ::getpid(), ::syscall(SYS_gettid), pid, sig);
|
||||
uint64_t Result = ::syscall(SYSCALL_DEF(kill), pid, sig);
|
||||
SYSCALL_ERRNO();
|
||||
});
|
||||
@@ -372,6 +374,7 @@ static void RegisterCommon(FEX::HLE::SyscallHandler* Handler) {
|
||||
if (SigTrace::Enabled()) {
|
||||
SigTrace::Log(::syscall(SYS_gettid), SigTrace::Kill, sig, tid, 0);
|
||||
}
|
||||
+ ::dprintf(2, "DDPT %d/%ld tkill tid=%d sig=%d\n", ::getpid(), ::syscall(SYS_gettid), tid, sig);
|
||||
uint64_t Result = ::syscall(SYSCALL_DEF(tkill), tid, sig);
|
||||
SYSCALL_ERRNO();
|
||||
});
|
||||
@@ -388,6 +391,7 @@ static void RegisterCommon(FEX::HLE::SyscallHandler* Handler) {
|
||||
if (SigTrace::Enabled()) {
|
||||
SigTrace::Log(::syscall(SYS_gettid), SigTrace::Kill, sig, tid, tgid);
|
||||
}
|
||||
+ if (tgid != ::getpid() || (sig != 10 && sig != 12 && sig < 32)) ::dprintf(2, "DDPT %d/%ld tgkill tgid=%d tid=%d sig=%d\n", ::getpid(), ::syscall(SYS_gettid), tgid, tid, sig);
|
||||
uint64_t Result = ::syscall(SYSCALL_DEF(tgkill), tgid, tid, sig);
|
||||
SYSCALL_ERRNO();
|
||||
});
|
||||
@@ -582,7 +586,11 @@ namespace x64 {
|
||||
REGISTER_SYSCALL_IMPL_X64(preadv2, SyscallPassthrough6<SYSCALL_DEF(preadv2)>);
|
||||
REGISTER_SYSCALL_IMPL_X64(pwritev2, SyscallPassthrough6<SYSCALL_DEF(pwritev2)>);
|
||||
REGISTER_SYSCALL_IMPL_X64(io_pgetevents, SyscallPassthrough6<SYSCALL_DEF(io_pgetevents)>);
|
||||
- REGISTER_SYSCALL_IMPL_X64(pidfd_send_signal, SyscallPassthrough4<SYSCALL_DEF(pidfd_send_signal)>);
|
||||
+ REGISTER_SYSCALL_IMPL_X64(pidfd_send_signal, [](FEXCore::Core::CpuStateFrame* Frame, int pidfd, int sig, void* info, unsigned int flags) -> uint64_t {
|
||||
+ ::dprintf(2, "DDPT %d/%ld pidfd_send_signal fd=%d sig=%d\n", ::getpid(), ::syscall(SYS_gettid), pidfd, sig);
|
||||
+ uint64_t Result = ::syscall(SYSCALL_DEF(pidfd_send_signal), pidfd, sig, info, flags);
|
||||
+ SYSCALL_ERRNO();
|
||||
+ });
|
||||
REGISTER_SYSCALL_IMPL_X64(process_madvise, SyscallPassthrough5<SYSCALL_DEF(process_madvise)>);
|
||||
REGISTER_SYSCALL_IMPL_X64(fadvise64, SyscallPassthrough4<SYSCALL_DEF(fadvise64)>);
|
||||
if (Handler->IsHostKernelVersionAtLeast(6, 5, 0)) {
|
||||
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Thread.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Thread.cpp
|
||||
index de6daa9..6934c59 100644
|
||||
index de6daa9..34d110d 100644
|
||||
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Thread.cpp
|
||||
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls/Thread.cpp
|
||||
@@ -5,6 +5,8 @@ tags: LinuxSyscalls|syscalls-shared
|
||||
@@ -98,7 +147,23 @@ index de6daa9..6934c59 100644
|
||||
#include "CodeLoader.h"
|
||||
|
||||
#include "LinuxSyscalls/SignalDelegator.h"
|
||||
@@ -599,6 +601,7 @@ void RegisterThread(FEX::HLE::SyscallHandler* Handler) {
|
||||
@@ -456,6 +458,7 @@ void RegisterThread(FEX::HLE::SyscallHandler* Handler) {
|
||||
}));
|
||||
|
||||
REGISTER_SYSCALL_IMPL(exit, [](FEXCore::Core::CpuStateFrame* Frame, int status) -> uint64_t {
|
||||
+ ::dprintf(2, "DDPT %d/%ld exit status=%d\n", ::getpid(), ::syscall(SYS_gettid), status);
|
||||
// TLS/DTV teardown is something FEX can't control. Disable glibc checking when we leave a pthread.
|
||||
// Since this thread is hard stopping, we can't track the TLS/DTV teardown in FEX's thread handling.
|
||||
FEXCore::Allocator::YesIKnowImNotSupposedToUseTheGlibcAllocator::HardDisable();
|
||||
@@ -487,6 +490,7 @@ void RegisterThread(FEX::HLE::SyscallHandler* Handler) {
|
||||
[](FEXCore::Core::CpuStateFrame* Frame, int option, unsigned long arg2, unsigned long arg3, unsigned long arg4,
|
||||
unsigned long arg5) -> uint64_t {
|
||||
uint64_t Result {};
|
||||
+ ::dprintf(2, "DDPT %d/%ld prctl op=%d a2=%#lx a3=%#lx\n", ::getpid(), ::syscall(SYS_gettid), option, arg2, arg3);
|
||||
#ifndef PR_GET_AUXV
|
||||
#define PR_GET_AUXV 0x41555856
|
||||
#endif
|
||||
@@ -599,6 +603,7 @@ void RegisterThread(FEX::HLE::SyscallHandler* Handler) {
|
||||
});
|
||||
|
||||
REGISTER_SYSCALL_IMPL(exit_group, [](FEXCore::Core::CpuStateFrame* Frame, int status) -> uint64_t {
|
||||
|
||||
Reference in new issue
Block a user