I have written a systemtap script to profile a C++ program. In the systemtap script I want to extract a class member.
Here is the c++ class definition:
class CFldOrder
{
public:
ByteArray cust_no;
};
class ByteArray
{
public:
const char* get_value(){return buf;}
private:
char* buf[255];
};
Here is the code snippet of the systemtap script:
probe process("/trade/ans_bu").statement("*@entrust.cpp:6614")
{
g_custno = @cast(FldOrder, "CFldOrder")->cust_no->buf
}
When the script is running, it failed at this probe and said "user string copy fault at addr 0x0000075". I guess it means "@cast(FldOrder, "CFldOrder")->cust_no->buf" is not a valid address.
If I debug this program with gdb and break at the position "entrust.cpp:6614", FldOrder.cust_no.buf is displayed correctly.
How can I fix the script?