I was able to find a working solution by myself. The probe in my question has a stupid mistake - arg0 should be copied instead of arg1. So the working probe is:
pid$target::func(*):entry
{
this->str = *((uintptr_t*)copyin(arg0, sizeof(void*)));
printf("darg %s", copyinstr(this->str));
}
On the other hand for member function arg1 should be used:
class some {
public:
void func(const std::string arg) {
std::cout << "arg " << arg << std::endl;
}
};
Probe for function some::func
should look like this:
pid$target::some??func(*):entry
{
this->str = *((uintptr_t*)copyin(arg1, sizeof(void*)));
printf("darg %s", copyinstr(this->str));
}
This works for both libc++ and libstdc++ std::string
classes. It even works if reference to string is used.