Skip to content

Commit 769965f

Browse files
theihoranakryiko
authored andcommitted
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 <[email protected]>
1 parent c2617bf commit 769965f

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

tests/fetch-usdts.awk

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,26 @@ function reset_entry()
1313

1414
function print_entry()
1515
{
16-
if (base != 0 && !(base in basemap)) {
17-
basemap[base] = ++base_cnt;
16+
base_key = filename ":" base;
17+
if (base != 0 && !(base_key in basemap)) {
18+
basemap[base_key] = ++base_cnt;
1819
}
19-
if (sema != 0 && !(sema in semamap)) {
20-
semamap[sema] = ++sema_cnt;
20+
21+
sema_key = filename ":" sema;
22+
if (sema != 0 && !(sema_key in semamap)) {
23+
semamap[sema_key] = ++sema_cnt;
2124
}
22-
base_stub = (base == 0) ? "0" : sprintf("BASE%d", basemap[base]);
23-
sema_stub = (sema == 0) ? "0" : sprintf("SEMA%d", semamap[sema]);
25+
26+
base_stub = (base == 0) ? "0" : sprintf("BASE%d", basemap[base_key]);
27+
sema_stub = (sema == 0) ? "0" : sprintf("SEMA%d", semamap[sema_key]);
28+
2429
printf "%s:%s base=%s sema=%s argn=%d args=%s.\n",
2530
grp, name, base_stub, sema_stub, argn, args;
2631
}
2732

2833
BEGIN {
2934
reset_entry();
35+
filename = "";
3036
}
3137

3238
# stapsdt 0x0000003b NT_STAPSDT (SystemTap probe descriptors)
@@ -35,6 +41,14 @@ BEGIN {
3541
# Location: 0x0000000000401198, Base: 0x0000000000402043, Semaphore: 0x0000000000000000
3642
# Arguments: -4@$1 -4@$2 -4@$3 -4@$4
3743

44+
/File:/ {
45+
if (entry != "") {
46+
print_entry();
47+
reset_entry();
48+
}
49+
filename = $2;
50+
}
51+
3852
/\sstapsdt\s/ {
3953
if (entry != "") {
4054
print_entry();

0 commit comments

Comments
 (0)