In MINIT:
    old_compile_file = zend_compile_file;
    zend_compile_file = xdebug_compile_file;
    xdebug_old_execute = zend_execute;
    zend_execute = xdebug_execute;
    xdebug_old_execute_internal = zend_execute_internal;
    zend_execute_internal = xdebug_execute_internal;
In MSHUTDOWN:
    zend_compile_file = old_compile_file;
    zend_execute = xdebug_old_execute;
    zend_execute_internal = xdebug_old_execute_internal;
xdebug_compile_file:
/* {{{ zend_op_array srm_compile_file (file_handle, type)
 *    This function provides a hook for the execution of bananas */
zend_op_array *xdebug_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
{
    zend_op_array *op_array;
    op_array = old_compile_file(file_handle, type TSRMLS_CC);
...
    return op_array;
}
/* }}} */
xdebug_execute:
void xdebug_execute(zend_op_array *op_array TSRMLS_DC)
{
...
    if (op_array && op_array->filename && strcmp("xdebug://debug-eval", op_array->filename)
        xdebug_old_execute(op_array TSRMLS_CC);
        return;
    }
...
xdebug_execute_internal:
void xdebug_execute_internal(zend_execute_data *current_execute_data, int return_value_used TSRMLS_DC)
{
    zend_execute_data    *edata = EG(current_execute_data);
...
    XG(level)++;
    if (XG(level) == XG(max_nesting_level)) {
        php_error(E_ERROR, "Maximum function nesting level of '%ld' reached, aborting!", XG(max_nesting_level));
    }