]> granicus.if.org Git - php/commitdiff
- Fix conflict
authorFelipe Pena <felipensp@gmail.com>
Sun, 17 Nov 2013 18:45:08 +0000 (16:45 -0200)
committerFelipe Pena <felipensp@gmail.com>
Sun, 17 Nov 2013 18:45:08 +0000 (16:45 -0200)
1  2 
phpdbg_info.c
phpdbg_info.h

diff --cc phpdbg_info.c
index fbe4f2b603fb1d733ce5fd1c6e16d16e6c1bada8,315fb47a7db91327b5a5eac4b515731f145afbcd..057859a1ad985b02fc69d73ec99ce4f6fe9a5dff
@@@ -39,43 -39,68 +39,107 @@@ PHPDBG_INFO(files) /* {{{ *
        return SUCCESS;
  } /* }}} */
  
 -              ((*ce)->type == ZEND_USER_CLASS) ? 
 +PHPDBG_INFO(error) /* {{{ */
 +{
 +      return SUCCESS;
 +} /* }}} */
 +
 +PHPDBG_INFO(vars) /* {{{ */
 +{
 +      HashPosition pos;
 +      char *var;
 +      zval **data;
 +
 +      if (!EG(active_symbol_table)) {
 +              zend_rebuild_symbol_table(TSRMLS_C);
 +
 +              if (!EG(active_symbol_table)) {
 +                      phpdbg_error("No active symbol table!");
 +                      return SUCCESS;
 +              }
 +      }
 +
 +      phpdbg_notice("Variables: %d",
 +              zend_hash_num_elements(EG(active_symbol_table)));
 +
 +      zend_hash_internal_pointer_reset_ex(EG(active_symbol_table), &pos);
 +      while (zend_hash_get_current_key_ex(EG(active_symbol_table), &var,
 +              NULL, NULL, 0, &pos) == HASH_KEY_IS_STRING) {
 +              zend_hash_get_current_data_ex(EG(active_symbol_table), (void **)&data, &pos);
 +
 +              if (*var != '_') {
 +                      phpdbg_write("Var: %s = ", var, *data == NULL ? "NULL" : "");
 +                      if (data) {
 +                              zend_print_flat_zval_r(*data TSRMLS_CC);
 +                              phpdbg_writeln(EMPTY);
 +                      }
 +              }
 +              zend_hash_move_forward_ex(EG(active_symbol_table), &pos);
 +      }
 +
 +      return SUCCESS;
 +} /* }}} */
++
+ static inline void phpdbg_print_class_name(zend_class_entry **ce TSRMLS_DC) { /* {{{ */
+       phpdbg_write(
+               "%s %s %s (%d)",
 -        ((*ce)->ce_flags & ZEND_ACC_INTERFACE) ? 
++              ((*ce)->type == ZEND_USER_CLASS) ?
+                       "User" : "Internal",
 -                                      "Class", 
++        ((*ce)->ce_flags & ZEND_ACC_INTERFACE) ?
+                       "Interface" :
+                               ((*ce)->ce_flags & ZEND_ACC_ABSTRACT) ?
+                               "Abstract Class" :
 -      
++                                      "Class",
+               (*ce)->name, zend_hash_num_elements(&(*ce)->function_table));
+ } /* }}} */
+ PHPDBG_INFO(classes) /* {{{ */
+ {
+     HashPosition position;
+       zend_class_entry **ce;
+       HashTable classes;
 -      for (zend_hash_internal_pointer_reset_ex(EG(class_table), &position);   
++
+       zend_hash_init(&classes, 8, NULL, NULL, 0);
 -      
++      for (zend_hash_internal_pointer_reset_ex(EG(class_table), &position);
+               zend_hash_get_current_data_ex(EG(class_table), (void**)&ce, &position) == SUCCESS;
+               zend_hash_move_forward_ex(EG(class_table), &position)) {
+         if ((*ce)->type == ZEND_USER_CLASS) {
+               zend_hash_next_index_insert(
+                       &classes, ce, sizeof(ce), NULL);
+         }
+       }
 -      for (zend_hash_internal_pointer_reset_ex(&classes, &position);  
++
+       phpdbg_notice("User Classes (%d)",
+               zend_hash_num_elements(&classes));
 -              
++      for (zend_hash_internal_pointer_reset_ex(&classes, &position);
+               zend_hash_get_current_data_ex(&classes, (void**)&ce, &position) == SUCCESS;
+               zend_hash_move_forward_ex(&classes, &position)) {
+               phpdbg_print_class_name(ce TSRMLS_CC);
+               phpdbg_writeln(EMPTY);
 -              
++
+               if ((*ce)->parent) {
+                       zend_class_entry *pce = (*ce)->parent;
+                       do {
+                               phpdbg_write("|-------- ");
+                               phpdbg_print_class_name(&pce TSRMLS_CC);
+                               phpdbg_writeln(EMPTY);
+                       } while(pce = pce->parent);
+               }
 -                      "|---- in %s on line %lu", 
++
+         if ((*ce)->info.user.filename) {
+               phpdbg_writeln(
 -      
++                      "|---- in %s on line %lu",
+                       (*ce)->info.user.filename,
+                       (*ce)->info.user.line_start);
+       } else phpdbg_writeln("|---- no source code");
+       phpdbg_writeln(EMPTY);
+       }
+       zend_hash_destroy(&classes);
 -
 -
++
+       return SUCCESS;
+ } /* }}} */
diff --cc phpdbg_info.h
index 1309a1c8763d850963aeea817ba8005192d8dcc1,0223ed9f3a6331173feb2be75c9e2408dd65b5f1..583627674b37aede25bef1c0937db79ea071aa6e
        int PHPDBG_INFO_HANDLER(name)(phpdbg_param_t *param TSRMLS_DC)
  
  PHPDBG_INFO(files);
+ PHPDBG_INFO(classes);
 +PHPDBG_INFO(error);
 +PHPDBG_INFO(vars);
  
  static const phpdbg_command_t phpdbg_info_commands[] = {
-     PHPDBG_INFO_EX_D(files,     "lists included files",  'f'),
 -    PHPDBG_INFO_EX_D(files,     "lists included files", 'F'),
 -    PHPDBG_INFO_EX_D(classes,   "lists loaded classes", 'c'),
++    PHPDBG_INFO_EX_D(files,     "lists included files",  'F'),
++    PHPDBG_INFO_EX_D(classes,   "lists loaded classes",  'c'),
 +    PHPDBG_INFO_EX_D(error,     "show the last error",   'e'),
 +    PHPDBG_INFO_EX_D(vars,      "show active variables", 'v'),
      PHPDBG_END_COMAND
  };