@@ -73,12 +73,12 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
7373 PHPDBG_COMMAND_D (until , "continue past the current line" , 'u' , NULL , 0 , 0 ),
7474 PHPDBG_COMMAND_D (finish , "continue past the end of the stack" , 'F' , NULL , 0 , 0 ),
7575 PHPDBG_COMMAND_D (leave , "continue until the end of the stack" , 'L' , NULL , 0 , 0 ),
76- PHPDBG_COMMAND_D (print , "print something" , 'p' , phpdbg_print_commands , 0 , 0 ),
76+ PHPDBG_COMMAND_D (print , "print something" , 'p' , phpdbg_print_commands , "|*c" , 0 ),
7777 PHPDBG_COMMAND_D (break , "set breakpoint" , 'b' , phpdbg_break_commands , "|*c" , 0 ),
7878 PHPDBG_COMMAND_D (back , "show trace" , 't' , NULL , "|n" , PHPDBG_ASYNC_SAFE ),
7979 PHPDBG_COMMAND_D (frame , "switch to a frame" , 'f' , NULL , "|n" , PHPDBG_ASYNC_SAFE ),
80- PHPDBG_COMMAND_D (list , "lists some code" , 'l' , phpdbg_list_commands , "*" , PHPDBG_ASYNC_SAFE ),
81- PHPDBG_COMMAND_D (info , "displays some informations" , 'i' , phpdbg_info_commands , "s" , PHPDBG_ASYNC_SAFE ),
80+ PHPDBG_COMMAND_D (list , "lists some code" , 'l' , phpdbg_list_commands , "*" , PHPDBG_ASYNC_SAFE ),
81+ PHPDBG_COMMAND_D (info , "displays some informations" , 'i' , phpdbg_info_commands , "| s" , PHPDBG_ASYNC_SAFE ),
8282 PHPDBG_COMMAND_D (clean , "clean the execution environment" , 'X' , NULL , 0 , 0 ),
8383 PHPDBG_COMMAND_D (clear , "clear breakpoints" , 'C' , NULL , 0 , 0 ),
8484 PHPDBG_COMMAND_D (help , "show help menu" , 'h' , phpdbg_help_commands , "|s" , PHPDBG_ASYNC_SAFE ),
@@ -779,52 +779,60 @@ PHPDBG_COMMAND(back) /* {{{ */
779779} /* }}} */
780780
781781PHPDBG_COMMAND (print ) /* {{{ */
782+ {
783+ if (!param || param -> type == EMPTY_PARAM ) {
784+ return phpdbg_do_print_exec (param );
785+ } else switch (param -> type ) {
786+ case STR_PARAM :
787+ return phpdbg_do_print_func (param );
788+ case METHOD_PARAM :
789+ return phpdbg_do_print_method (param );
790+ default :
791+ phpdbg_error ("print" , "type=\"invalidarg\"" , "Invalid arguments to print, expected nothing, function name or method name" );
792+ return SUCCESS ;
793+ }
794+ } /* }}} */
795+
796+ PHPDBG_COMMAND (info ) /* {{{ */
782797{
783798 phpdbg_out ("Execution Context Information\n\n" );
784799 phpdbg_xml ("<printinfo %r>" );
785800#ifdef HAVE_LIBREADLINE
786- phpdbg_writeln ("print " , "readline=\"yes\"" , "Readline yes" );
801+ phpdbg_writeln ("info " , "readline=\"yes\"" , "Readline yes" );
787802#else
788- phpdbg_writeln ("print " , "readline=\"no\"" , "Readline no" );
803+ phpdbg_writeln ("info " , "readline=\"no\"" , "Readline no" );
789804#endif
790805#ifdef HAVE_LIBEDIT
791- phpdbg_writeln ("print " , "libedit=\"yes\"" , "Libedit yes" );
806+ phpdbg_writeln ("info " , "libedit=\"yes\"" , "Libedit yes" );
792807#else
793- phpdbg_writeln ("print " , "libedit=\"no\"" , "Libedit no" );
808+ phpdbg_writeln ("info " , "libedit=\"no\"" , "Libedit no" );
794809#endif
795810
796- phpdbg_writeln ("print " , "context=\"%s\"" , "Exec %s" , PHPDBG_G (exec ) ? PHPDBG_G (exec ) : "none" );
797- phpdbg_writeln ("print " , "compiled=\"%s\"" , "Compiled %s" , PHPDBG_G (ops ) ? "yes" : "no" );
798- phpdbg_writeln ("print " , "stepping=\"%s\"" , "Stepping %s" , (PHPDBG_G (flags ) & PHPDBG_IS_STEPPING ) ? "on" : "off" );
799- phpdbg_writeln ("print " , "quiet=\"%s\"" , "Quietness %s" , (PHPDBG_G (flags ) & PHPDBG_IS_QUIET ) ? "on" : "off" );
800- phpdbg_writeln ("print " , "oplog=\"%s\"" , "Oplog %s" , PHPDBG_G (oplog ) ? "on" : "off" );
811+ phpdbg_writeln ("info " , "context=\"%s\"" , "Exec %s" , PHPDBG_G (exec ) ? PHPDBG_G (exec ) : "none" );
812+ phpdbg_writeln ("info " , "compiled=\"%s\"" , "Compiled %s" , PHPDBG_G (ops ) ? "yes" : "no" );
813+ phpdbg_writeln ("info " , "stepping=\"%s\"" , "Stepping %s" , (PHPDBG_G (flags ) & PHPDBG_IS_STEPPING ) ? "on" : "off" );
814+ phpdbg_writeln ("info " , "quiet=\"%s\"" , "Quietness %s" , (PHPDBG_G (flags ) & PHPDBG_IS_QUIET ) ? "on" : "off" );
815+ phpdbg_writeln ("info " , "oplog=\"%s\"" , "Oplog %s" , PHPDBG_G (oplog ) ? "on" : "off" );
801816
802817 if (PHPDBG_G (ops )) {
803- phpdbg_writeln ("print " , "ops=\"%d\"" , "Opcodes %d" , PHPDBG_G (ops )-> last );
804- phpdbg_writeln ("print " , "vars=\"%d\"" , "Variables %d" , PHPDBG_G (ops )-> last_var ? PHPDBG_G (ops )-> last_var - 1 : 0 );
818+ phpdbg_writeln ("info " , "ops=\"%d\"" , "Opcodes %d" , PHPDBG_G (ops )-> last );
819+ phpdbg_writeln ("info " , "vars=\"%d\"" , "Variables %d" , PHPDBG_G (ops )-> last_var ? PHPDBG_G (ops )-> last_var - 1 : 0 );
805820 }
806821
807- phpdbg_writeln ("print " , "executing=\"%d\"" , "Executing %s" , PHPDBG_G (in_execution ) ? "yes" : "no" );
822+ phpdbg_writeln ("info " , "executing=\"%d\"" , "Executing %s" , PHPDBG_G (in_execution ) ? "yes" : "no" );
808823 if (PHPDBG_G (in_execution )) {
809- phpdbg_writeln ("print " , "vmret=\"%d\"" , "VM Return %d" , PHPDBG_G (vmret ));
824+ phpdbg_writeln ("info " , "vmret=\"%d\"" , "VM Return %d" , PHPDBG_G (vmret ));
810825 }
811826
812- phpdbg_writeln ("print " , "classes=\"%d\"" , "Classes %d" , zend_hash_num_elements (EG (class_table )));
813- phpdbg_writeln ("print " , "functions=\"%d\"" , "Functions %d" , zend_hash_num_elements (EG (function_table )));
814- phpdbg_writeln ("print " , "constants=\"%d\"" , "Constants %d" , zend_hash_num_elements (EG (zend_constants )));
815- phpdbg_writeln ("print " , "includes=\"%d\"" , "Included %d" , zend_hash_num_elements (& EG (included_files )));
827+ phpdbg_writeln ("info " , "classes=\"%d\"" , "Classes %d" , zend_hash_num_elements (EG (class_table )));
828+ phpdbg_writeln ("info " , "functions=\"%d\"" , "Functions %d" , zend_hash_num_elements (EG (function_table )));
829+ phpdbg_writeln ("info " , "constants=\"%d\"" , "Constants %d" , zend_hash_num_elements (EG (zend_constants )));
830+ phpdbg_writeln ("info " , "includes=\"%d\"" , "Included %d" , zend_hash_num_elements (& EG (included_files )));
816831 phpdbg_xml ("</printinfo>" );
817832
818833 return SUCCESS ;
819834} /* }}} */
820835
821- PHPDBG_COMMAND (info ) /* {{{ */
822- {
823- phpdbg_error ("info" , "type=\"toofewargs\" expected=\"1\"" , "No information command selected!" );
824-
825- return SUCCESS ;
826- } /* }}} */
827-
828836PHPDBG_COMMAND (set ) /* {{{ */
829837{
830838 phpdbg_error ("set" , "type=\"toofewargs\" expected=\"1\"" , "No set command selected!" );
0 commit comments