tools/perf/tests/shell/test_uprobe_from_different_cu.sh
Source file repositories/reference/linux-study-clean/tools/perf/tests/shell/test_uprobe_from_different_cu.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/shell/test_uprobe_from_different_cu.sh- Extension
.sh- Size
- 1662 bytes
- Lines
- 90
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
testfile-foo.h
Detected Declarations
struct tfunction foofunction main
Annotated Snippet
#!/bin/bash
# test perf probe of function from different CU
# SPDX-License-Identifier: GPL-2.0
set -e
# shellcheck source=lib/probe.sh
. "$(dirname $0)"/lib/probe.sh
skip_if_no_perf_probe || exit 2
[ "$(id -u)" == 0 ] || exit 2
# skip if there's no gcc
if ! [ -x "$(command -v gcc)" ]; then
echo "failed: no gcc compiler"
exit 2
fi
temp_dir=$(mktemp -d /tmp/perf-uprobe-different-cu-sh.XXXXXXXXXX)
cleanup()
{
trap - EXIT TERM INT
if [[ "${temp_dir}" =~ ^/tmp/perf-uprobe-different-cu-sh.*$ ]]; then
echo "--- Cleaning up ---"
perf probe -x ${temp_dir}/testfile -d foo || true
rm -f "${temp_dir}/"*
rmdir "${temp_dir}"
fi
}
trap_cleanup()
{
cleanup
exit 1
}
trap trap_cleanup EXIT TERM INT
cat > ${temp_dir}/testfile-foo.h << EOF
struct t
{
int *p;
int c;
};
extern int foo (int i, struct t *t);
EOF
cat > ${temp_dir}/testfile-foo.c << EOF
#include "testfile-foo.h"
int
foo (int i, struct t *t)
{
int j, res = 0;
for (j = 0; j < i && j < t->c; j++)
res += t->p[j];
return res;
}
EOF
cat > ${temp_dir}/testfile-main.c << EOF
#include "testfile-foo.h"
static struct t g;
int
main (int argc, char **argv)
Annotation
- Immediate include surface: `testfile-foo.h`.
- Detected declarations: `struct t`, `function foo`, `function main`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.