Script:
stap -e '
global lines;
probe syscall.write {
if(execname() == "alloc-bench" && fd == 2) {
line = lines[pid()] . user_string_n(buf_uaddr, count);
if(isinstr(line, "\n")) {
printdln(" ", pid(), lines[pid()]);
delete lines[pid()];
}
else lines[pid()] = line; } } '
Original output:
111 33 1 3359 2201d301ffffffff -> d3012201ffffffff -> 2201d301ffffffff d3012201ffffffff
61 1fffffffffffffff -> 1fffffffffffffff
11 33 d3012201ffffffff -> d3012201ffffffff
33 2201d301ffffffff17ffffffffffffff -> 12201d301ffffffff ->
Output of SystemTap:
25956 1 33 d3012201ffffffff -> d3012201ffffffff
25949 1 33 2201d301ffffffff -> 2201d301ffffffff
25945 1 59 7ffffffffffffff -> 7ffffffffffffff
25939 1 33 d3012201ffffffff -> d3012201ffffffff
25942 1 61 1fffffffffffffff -> 1fffffffffffffff
25966 1 33 2201d301ffffffff -> 2201d301ffffffff