Fixed dtrace support

This commit is contained in:
Dmitry Stogov 2014-07-22 11:12:49 +04:00
parent 6cc487df2c
commit ea17b018d8
2 changed files with 10 additions and 6 deletions

View file

@ -26,8 +26,13 @@
/* PHP DTrace probes {{{ */ /* PHP DTrace probes {{{ */
static inline const char *dtrace_get_executed_filename(TSRMLS_D) static inline const char *dtrace_get_executed_filename(TSRMLS_D)
{ {
if (EG(current_execute_data) && EG(current_execute_data)->op_array) { zend_execute_data *ex = EG(current_execute_data);
return EG(current_execute_data)->op_array->filename;
while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
ex = ex->prev_execute_data;
}
if (ex) {
return ex->func->op_array.filename->val;
} else { } else {
return zend_get_executed_filename(TSRMLS_C); return zend_get_executed_filename(TSRMLS_C);
} }

View file

@ -88,12 +88,11 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
{ {
#ifdef HAVE_DTRACE #ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_THROWN_ENABLED()) { if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
const char *classname; zend_string *classname;
zend_uint name_len;
if (exception != NULL) { if (exception != NULL) {
zend_get_object_classname(Z_OBJ_P(exception), &classname, &name_len TSRMLS_CC); classname = zend_get_object_classname(Z_OBJ_P(exception) TSRMLS_CC);
DTRACE_EXCEPTION_THROWN((char *)classname); DTRACE_EXCEPTION_THROWN(classname->val);
} else { } else {
DTRACE_EXCEPTION_THROWN(NULL); DTRACE_EXCEPTION_THROWN(NULL);
} }