void-packages/srcpkgs/renderdoc/patches/ptrace-only-x86.patch
Đoàn Trần Công Danh 103ab731ab srcpkgs/r*: convert patches to -Np1
* runit is kept at -Np0

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

62 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
--- a/renderdoc/os/posix/linux/linux_process.cpp
+++ b/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