Skip to content

Commit c0d5818

Browse files
committed
tests/fetch-usdts.awk: use filename + offset to match base and sema
The base and semaphore offsets between different binaries may coincide, which leads to incorrect matching of USDTs by test scripts. Use filename + offset string to identify them for the purpose of USDT spec comparison. readelf -n prints the file path before dumping notes if more than one file is passed in, and this is now captured by fetch-usdts.awk. Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
1 parent d6247ff commit c0d5818

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

tests/fetch-usdts.awk

+24-6
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,30 @@ function reset_entry()
1313

1414
function print_entry()
1515
{
16-
if (base != 0 && !(base in basemap)) {
17-
basemap[base] = ++base_cnt;
16+
if (base != 0) {
17+
base_key = filename ":" base;
18+
if (!(base_key in basemap)) {
19+
basemap[base_key] = ++base_cnt;
20+
}
1821
}
19-
if (sema != 0 && !(sema in semamap)) {
20-
semamap[sema] = ++sema_cnt;
22+
23+
if (sema != 0) {
24+
sema_key = filename ":" sema;
25+
if (!(sema_key in semamap)) {
26+
semamap[sema_key] = ++sema_cnt;
27+
}
2128
}
22-
base_stub = (base == 0) ? "0" : sprintf("BASE%d", basemap[base]);
23-
sema_stub = (sema == 0) ? "0" : sprintf("SEMA%d", semamap[sema]);
29+
30+
base_stub = (base == 0) ? "0" : sprintf("BASE%d", basemap[base_key]);
31+
sema_stub = (sema == 0) ? "0" : sprintf("SEMA%d", semamap[sema_key]);
32+
2433
printf "%s:%s base=%s sema=%s argn=%d args=%s.\n",
2534
grp, name, base_stub, sema_stub, argn, args;
2635
}
2736

2837
BEGIN {
2938
reset_entry();
39+
filename = "";
3040
}
3141

3242
# stapsdt 0x0000003b NT_STAPSDT (SystemTap probe descriptors)
@@ -35,6 +45,14 @@ BEGIN {
3545
# Location: 0x0000000000401198, Base: 0x0000000000402043, Semaphore: 0x0000000000000000
3646
# Arguments: -4@$1 -4@$2 -4@$3 -4@$4
3747

48+
/File:/ {
49+
if (entry != "") {
50+
print_entry();
51+
reset_entry();
52+
}
53+
filename = $2;
54+
}
55+
3856
/\sstapsdt\s/ {
3957
if (entry != "") {
4058
print_entry();

0 commit comments

Comments
 (0)