libstapsdt
libstapsdt copied to clipboard
Integration tests
Write integration tests that use the library and use readelf/objdump/etc. to ensure that the generated file is correct.
something like the following might be useful; I did this using the python stapsdt example:
$ sudo cat /proc/$(pgrep example.py)/maps|grep pythonapp
7f13289ff000-7f1328a00000 r-xp 00000000 00:01 258616 /memfd:libstapsdt:pythonapp (deleted)
7f1328a00000-7f1328bff000 ---p 00001000 00:01 258616 /memfd:libstapsdt:pythonapp (deleted)
7f1328bff000-7f1328c00000 rw-p 00000000 00:01 258616 /memfd:libstapsdt:pythonapp (deleted)
# Extract the library from the address space of the process:
$ dd if=/proc/$(pgrep example.py)/mem of=out.lib bs=1 count=$((0x7f1328a00000-0x7f13289ff000)) skip=$((0x7f13289ff000))
$ nm -D out.lib
0000000000200120 D __bss_start
0000000000200120 D _edata
0000000000200120 D _end
0000000000000260 T firstProbe
$ readelf -n out.lib
Displaying notes found in: .note.stapsdt
Owner Data size Description
stapsdt 0x0000003c NT_STAPSDT (SystemTap probe descriptors)
Provider: pythonapp
Name: firstProbe
Location: 0x0000000000000260, Base: 0x0000000000000318, Semaphore: 0x0000000000000000
Arguments: 8@%rdi -4@%rsi