Я использую systemtap для определения целевой переменной пространства пользователя , мой код приложения выглядит следующим образом
std::string Zhangcount(std::string cstr, int i, MarketData const & marketData){
double price = marketData.price;
char s='x';
cstr = "woaimaomao";
if(i==3000){
// usleep(30);
}
return cstr;
}
, а мой код systemtap:
probe process("process").function("Zhangcount").return {
printf("i=%d\n",@entry( $i))
printf("cstr=%s\n",@entry( $cstr))
}
printf("i=%d\n",@entry( $i))
может печатать правильное значение в приложение, но printf("cstr=%s\n",@entry( $cstr))
вызывает ошибку, как показано ниже: semantic error: 'class basic_string<char, std::char_traits<char>, std::allocator<char> >' (/usr/local/include/c++/9.1.0/bits/basic_string.h:77) is being accessed instead of a member such as '->_M_allocated_capacity': identifier '$cstr' at linestime.stp:26:30
source: printf("cstr=%s\n",@entry( $cstr))
Я искал несколько дней, но не знаю, как ее решить.