[LTP] [RFC PATCH 3/3] ptrace: Remove simple_tracer.c
Petr Vorel
pvorel@suse.cz
Tue Nov 28 10:15:24 CET 2023
Legacy test from 2009, which does not even compile.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,
do you see any value in this test? Should it be rewritten? Or could it
be deleted and the goal of the test filled into issue so that we don't
forget on it? (IMHO test would need to be written from scratch).
Kind regards,
Petr
testcases/kernel/syscalls/ptrace/Makefile | 23 ---
.../syscalls/ptrace/make_syscall_list.sh | 7 -
.../kernel/syscalls/ptrace/simple_tracer.c | 143 ------------------
testcases/kernel/syscalls/ptrace/syscalls.h | 17 ---
4 files changed, 190 deletions(-)
delete mode 100755 testcases/kernel/syscalls/ptrace/make_syscall_list.sh
delete mode 100644 testcases/kernel/syscalls/ptrace/simple_tracer.c
delete mode 100644 testcases/kernel/syscalls/ptrace/syscalls.h
diff --git a/testcases/kernel/syscalls/ptrace/Makefile b/testcases/kernel/syscalls/ptrace/Makefile
index b410a54be..d7eca6837 100644
--- a/testcases/kernel/syscalls/ptrace/Makefile
+++ b/testcases/kernel/syscalls/ptrace/Makefile
@@ -6,27 +6,4 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-# - simple_tracer is a utility that Mike Frysinger added that shouldn't be
-# compiled by default:
-#
-# gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall
-# -I//scratch/ltp-install6/include -I../../../../include
-# -L//scratch/ltp-install6/lib simple_tracer.c -laio -lltp -o
-# simple_tracer
-# In file included from simple_tracer.c:25:
-# syscalls.h:6:23: error: _syscalls.h: No such file or directory
-# make[4]: *** [simple_tracer] Error 1
-# make[4]: Leaving directory
-# `/scratch/ltp-dev2/ltp/testcases/kernel/syscalls/ptrace'
-# make[3]: *** [all] Error 2
-# make[3]: Leaving directory `/scratch/ltp-dev2/ltp/testcases/kernel/syscalls'
-# make[2]: *** [all] Error 2
-# make[2]: Leaving directory `/scratch/ltp-dev2/ltp/testcases/kernel'
-# make[1]: *** [all] Error 2
-# make[1]: Leaving directory `/scratch/ltp-dev2/ltp/testcases'
-# make: *** [testcases-all] Error 2
-#
-
-FILTER_OUT_MAKE_TARGETS := simple_tracer
-
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ptrace/make_syscall_list.sh b/testcases/kernel/syscalls/ptrace/make_syscall_list.sh
deleted file mode 100755
index e5d6d2765..000000000
--- a/testcases/kernel/syscalls/ptrace/make_syscall_list.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-set -- $( \
- printf '#include <sys/syscall.h>' | \
- ${CC:-gcc} -E -dD - | \
- awk '$2 ~ /^SYS_/ { sub(/SYS_/,"",$2); print $2; }'
-)
-printf 'P(%s)\n' "$@"
diff --git a/testcases/kernel/syscalls/ptrace/simple_tracer.c b/testcases/kernel/syscalls/ptrace/simple_tracer.c
deleted file mode 100644
index 43026e317..000000000
--- a/testcases/kernel/syscalls/ptrace/simple_tracer.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * simple example ptrace() code to help build basis for other tests
- *
- * Copyright (c) 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later
- */
-
-#define _GNU_SOURCE
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/ptrace.h>
-#include <sys/syscall.h>
-
-#include "test.h"
-#include "spawn_ptrace_child.h"
-
-#include "syscalls.h"
-
-char *TCID = "simple_tracer";
-int TST_TOTAL = 0;
-
-#define _decode(name, val) \
-({ \
- if (sizeof(long) == 4) \
- printf(name ":%08lx ", val); \
- else if (sizeof(long) == 8) \
- printf(name ":%016lx ", val); \
- else \
- printf(name ":%lx ", val); \
- val; \
-})
-#define decode(reg) _decode(#reg, pt->reg)
-#define decode_user(name, offset) \
- _decode(name, vptrace(PTRACE_PEEKUSER, pid, offset, NULL));
-#define decode_sysnum(nr) printf("%s ", get_sysnum(nr))
-static void decode_regs(struct pt_regs *pt)
-{
-#if defined(__bfin__)
- long nr = decode_user("orig_p0", PT_ORIG_P0);
- decode(p0);
- decode(r0);
- decode(r1);
- decode(r2);
- decode(r3);
- decode(r4);
- decode(r5);
- decode_sysnum(nr);
- puts("");
-#elif defined(__i386__)
- long nr = decode_user("orig_eax", 4 * ORIG_EAX);
- decode(eax);
- decode(ebx);
- decode(ecx);
- decode(edx);
- decode(esi);
- decode(edi);
- decode(ebp);
- decode_sysnum(nr);
- puts("");
-#elif defined(__x86_64__)
- long nr = decode_user("orig_rax", 8 * ORIG_RAX);
- decode(rax);
- decode(rbx);
- decode(rcx);
- decode(rdx);
- decode(rsi);
- decode(rdi);
- decode(rbp);
- decode_sysnum(nr);
- puts("");
-#elif defined(__sparc__)
-#define G1 u_regs[0]
-#define G2 u_regs[1]
-#define G3 u_regs[2]
-#define G4 u_regs[3]
-#define G5 u_regs[4]
-#define G6 u_regs[5]
-#define G7 u_regs[6]
-#define O0 u_regs[7]
-#define O1 u_regs[8]
-#define O2 u_regs[9]
-#define O3 u_regs[10]
-#define O4 u_regs[11]
-#define O5 u_regs[12]
-#define O6 u_regs[13]
-#define O7 u_regs[14]
- decode(G1);
- decode(G2);
- decode(G3);
- decode(G4);
- decode(G5);
- decode(G6);
- decode(G7);
- decode(O0);
- decode(O1);
- decode(O2);
- decode(O3);
- decode(O4);
- decode(O5);
- decode(O6);
- decode(O7);
- decode_sysnum(pt->G1);
- puts("");
-#else
-#warning "no idea how to decode your arch"
- puts("no idea how to decode your arch");
-#endif
-}
-
-int main(int argc, char *argv[])
-{
- struct pt_regs pt_regs;
- long ret;
- int status;
-
- make_a_baby(argc, argv);
-
- while (1) {
- ret = vptrace(PTRACE_GETREGS, pid, NULL, &pt_regs);
- if (ret)
- break;
- decode_regs(&pt_regs);
-
- ret = vptrace(PTRACE_SYSCALL, pid, NULL, NULL);
- if (ret)
- break;
-
- if (waitpid(pid, &status, 0) == -1)
- break;
- }
-
- /* hopefully this worked */
- vptrace(PTRACE_KILL, pid, NULL, NULL);
-
- tst_exit();
-}
diff --git a/testcases/kernel/syscalls/ptrace/syscalls.h b/testcases/kernel/syscalls/ptrace/syscalls.h
deleted file mode 100644
index 2d9c5ceb6..000000000
--- a/testcases/kernel/syscalls/ptrace/syscalls.h
+++ /dev/null
@@ -1,17 +0,0 @@
-const struct sysnums {
- long nr;
- const char *snr;
-} sysnums[] = {
-#define P(NR) { .nr = SYS_##NR, .snr = #NR, },
-#include "_syscalls.h"
-#undef P
-};
-
-const char *get_sysnum(long nr)
-{
- int i;
- for (i = 0; i < ARRAY_SIZE(sysnums); ++i)
- if (sysnums[i].nr == nr)
- break;
- return i == ARRAY_SIZE(sysnums) ? "???" : sysnums[i].snr;
-}
--
2.42.0
More information about the ltp
mailing list