Using systemtap with file name and line number is generating an error, where as using the (mangled) function name is fine. What am I doing wrong here?
// fails with
// semantic error: no match
// Pass 2: analysis failed. [man error::pass2]
probe process("a.out").statement("*@hello.cpp:5") {
printf("in test\n")
}
// succeeds
probe process("a.out").function("_Z4testv").return {
printf("in test\n")
}
//content of source of a.out
#include <iostream>
void test() {
int a = 1;
std::cout << "Hello World!";
}
int main()
{
test();
}
//stap command
sudo stap a.stp -c "./a.out"
linux version 3.10.0-229.el7.x86_64
stap version 2.8/0.160
directory content: a.out hello.cpp a.stp
This would be the expected behaviour if your program lacks debuginfo but has a symbol table - i.e., if it was compiled without CFLAGS=-g
.