php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
phpdbg_prompt.c File Reference
#include <stdio.h>
#include <string.h>
#include "zend.h"
#include "zend_compile.h"
#include "zend_exceptions.h"
#include "zend_vm.h"
#include "zend_generators.h"
#include "zend_interfaces.h"
#include "zend_smart_str.h"
#include "phpdbg.h"
#include "phpdbg_io.h"
#include "phpdbg_help.h"
#include "phpdbg_print.h"
#include "phpdbg_info.h"
#include "phpdbg_break.h"
#include "phpdbg_list.h"
#include "phpdbg_utils.h"
#include "phpdbg_prompt.h"
#include "phpdbg_cmd.h"
#include "phpdbg_set.h"
#include "phpdbg_frame.h"
#include "phpdbg_lexer.h"
#include "phpdbg_parser.h"

Go to the source code of this file.

Data Structures

struct  phpdbg_init_state
 

Macros

#define DO_INTERACTIVE(allow_async_unsafe)
 
#define INDEX_EXISTS_CHECK   (zend_hash_index_exists(&PHPDBG_G(seek), address) || (exception && phpdbg_check_caught_ex(execute_data, exception) == 0))
 

Functions

void phpdbg_string_init (char *buffer)
 
void phpdbg_try_file_init (char *init_file, size_t init_file_len, bool free_init)
 
void phpdbg_init (char *init_file, size_t init_file_len, bool use_default)
 
void phpdbg_clean (bool full, bool resubmit)
 
 if (VCWD_STAT(param->str, &sb) !=FAILURE)
 
 PHPDBG_COMMAND (stdin)
 
int phpdbg_compile_stdin (zend_string *code)
 
int phpdbg_compile (void)
 
int phpdbg_skip_line_helper (void)
 
 if (zend_hash_index_exists(&PHPDBG_G(seek),(zend_ulong) phpdbg_user_execute_data(EG(current_execute_data)) ->opline))
 
int phpdbg_output_ev_variable (char *name, size_t len, char *keyname, size_t keylen, HashTable *parent, zval *zv)
 
 PHPDBG_OUTPUT_BACKUP ()
 
 if (PHPDBG_G(flags) &PHPDBG_IN_SIGNAL_HANDLER)
 
 if (!(PHPDBG_G(flags) &PHPDBG_IS_STEPONEVAL))
 
 PHPDBG_G (flags)|
 
 PHPDBG_G (flags) &
 
 if (stepping &&!(PHPDBG_G(flags) &PHPDBG_IS_STEPONEVAL))
 
 CG (unclean_shutdown)=0
 
 PHPDBG_OUTPUT_BACKUP_RESTORE ()
 
 if (!PHPDBG_G(in_execution))
 
 if (param)
 

Variables

int phpdbg_startup_run
 
const phpdbg_command_t phpdbg_prompt_commands []
 
 else
 
return SUCCESS
 
return PHPDBG_FINISH
 
return PHPDBG_LEAVE
 
zval retval
 
zend_execute_dataoriginal_execute_data = EG(current_execute_data)
 
zend_vm_stack original_stack = EG(vm_stack)
 
zend_objectex = NULL
 
original_stack top = EG(vm_stack_top)
 
 zend_try
 

Macro Definition Documentation

◆ DO_INTERACTIVE

#define DO_INTERACTIVE ( allow_async_unsafe)
Value:
do { \
if (exception) { \
const zend_op *before_ex = EG(opline_before_exception); \
const zend_op *backup_opline = NULL; \
if (EG(current_execute_data) && EG(current_execute_data)->func && ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) { \
backup_opline = EG(current_execute_data)->opline; \
} \
GC_ADDREF(exception); \
zend_clear_exception(); \
list_code(); \
switch (phpdbg_interactive(allow_async_unsafe, NULL)) { \
case PHPDBG_LEAVE: \
case PHPDBG_FINISH: \
case PHPDBG_UNTIL: \
case PHPDBG_NEXT: \
if (backup_opline \
&& (backup_opline->opcode == ZEND_HANDLE_EXCEPTION || backup_opline->opcode == ZEND_CATCH)) { \
EG(current_execute_data)->opline = backup_opline; \
} else { \
zend_throw_exception_internal(exception); \
} \
EG(opline_before_exception) = before_ex; \
} \
} else { \
list_code(); \
phpdbg_interactive(allow_async_unsafe, NULL); \
} \
goto next; \
} while (0)
bool exception
Definition assert.c:30
#define NULL
Definition gdcache.h:45
#define next(ls)
Definition minilua.c:2661
#define PHPDBG_NEXT
Definition phpdbg.h:116
#define PHPDBG_LEAVE
Definition phpdbg.h:119
#define PHPDBG_FINISH
Definition phpdbg.h:118
#define PHPDBG_UNTIL
Definition phpdbg.h:117
int phpdbg_interactive(bool allow_async_unsafe, char *input)
uint8_t opcode
execute_data func
struct _zend_op zend_op
#define ZEND_USER_CODE(type)
#define EG(v)
#define ZEND_HANDLE_EXCEPTION
#define ZEND_CATCH

◆ INDEX_EXISTS_CHECK

#define INDEX_EXISTS_CHECK   (zend_hash_index_exists(&PHPDBG_G(seek), address) || (exception && phpdbg_check_caught_ex(execute_data, exception) == 0))

Function Documentation

◆ CG()

CG ( unclean_shutdown )
pure virtual

◆ if() [1/7]

if ( ! PHPDBG_G(flags) &PHPDBG_IS_STEPONEVAL)

Definition at line 965 of file phpdbg_prompt.c.

◆ if() [2/7]

if ( ! PHPDBG_Gin_execution)

Definition at line 1028 of file phpdbg_prompt.c.

◆ if() [3/7]

if ( param )

Definition at line 1033 of file phpdbg_prompt.c.

◆ if() [4/7]

if ( PHPDBG_G(flags) & PHPDBG_IN_SIGNAL_HANDLER)

Definition at line 954 of file phpdbg_prompt.c.

◆ if() [5/7]

if ( stepping &&! PHPDBG_G(flags) &PHPDBG_IS_STEPONEVAL)

Definition at line 997 of file phpdbg_prompt.c.

◆ if() [6/7]

if ( VCWD_STAT(param->str, &sb) ! = FAILURE)

Definition at line 405 of file phpdbg_prompt.c.

◆ if() [7/7]

if ( zend_hash_index_exists(& seek,
(zend_ulong) phpdbg_user_execute_data(EG(current_execute_data)) -> opline )

Definition at line 673 of file phpdbg_prompt.c.

◆ phpdbg_clean()

void phpdbg_clean ( bool full,
bool resubmit )

Definition at line 382 of file phpdbg_prompt.c.

◆ PHPDBG_COMMAND()

PHPDBG_COMMAND ( stdin )

Definition at line 459 of file phpdbg_prompt.c.

◆ phpdbg_compile()

int phpdbg_compile ( void )

Definition at line 557 of file phpdbg_prompt.c.

◆ phpdbg_compile_stdin()

int phpdbg_compile_stdin ( zend_string * code)

Definition at line 520 of file phpdbg_prompt.c.

◆ PHPDBG_G() [1/2]

PHPDBG_G ( flags ) &

◆ PHPDBG_G() [2/2]

PHPDBG_G ( flags )

◆ phpdbg_init()

void phpdbg_init ( char * init_file,
size_t init_file_len,
bool use_default )

Definition at line 340 of file phpdbg_prompt.c.

◆ PHPDBG_OUTPUT_BACKUP()

PHPDBG_OUTPUT_BACKUP ( )

◆ PHPDBG_OUTPUT_BACKUP_RESTORE()

PHPDBG_OUTPUT_BACKUP_RESTORE ( )

◆ phpdbg_output_ev_variable()

int phpdbg_output_ev_variable ( char * name,
size_t len,
char * keyname,
size_t keylen,
HashTable * parent,
zval * zv )

Definition at line 927 of file phpdbg_prompt.c.

◆ phpdbg_skip_line_helper()

return phpdbg_skip_line_helper ( void )
Initial value:
{
phpdbg_error("Not executing");
return SUCCESS;
}
#define SUCCESS
Definition hash_sha3.c:261
#define PHPDBG_G(v)
Definition phpdbg.h:102
#define PHPDBG_IS_STEPPING
Definition phpdbg.h:144
bool in_execution
Definition phpdbg.h:269
#define phpdbg_error(strfmt,...)
Definition phpdbg_out.h:43

Definition at line 602 of file phpdbg_prompt.c.

◆ phpdbg_string_init()

void phpdbg_string_init ( char * buffer)

Definition at line 294 of file phpdbg_prompt.c.

◆ phpdbg_try_file_init()

void phpdbg_try_file_init ( char * init_file,
size_t init_file_len,
bool free_init )

Definition at line 309 of file phpdbg_prompt.c.

Variable Documentation

◆ else

else
Initial value:
{
phpdbg_error("Cannot stat %s, ensure the file exists", param->str)

Definition at line 453 of file phpdbg_prompt.c.

◆ ex

Definition at line 948 of file phpdbg_prompt.c.

◆ original_execute_data

zend_execute_data* original_execute_data = EG(current_execute_data)

Definition at line 946 of file phpdbg_prompt.c.

◆ original_stack

zend_vm_stack original_stack = EG(vm_stack)

Definition at line 947 of file phpdbg_prompt.c.

◆ PHPDBG_FINISH

return PHPDBG_FINISH

Definition at line 679 of file phpdbg_prompt.c.

◆ PHPDBG_LEAVE

return PHPDBG_LEAVE

Definition at line 696 of file phpdbg_prompt.c.

◆ phpdbg_prompt_commands

const phpdbg_command_t phpdbg_prompt_commands[]
Initial value:
= {
PHPDBG_COMMAND_D(exec, "set execution context", 'e', NULL, "s", 0),
PHPDBG_COMMAND_D(stdin, "read script from stdin", 0 , NULL, "s", 0),
PHPDBG_COMMAND_D(step, "step through execution", 's', NULL, 0, PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(continue, "continue execution", 'c', NULL, 0, PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(run, "attempt execution", 'r', NULL, "|s", 0),
PHPDBG_COMMAND_D(ev, "evaluate some code", 0 , NULL, "i", PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(until, "continue past the current line", 'u', NULL, 0, 0),
PHPDBG_COMMAND_D(finish, "continue past the end of the stack", 'F', NULL, 0, 0),
PHPDBG_COMMAND_D(leave, "continue until the end of the stack", 'L', NULL, 0, 0),
PHPDBG_COMMAND_D(generator, "inspect or switch to a generator", 'g', NULL, "|n", 0),
PHPDBG_COMMAND_D(print, "print something", 'p', phpdbg_print_commands, "|*c", 0),
PHPDBG_COMMAND_D(break, "set breakpoint", 'b', phpdbg_break_commands, "|*c", 0),
PHPDBG_COMMAND_D(back, "show trace", 't', NULL, "|n", PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(frame, "switch to a frame", 'f', NULL, "|n", PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(list, "lists some code", 'l', phpdbg_list_commands, "*", PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(info, "displays some information", 'i', phpdbg_info_commands, "|s", PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(clean, "clean the execution environment", 'X', NULL, 0, 0),
PHPDBG_COMMAND_D(clear, "clear breakpoints", 'C', NULL, 0, 0),
PHPDBG_COMMAND_D(help, "show help menu", 'h', phpdbg_help_commands, "|s", PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(set, "set phpdbg configuration", 'S', phpdbg_set_commands, "s", PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(register, "register a function", 'R', NULL, "s", 0),
PHPDBG_COMMAND_D(source, "execute a phpdbginit", '<', NULL, "s", 0),
PHPDBG_COMMAND_D(export, "export breaks to a .phpdbginit script", '>', NULL, "s", PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(sh, "shell a command", 0 , NULL, "i", 0),
PHPDBG_COMMAND_D(quit, "exit phpdbg", 'q', NULL, 0, PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(watch, "set watchpoint", 'w', phpdbg_watch_commands, "|ss", 0),
PHPDBG_COMMAND_D(next, "step over next line", 'n', NULL, 0, PHPDBG_ASYNC_SAFE),
}
print
char * exec
Definition phpdbg.h:263
phpdbg_frame_t frame
Definition phpdbg.h:236
const phpdbg_command_t phpdbg_break_commands[]
#define PHPDBG_END_COMMAND
Definition phpdbg_cmd.h:171
#define PHPDBG_COMMAND_D(name, tip, alias, children, args, flags)
Definition phpdbg_cmd.h:164
#define PHPDBG_ASYNC_SAFE
Definition phpdbg_cmd.h:84
const phpdbg_command_t phpdbg_help_commands[]
Definition phpdbg_help.c:31
const phpdbg_command_t phpdbg_info_commands[]
Definition phpdbg_info.c:31
const phpdbg_command_t phpdbg_list_commands[]
Definition phpdbg_list.c:39
const phpdbg_command_t phpdbg_print_commands[]
const phpdbg_command_t phpdbg_set_commands[]
Definition phpdbg_set.c:31
const phpdbg_command_t phpdbg_watch_commands[]
zend_generator * generator

Definition at line 63 of file phpdbg_prompt.c.

◆ phpdbg_startup_run

int phpdbg_startup_run
extern

Definition at line 46 of file phpdbg.c.

◆ retval

zval retval
Initial value:

Definition at line 944 of file phpdbg_prompt.c.

◆ SUCCESS

return SUCCESS

Definition at line 456 of file phpdbg_prompt.c.

◆ top

original_stack top = EG(vm_stack_top)

Definition at line 952 of file phpdbg_prompt.c.

◆ zend_try

zend_try
Initial value:
{
if (zend_eval_stringl(param->str, param->len, &retval, "eval()'d code") == SUCCESS) {
if (EG(exception)) {
} else {
phpdbg_out("\n");
}
}
if (ex) {
}
EG(current_execute_data) = original_execute_data;
EG(vm_stack_top) = original_stack->top;
EG(vm_stack_end) = original_stack->end;
EG(vm_stack) = original_stack;
EG(exit_status) = 0;
bool unclean_eval
Definition phpdbg.h:270
#define phpdbg_out(fmt,...)
Definition phpdbg_out.h:49
zend_object * ex
zend_execute_data * original_execute_data
zend_vm_stack original_stack
ZEND_API void zend_print_zval_r(zval *expr, int indent)
Definition zend.c:625
#define zend_catch
Definition zend.h:277
#define zend_end_try()
Definition zend.h:280
#define E_ERROR
Definition zend_errors.h:23
ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severity)
ZEND_API zend_result zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name)
#define OBJ_RELEASE(obj)
ZEND_API void zval_ptr_dtor(zval *zval_ptr)
zval retval

Definition at line 971 of file phpdbg_prompt.c.