mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
Diagnostic: trace syscalls after injection
This commit is contained in:
1 parent
fff1831daa
commit
22484faef4
1 file changed
+33
-5
@@ -1,5 +1,5 @@
|
||||
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.cpp
|
||||
index 62acdb0..bd95a72 100644
|
||||
index 62acdb0..53a7b44 100644
|
||||
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.cpp
|
||||
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.cpp
|
||||
@@ -27,6 +27,7 @@
|
||||
@@ -26,10 +26,15 @@ index 62acdb0..bd95a72 100644
|
||||
if (!Dirty) {
|
||||
return NoOverride;
|
||||
}
|
||||
@@ -577,10 +580,12 @@ void ApplyPendingFlush(FEXCore::Core::CpuStateFrame* Frame) {
|
||||
@@ -574,13 +577,17 @@ void ApplyPendingFlush(FEXCore::Core::CpuStateFrame* Frame) {
|
||||
}
|
||||
}
|
||||
|
||||
+bool DDTrace = false;
|
||||
uint64_t TakePendingRip() {
|
||||
const uint64_t Rip = PendingRip;
|
||||
PendingRip = 0;
|
||||
+ if (Rip) DDTrace = true;
|
||||
+ if (Rip) DDPT("take rip=%#llx", (unsigned long long)Rip);
|
||||
return Rip;
|
||||
}
|
||||
@@ -39,7 +44,7 @@ index 62acdb0..bd95a72 100644
|
||||
if (Signal != SIGTRAP && Signal != SIGSEGV) {
|
||||
return false;
|
||||
}
|
||||
@@ -631,6 +636,7 @@ bool FixupWaitStatus(pid_t Pid, int* Status) {
|
||||
@@ -631,6 +638,7 @@ bool FixupWaitStatus(pid_t Pid, int* Status) {
|
||||
return false;
|
||||
}
|
||||
const int St = *Status;
|
||||
@@ -47,7 +52,7 @@ index 62acdb0..bd95a72 100644
|
||||
|
||||
if (WIFEXITED(St) || WIFSIGNALED(St)) {
|
||||
Forget(Pid, true);
|
||||
@@ -677,6 +683,8 @@ bool FixupWaitStatus(pid_t Pid, int* Status) {
|
||||
@@ -677,6 +685,8 @@ bool FixupWaitStatus(pid_t Pid, int* Status) {
|
||||
}
|
||||
|
||||
bool HandleRequest(int Request, pid_t Pid, void* Addr, void* Data, uint64_t* Result) {
|
||||
@@ -56,6 +61,18 @@ index 62acdb0..bd95a72 100644
|
||||
switch (Request) {
|
||||
case PTRACE_TRACEME:
|
||||
*Result = HostPtrace(Request, Pid, Addr, Data);
|
||||
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.h b/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.h
|
||||
index 5919497..34685be 100644
|
||||
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.h
|
||||
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/PtraceEmu.h
|
||||
@@ -45,6 +45,7 @@ void OnForkedChild(bool SharesAddressSpace);
|
||||
|
||||
void ApplyPendingFlush(FEXCore::Core::CpuStateFrame* Frame);
|
||||
|
||||
+extern bool DDTrace;
|
||||
uint64_t TakePendingRip();
|
||||
|
||||
bool TryGuestSignalStop(FEXCore::Core::CpuStateFrame* Frame, int Signal);
|
||||
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Seccomp/SeccompEmulator.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Seccomp/SeccompEmulator.cpp
|
||||
index d2626fd..1dc85de 100644
|
||||
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Seccomp/SeccompEmulator.cpp
|
||||
@@ -106,7 +123,7 @@ index e8723e8..a3cc742 100644
|
||||
// Call back in to the previous handler
|
||||
if (Handler.OldAction.sa_flags & SA_SIGINFO) {
|
||||
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
|
||||
index 078faed..547efd8 100644
|
||||
index 078faed..a866d13 100644
|
||||
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
|
||||
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
|
||||
@@ -199,7 +199,15 @@ static fextl::string GetShebangInterpFilename(const fextl::string& Filename) {
|
||||
@@ -125,6 +142,17 @@ index 078faed..547efd8 100644
|
||||
auto SyscallHandler = FEX::HLE::_SyscallHandler;
|
||||
Frame->Thread->CTX->FlushAndCloseCodeMap();
|
||||
|
||||
@@ -903,6 +911,10 @@ void SyscallHandler::HandleSyscallImpl(FEXCore::Core::CpuStateFrame* Frame, uint
|
||||
if constexpr (Is64Bit) {
|
||||
FEX::HLE::GuestHighMemory::TranslateSyscallArguments(SyscallNum, &A[1], 6);
|
||||
}
|
||||
+ if (PtraceEmu::DDTrace) {
|
||||
+ ::dprintf(2, "DDSC %d/%ld nr=%llu a1=%#llx a2=%#llx a3=%#llx\n", ::getpid(), ::syscall(SYS_gettid), (unsigned long long)SyscallNum, (unsigned long long)A[1],
|
||||
+ (unsigned long long)A[2], (unsigned long long)A[3]);
|
||||
+ }
|
||||
uint64_t Result {};
|
||||
switch (Def.NumArgs) {
|
||||
case 0: Result = std::invoke(Def.Ptr0, Frame); break;
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user