]> granicus.if.org Git - php/commitdiff
better info literal
authorkrakjoe <joe.watkins@live.co.uk>
Fri, 22 Nov 2013 09:56:17 +0000 (09:56 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Fri, 22 Nov 2013 09:56:17 +0000 (09:56 +0000)
phpdbg_info.c

index a3a3f01989e8753c9c1ce1696036911f61ef5fcf..4b98267ab0f24653d6805824b9a53bb4c0a88916 100644 (file)
 */
 
 #include "php.h"
+#include "phpdbg.h"
 #include "phpdbg_utils.h"
 #include "phpdbg_info.h"
 
+ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
+
 PHPDBG_INFO(files) /* {{{ */
 {
     HashPosition pos;
@@ -146,15 +149,32 @@ PHPDBG_INFO(vars) /* {{{ */
 
 PHPDBG_INFO(literal) /* {{{ */
 {
-       if (EG(in_execution) && EG(active_op_array)) {
-               zend_uint literal =0;
-               phpdbg_notice(
-                       "Literal Constants %d", EG(active_op_array)->last_literal-1);
+       if ((EG(in_execution) && EG(active_op_array)) || PHPDBG_G(ops)) {
+               zend_op_array *ops = EG(active_op_array) ? EG(active_op_array) : PHPDBG_G(ops);
+               zend_uint literal =0, count = ops->last_literal-1;
+               
+               if (ops->function_name) {
+                       if (ops->scope) {
+                               phpdbg_notice(
+                               "Literal Constants in %s::%s() (%d)", ops->scope->name, ops->function_name, count);
+                       } else {
+                               phpdbg_notice(
+                                       "Literal Constants in %s() (%d)", ops->function_name, count);
+                       }
+               } else {
+                       if (ops->filename) {
+                               phpdbg_notice(
+                               "Literal Constants in %s (%d)", ops->filename, count);
+                       } else {
+                               phpdbg_notice(
+                                       "Literal Constants @ %p (%d)", ops, count);
+                       }
+               }
                
-               while (literal < EG(active_op_array)->last_literal) {
+               while (literal < ops->last_literal) {
                        phpdbg_write("|-------- C%lu -------> [", literal);
                        zend_print_zval(
-                               &EG(active_op_array)->literals[literal].constant, 0);
+                               &ops->literals[literal].constant, 0);
                        phpdbg_write("]");
                        phpdbg_writeln(EMPTY);
                        literal++;