[libc-commits] [libc] [libc] Support for argument-taking ptrace requests (PR #201830)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Fri Jun 5 06:23:05 PDT 2026
================
@@ -42,12 +45,33 @@ void trace_me_test() {
ASSERT_TRUE(WIFSTOPPED(status));
ASSERT_EQ(WSTOPSIG(status), SIGSTOP);
- // Kill the child
- ASSERT_EQ(LIBC_NAMESPACE::kill(pid, SIGKILL), 0);
+ // Try reading from an invalid address, and check for failure.
+ ASSERT_EQ(-1,
+ LIBC_NAMESPACE::ptrace(PTRACE_PEEKDATA, pid,
+ reinterpret_cast<void *>(0x470), nullptr));
+ ASSERT_ERRNO_EQ(EIO);
+
+ errno = 0;
+ // We're reading the value of test_variable from the child process. As the
+ // child is a fork our ourselves, the variable will have the same address in
----------------
kaladron wrote:
```suggestion
// child is a fork of ourselves, the variable will have the same address in
```
https://github.com/llvm/llvm-project/pull/201830
More information about the libc-commits
mailing list