Fetch the function return value in PHP extension C++

I have created an php extension in c++ which tracks the call graph of each request(centos7-64 bit,PHP5.6).And now,I want to get the function return value of each function. It can be done by using zend_excute_data structure(original_return_value). am i right?

 zend_execute_data *data;
 data = EG(current_execute_data);
 if(data->original_return_value)
 {
        zval *rvalue = *(data->original_return_value);    // crashing here
    switch (Z_TYPE(argument_element))
        {
        ..
        .. 
        ..
    }
 }

Here, while assigning the original_return_value to rvalue,my php extension getting crash. Is this correct way to do? or anything else.

I think you are confusing zendframework with the zend engine: try asking on the php internals mailing list instead?