diff options
| author | Andi Gutmans <andi@php.net> | 2002-05-07 18:42:13 +0000 |
|---|---|---|
| committer | Andi Gutmans <andi@php.net> | 2002-05-07 18:42:13 +0000 |
| commit | b66c89c47a7efe504df865d6c2272ee59158bbf2 (patch) | |
| tree | 4a08676416e1ea1395bdfef62073a069175a3af6 /Zend/zend_builtin_functions.c | |
| parent | 7c80fc1d9edcda28ee87f2db3b9544af0a510f32 (diff) | |
| download | php-git-b66c89c47a7efe504df865d6c2272ee59158bbf2.tar.gz | |
- More debug backtrace work. It still doesn't work very well...
Diffstat (limited to 'Zend/zend_builtin_functions.c')
| -rw-r--r-- | Zend/zend_builtin_functions.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 0f30efb30e..fc5bd14584 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1188,23 +1188,33 @@ ZEND_FUNCTION(debug_backtrace) { zend_execute_data *ptr; int lineno; - + char *function_name; + char *filename; ptr = EG(current_execute_data); lineno = ptr->opline->lineno; - - ptr = ptr->prev_execute_data; - + while (ptr) { if (ptr->object) { printf("%s::", Z_OBJCE(*ptr->object)->name); } - printf("%s() [%s:%d]\n", ptr->function_state.function->common.function_name, ptr->function_state.function->op_array.filename, lineno); - lineno = ptr->opline->lineno; + function_name = ptr->function_state.function->common.function_name; + if (!function_name) { + function_name = "main"; + } + ptr = ptr->prev_execute_data; + if (!ptr) { + break; + } + + filename = ptr->function_state.function->op_array.filename; + + printf("%s() [%s:%d]\n", function_name, filename, lineno); + if (ptr->opline) { + lineno = ptr->opline->lineno; + } } - - printf("main() [...:%d]\n", lineno); RETURN_TRUE; } |
