void-packages/srcpkgs/renderdoc/patches/ptrace-only-x86.patch

63 lines
1.6 KiB
Diff

Note @q66: the ptrace code has x86-isms in it, which would need to
be patched out anyway.
From: Jordan Justen <jordan.l.justen@intel.com>
Date: Tue, 28 Jul 2020 17:12:12 -0700
Subject: linux_process: Only use ptrace for x86 family processors
Although ptrace should be usable for other processor families, for now
simply skipping the paths seems to work. I tested this by skipping the
ptrace paths on x86.
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
---
renderdoc/os/posix/linux/linux_process.cpp | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/renderdoc/os/posix/linux/linux_process.cpp b/renderdoc/os/posix/linux/linux_process.cpp
index 7db273f..491268d 100644
--- renderdoc/os/posix/linux/linux_process.cpp
+++ renderdoc/os/posix/linux/linux_process.cpp
@@ -50,6 +50,8 @@ extern char **environ;
#define INITIAL_WAIT_TIME 1
#define MAX_WAIT_TIME 0xfffff
+#define USE_PTRACE (ENABLED(RDOC_X86_FAMILY))
+
char **GetCurrentEnvironment()
{
return environ;
@@ -150,6 +152,8 @@ int GetIdentPort(pid_t childPid)
return ret;
}
+#if USE_PTRACE
+
static bool ptrace_scope_ok()
{
if(!Linux_PtraceChildProcesses())
@@ -577,6 +581,23 @@ void ResumeProcess(pid_t childPid, uint32_t delaySeconds)
}
}
+#else // #if USE_PTRACE
+
+bool StopChildAtMain(pid_t childPid)
+{
+ return false;
+}
+
+void StopAtMainInChild()
+{
+}
+
+void ResumeProcess(pid_t childPid, uint32_t delaySeconds)
+{
+}
+
+#endif
+
// because OSUtility::DebuggerPresent is called often we want it to be
// cheap. Opening and parsing a file would cause high overhead on each
// call, so instead we just cache it at startup. This fails in the case