95
95
96
96
static void nr_php_show_exec_return (NR_EXECUTE_PROTO TSRMLS_DC );
97
97
static int nr_php_show_exec_indentation (TSRMLS_D );
98
- static void nr_php_show_exec (NR_EXECUTE_PROTO TSRMLS_DC );
99
98
100
99
/*
101
100
* Purpose: Enable monitoring on specific functions in the framework.
@@ -594,11 +593,11 @@ static int nr_php_show_exec_indentation(TSRMLS_D) {
594
593
* Note that this function doesn't handle internal functions, and will crash if
595
594
* you give it one.
596
595
*/
597
- static void nr_php_show_exec (NR_EXECUTE_PROTO TSRMLS_DC ) {
596
+ void nr_php_show_exec (const char * context , NR_EXECUTE_PROTO TSRMLS_DC ) {
598
597
char argstr [NR_EXECUTE_DEBUG_STRBUFSZ ];
599
598
const char * filename = nr_php_op_array_file_name (NR_OP_ARRAY );
600
599
const char * function_name = nr_php_op_array_function_name (NR_OP_ARRAY );
601
-
600
+ const char * ctx = context ? context : "execute" ;
602
601
argstr [0 ] = '\0' ;
603
602
604
603
if (NR_OP_ARRAY -> scope ) {
@@ -608,12 +607,13 @@ static void nr_php_show_exec(NR_EXECUTE_PROTO TSRMLS_DC) {
608
607
nr_show_execute_params (NR_EXECUTE_ORIG_ARGS , argstr TSRMLS_CC );
609
608
nrl_verbosedebug (
610
609
NRL_AGENT ,
611
- "execute : %.*s scope={%.*s} function={" NRP_FMT_UQ
610
+ NRP_FMT_UQ " : %.*s scope={%.*s} function={" NRP_FMT_UQ
612
611
"}"
613
612
" params={" NRP_FMT_UQ
614
613
"}"
615
614
" %.5s"
616
615
"@ " NRP_FMT_UQ ":%d" ,
616
+ NRP_SHOW_EXEC_CONTEXT (ctx ),
617
617
nr_php_show_exec_indentation (TSRMLS_C ), nr_php_indentation_spaces ,
618
618
NRSAFELEN (nr_php_class_entry_name_length (NR_OP_ARRAY -> scope )),
619
619
nr_php_class_entry_name (NR_OP_ARRAY -> scope ),
@@ -631,12 +631,13 @@ static void nr_php_show_exec(NR_EXECUTE_PROTO TSRMLS_DC) {
631
631
nr_show_execute_params (NR_EXECUTE_ORIG_ARGS , argstr TSRMLS_CC );
632
632
nrl_verbosedebug (
633
633
NRL_AGENT ,
634
- "execute : %.*s function={" NRP_FMT_UQ
634
+ NRP_FMT_UQ " : %.*s function={" NRP_FMT_UQ
635
635
"}"
636
636
" params={" NRP_FMT_UQ
637
637
"}"
638
638
" %.5s"
639
639
"@ " NRP_FMT_UQ ":%d" ,
640
+ NRP_SHOW_EXEC_CONTEXT (ctx ),
640
641
nr_php_show_exec_indentation (TSRMLS_C ), nr_php_indentation_spaces ,
641
642
NRP_PHP (function_name ), NRP_ARGSTR (argstr ),
642
643
#if ZEND_MODULE_API_NO < ZEND_7_4_X_API_NO
@@ -649,16 +650,17 @@ static void nr_php_show_exec(NR_EXECUTE_PROTO TSRMLS_DC) {
649
650
/*
650
651
* file
651
652
*/
652
- nrl_verbosedebug (NRL_AGENT , "execute: %.*s file={" NRP_FMT "}" ,
653
+ nrl_verbosedebug (NRL_AGENT , NRP_FMT_UQ ": %.*s file={" NRP_FMT "}" ,
654
+ NRP_SHOW_EXEC_CONTEXT (ctx ),
653
655
nr_php_show_exec_indentation (TSRMLS_C ),
654
656
nr_php_indentation_spaces , NRP_FILENAME (filename ));
655
657
} else {
656
658
/*
657
659
* unknown
658
660
*/
659
- nrl_verbosedebug (NRL_AGENT , "execute : %.*s ?" ,
660
- nr_php_show_exec_indentation ( TSRMLS_C ),
661
- nr_php_indentation_spaces );
661
+ nrl_verbosedebug (NRL_AGENT , NRP_FMT_UQ " : %.*s ?" ,
662
+ NRP_SHOW_EXEC_CONTEXT ( ctx ),
663
+ nr_php_show_exec_indentation ( TSRMLS_C ), nr_php_indentation_spaces );
662
664
}
663
665
}
664
666
@@ -982,7 +984,7 @@ static void nr_php_user_instrumentation_from_file(const char* filename,
982
984
*/
983
985
#define METRIC_NAME_MAX_LEN 512
984
986
985
- static void nr_php_execute_file (const zend_op_array * op_array ,
987
+ void nr_php_execute_file (const zend_op_array * op_array ,
986
988
NR_EXECUTE_PROTO TSRMLS_DC ) {
987
989
const char * filename = nr_php_op_array_file_name (op_array );
988
990
size_t filename_len = nr_php_op_array_file_name_len (op_array );
@@ -1007,7 +1009,9 @@ static void nr_php_execute_file(const zend_op_array* op_array,
1007
1009
return ;
1008
1010
}
1009
1011
1012
+ #if ZEND_MODULE_API_NO < ZEND_8_0_X_API_NO
1010
1013
nr_php_add_user_instrumentation (TSRMLS_C );
1014
+ #endif
1011
1015
}
1012
1016
1013
1017
/*
@@ -1519,7 +1523,7 @@ static void nr_php_execute_enabled(NR_EXECUTE_PROTO TSRMLS_DC) {
1519
1523
1520
1524
static void nr_php_execute_show (NR_EXECUTE_PROTO TSRMLS_DC ) {
1521
1525
if (nrunlikely (NR_PHP_PROCESS_GLOBALS (special_flags ).show_executes )) {
1522
- nr_php_show_exec (NR_EXECUTE_ORIG_ARGS TSRMLS_CC );
1526
+ nr_php_show_exec ("execute" , NR_EXECUTE_ORIG_ARGS TSRMLS_CC );
1523
1527
}
1524
1528
1525
1529
nr_php_execute_enabled (NR_EXECUTE_ORIG_ARGS TSRMLS_CC );
@@ -1905,16 +1909,7 @@ static void nr_php_instrument_func_begin(NR_EXECUTE_PROTO) {
1905
1909
1906
1910
NRTXNGLOBAL (execute_count ) += 1 ;
1907
1911
txn_start_time = nr_txn_start_time (NRPRG (txn ));
1908
- /*
1909
- * Handle here, but be aware the classes might not be loaded yet.
1910
- */
1911
- if (nrunlikely (OP_ARRAY_IS_A_FILE (NR_OP_ARRAY ))) {
1912
- const char * filename = nr_php_op_array_file_name (NR_OP_ARRAY );
1913
- size_t filename_len = nr_php_op_array_file_name_len (NR_OP_ARRAY );
1914
- nr_execute_handle_framework (all_frameworks , num_all_frameworks ,
1915
- filename , filename_len TSRMLS_CC );
1916
- return ;
1917
- }
1912
+
1918
1913
if (NULL != NRPRG (cufa_callback ) && NRPRG (check_cufa )) {
1919
1914
/*
1920
1915
* For PHP 7+, call_user_func_array() is flattened into an inline by
@@ -2000,14 +1995,6 @@ static void nr_php_instrument_func_end(NR_EXECUTE_PROTO) {
2000
1995
}
2001
1996
txn_start_time = nr_txn_start_time (NRPRG (txn ));
2002
1997
2003
- /*
2004
- * Let's get the framework info.
2005
- */
2006
- if (nrunlikely (OP_ARRAY_IS_A_FILE (NR_OP_ARRAY ))) {
2007
- nr_php_execute_file (NR_OP_ARRAY , NR_EXECUTE_ORIG_ARGS TSRMLS_CC );
2008
- return ;
2009
- }
2010
-
2011
1998
/*
2012
1999
* Get the current segment and return if null.
2013
2000
*/
@@ -2157,7 +2144,7 @@ void nr_php_observer_fcall_begin(zend_execute_data* execute_data) {
2157
2144
int show_executes = NR_PHP_PROCESS_GLOBALS (special_flags ).show_executes ;
2158
2145
2159
2146
if (nrunlikely (show_executes )) {
2160
- nr_php_show_exec (NR_EXECUTE_ORIG_ARGS );
2147
+ nr_php_show_exec ("execute" , NR_EXECUTE_ORIG_ARGS );
2161
2148
}
2162
2149
nr_php_instrument_func_begin (NR_EXECUTE_ORIG_ARGS );
2163
2150
0 commit comments