tools/perf/tests/shell/addr2line_inlines.sh
Source file repositories/reference/linux-study-clean/tools/perf/tests/shell/addr2line_inlines.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/shell/addr2line_inlines.sh- Extension
.sh- Size
- 3158 bytes
- Lines
- 97
- 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.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function test_fp
Annotated Snippet
#!/bin/bash
# test addr2line inline unwinding
# SPDX-License-Identifier: GPL-2.0
set -e
err=0
test_dir=$(mktemp -d /tmp/perf-test-inline-addr2line.XXXXXXXXXX)
perf_data="${test_dir}/perf.data"
perf_script_txt="${test_dir}/perf_script.txt"
cleanup() {
rm -rf "${test_dir}"
trap - EXIT TERM INT
}
trap_cleanup() {
echo "Unexpected signal in ${FUNCNAME[1]}"
cleanup
exit 1
}
trap trap_cleanup EXIT TERM INT
test_fp() {
echo "Inline unwinding fp verification test"
# Record data. Currently only dwarf callchains support inlined functions.
perf record --call-graph fp -e task-clock:u -o "${perf_data}" -- perf test -w inlineloop 1
# Check output with inline (default) and srcline
perf script -i "${perf_data}" --fields +srcline > "${perf_script_txt}"
# Expect the leaf and middle functions to occur on lines in the 20s, with
# the non-inlined parent function on a line in the 30s.
if grep -q "inlineloop.c:2. (inlined)" "${perf_script_txt}" &&
grep -q "inlineloop.c:3.$" "${perf_script_txt}"
then
echo "Inline unwinding fp verification test [Success]"
else
echo "Inline unwinding fp verification test [Failed missing inlined functions]"
err=1
fi
}
test_dwarf() {
echo "Inline unwinding dwarf verification test"
# Record data. Currently only dwarf callchains support inlined functions.
perf record --call-graph dwarf -e task-clock:u -o "${perf_data}" -- perf test -w inlineloop 1
# Check output with inline (default) and srcline
perf script -i "${perf_data}" --fields +srcline > "${perf_script_txt}"
# Expect the leaf and middle functions to occur on lines in the 20s, with
# the non-inlined parent function on a line in the 30s.
if grep -q "inlineloop.c:2. (inlined)" "${perf_script_txt}" &&
grep -q "inlineloop.c:3.$" "${perf_script_txt}"
then
echo "Inline unwinding dwarf verification test [Success]"
else
echo "Inline unwinding dwarf verification test [Failed missing inlined functions]"
err=1
fi
}
test_lbr() {
echo "Inline unwinding LBR verification test"
if [ ! -f /sys/bus/event_source/devices/cpu/caps/branches ] &&
[ ! -f /sys/bus/event_source/devices/cpu_core/caps/branches ]
then
echo "Skip: only x86 CPUs support LBR"
return
Annotation
- Detected declarations: `function test_fp`.
- 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.