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

61 lines
1.5 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(+)
--- a/renderdoc/os/posix/linux/linux_process.cpp
+++ b/renderdoc/os/posix/linux/linux_process.cpp
@@ -55,6 +55,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;
@@ -155,6 +157,8 @@ int GetIdentPort(pid_t childPid)
return ret;
}
+#if USE_PTRACE
+
static bool ptrace_scope_ok()
{
if(!Linux_PtraceChildProcesses())
@@ -617,6 +621,23 @@ void ResumeProcess(pid_t childPid, uint3
}
}
+#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