From 0245273cb946b341fc0d62cd27817e72d654a6bc Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 1 Jan 2021 17:20:59 +0100 Subject: Add stacktraces to dumps --- src/sp_utils.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/sp_utils.c') diff --git a/src/sp_utils.c b/src/sp_utils.c index 1253eff..8550168 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c @@ -165,6 +165,22 @@ int sp_log_request(const zend_string* restrict folder, fprintf(file, "RULE: sp%s%s\n", from, ZSTR_VAL(text_repr)); fprintf(file, "FILE: %s:%d\n", current_filename, current_line); + + + zend_execute_data *orig_execute_data = EG(current_execute_data); + zend_execute_data *current = EG(current_execute_data); + while (current) { + EG(current_execute_data) = current; + char* const complete_path_function = get_complete_function_path(current); + if (complete_path_function) { + const int current_line = zend_get_executed_lineno(TSRMLS_C); + fprintf(file, "STACKTRACE: %s:%d\n", complete_path_function, current_line); + } + current = current->prev_execute_data; + } + EG(current_execute_data) = orig_execute_data; + + for (size_t i = 0; zones[i].str; i++) { zval* variable_value; zend_string* variable_key; -- cgit v1.3