mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
housekeeping, moving stuff to appropriate units
This commit is contained in:
parent
8743afbaa4
commit
cdd72cfda7
5 changed files with 69 additions and 61 deletions
6
phpdbg.c
6
phpdbg.c
|
@ -434,6 +434,12 @@ static void phpdbg_welcome(zend_bool cleaning TSRMLS_DC) /* {{{ */
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
static inline void phpdbg_sigint_handler(int signo) /* {{{ */
|
||||||
|
{
|
||||||
|
TSRMLS_FETCH();
|
||||||
|
PHPDBG_G(flags) |= PHPDBG_IS_SIGNALED;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
int main(int argc, char **argv) /* {{{ */
|
int main(int argc, char **argv) /* {{{ */
|
||||||
{
|
{
|
||||||
sapi_module_struct *phpdbg = &phpdbg_sapi_module;
|
sapi_module_struct *phpdbg = &phpdbg_sapi_module;
|
||||||
|
|
|
@ -17,9 +17,13 @@
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "phpdbg.h"
|
||||||
#include "zend_vm_opcodes.h"
|
#include "zend_vm_opcodes.h"
|
||||||
#include "zend_compile.h"
|
#include "zend_compile.h"
|
||||||
#include "phpdbg_opcode.h"
|
#include "phpdbg_opcode.h"
|
||||||
|
#include "phpdbg_utils.h"
|
||||||
|
|
||||||
|
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
||||||
|
|
||||||
static inline zend_uint phpdbg_decode_literal(zend_op_array *ops, zend_literal *literal TSRMLS_DC) /* {{{ */
|
static inline zend_uint phpdbg_decode_literal(zend_op_array *ops, zend_literal *literal TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
|
@ -133,6 +137,49 @@ format:
|
||||||
return decode[0];
|
return decode[0];
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
void phpdbg_print_opline_ex(zend_execute_data *execute_data, HashTable *vars, zend_bool ignore_flags TSRMLS_DC) /* {{{ */
|
||||||
|
{
|
||||||
|
/* force out a line while stepping so the user knows what is happening */
|
||||||
|
if (ignore_flags ||
|
||||||
|
(!(PHPDBG_G(flags) & PHPDBG_IS_QUIET) ||
|
||||||
|
(PHPDBG_G(flags) & PHPDBG_IS_STEPPING) ||
|
||||||
|
(PHPDBG_G(oplog)))) {
|
||||||
|
|
||||||
|
zend_op *opline = execute_data->opline;
|
||||||
|
char *decode = phpdbg_decode_opline(execute_data->op_array, opline, vars TSRMLS_CC);
|
||||||
|
|
||||||
|
if (ignore_flags ||
|
||||||
|
(!(PHPDBG_G(flags) & PHPDBG_IS_QUIET) ||
|
||||||
|
(PHPDBG_G(flags) & PHPDBG_IS_STEPPING))) {
|
||||||
|
/* output line info */
|
||||||
|
phpdbg_notice("#%- 5lu %16p %-30s %s %s",
|
||||||
|
opline->lineno,
|
||||||
|
opline,
|
||||||
|
phpdbg_decode_opcode(opline->opcode),
|
||||||
|
decode,
|
||||||
|
execute_data->op_array->filename ? execute_data->op_array->filename : "unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ignore_flags && PHPDBG_G(oplog)) {
|
||||||
|
phpdbg_log_ex(PHPDBG_G(oplog), "#%- 5lu %16p %-30s %s %s",
|
||||||
|
opline->lineno,
|
||||||
|
opline,
|
||||||
|
phpdbg_decode_opcode(opline->opcode),
|
||||||
|
decode,
|
||||||
|
execute_data->op_array->filename ? execute_data->op_array->filename : "unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (decode) {
|
||||||
|
free(decode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
void phpdbg_print_opline(zend_execute_data *execute_data, zend_bool ignore_flags TSRMLS_DC) /* {{{ */
|
||||||
|
{
|
||||||
|
phpdbg_print_opline_ex(execute_data, NULL, ignore_flags TSRMLS_CC);
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ */
|
const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ */
|
||||||
{
|
{
|
||||||
#define CASE(s) case s: return #s
|
#define CASE(s) case s: return #s
|
||||||
|
|
|
@ -24,5 +24,7 @@
|
||||||
|
|
||||||
const char *phpdbg_decode_opcode(zend_uchar);
|
const char *phpdbg_decode_opcode(zend_uchar);
|
||||||
char *phpdbg_decode_opline(zend_op_array *ops, zend_op *op, HashTable *vars TSRMLS_DC);
|
char *phpdbg_decode_opline(zend_op_array *ops, zend_op *op, HashTable *vars TSRMLS_DC);
|
||||||
|
void phpdbg_print_opline(zend_execute_data *execute_data, zend_bool ignore_flags TSRMLS_DC);
|
||||||
|
void phpdbg_print_opline_ex(zend_execute_data *execute_data, HashTable *vars, zend_bool ignore_flags TSRMLS_DC);
|
||||||
|
|
||||||
#endif /* PHPDBG_OPCODE_H */
|
#endif /* PHPDBG_OPCODE_H */
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "phpdbg_cmd.h"
|
#include "phpdbg_cmd.h"
|
||||||
|
|
||||||
/* {{{ command declarations */
|
/* {{{ command declarations */
|
||||||
static const phpdbg_command_t phpdbg_prompt_commands[] = {
|
const phpdbg_command_t phpdbg_prompt_commands[] = {
|
||||||
PHPDBG_COMMAND_D(exec, "set execution context", 'e', NULL, 1),
|
PHPDBG_COMMAND_D(exec, "set execution context", 'e', NULL, 1),
|
||||||
PHPDBG_COMMAND_D(compile, "attempt compilation", 'c', NULL, 0),
|
PHPDBG_COMMAND_D(compile, "attempt compilation", 'c', NULL, 0),
|
||||||
PHPDBG_COMMAND_D(step, "step through execution", 's', NULL, 1),
|
PHPDBG_COMMAND_D(step, "step through execution", 's', NULL, 1),
|
||||||
|
@ -1025,49 +1025,6 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
void phpdbg_print_opline_ex(zend_execute_data *execute_data, HashTable *vars, zend_bool ignore_flags TSRMLS_DC) /* {{{ */
|
|
||||||
{
|
|
||||||
/* force out a line while stepping so the user knows what is happening */
|
|
||||||
if (ignore_flags ||
|
|
||||||
(!(PHPDBG_G(flags) & PHPDBG_IS_QUIET) ||
|
|
||||||
(PHPDBG_G(flags) & PHPDBG_IS_STEPPING) ||
|
|
||||||
(PHPDBG_G(oplog)))) {
|
|
||||||
|
|
||||||
zend_op *opline = execute_data->opline;
|
|
||||||
char *decode = phpdbg_decode_opline(execute_data->op_array, opline, vars TSRMLS_CC);
|
|
||||||
|
|
||||||
if (ignore_flags ||
|
|
||||||
(!(PHPDBG_G(flags) & PHPDBG_IS_QUIET) ||
|
|
||||||
(PHPDBG_G(flags) & PHPDBG_IS_STEPPING))) {
|
|
||||||
/* output line info */
|
|
||||||
phpdbg_notice("#%- 5lu %16p %-30s %s %s",
|
|
||||||
opline->lineno,
|
|
||||||
opline,
|
|
||||||
phpdbg_decode_opcode(opline->opcode),
|
|
||||||
decode,
|
|
||||||
execute_data->op_array->filename ? execute_data->op_array->filename : "unknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ignore_flags && PHPDBG_G(oplog)) {
|
|
||||||
phpdbg_log_ex(PHPDBG_G(oplog), "#%- 5lu %16p %-30s %s %s",
|
|
||||||
opline->lineno,
|
|
||||||
opline,
|
|
||||||
phpdbg_decode_opcode(opline->opcode),
|
|
||||||
decode,
|
|
||||||
execute_data->op_array->filename ? execute_data->op_array->filename : "unknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (decode) {
|
|
||||||
free(decode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* }}} */
|
|
||||||
|
|
||||||
void phpdbg_print_opline(zend_execute_data *execute_data, zend_bool ignore_flags TSRMLS_DC) /* {{{ */
|
|
||||||
{
|
|
||||||
phpdbg_print_opline_ex(execute_data, NULL, ignore_flags TSRMLS_CC);
|
|
||||||
} /* }}} */
|
|
||||||
|
|
||||||
void phpdbg_clean(zend_bool full TSRMLS_DC) /* {{{ */
|
void phpdbg_clean(zend_bool full TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
/* this is implicitly required */
|
/* this is implicitly required */
|
||||||
|
@ -1084,12 +1041,6 @@ void phpdbg_clean(zend_bool full TSRMLS_DC) /* {{{ */
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
void phpdbg_sigint_handler(int signo)
|
|
||||||
{
|
|
||||||
TSRMLS_FETCH();
|
|
||||||
PHPDBG_G(flags) |= PHPDBG_IS_SIGNALED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline zend_execute_data *phpdbg_create_execute_data(zend_op_array *op_array, zend_bool nested TSRMLS_DC) /* {{{ */
|
static inline zend_execute_data *phpdbg_create_execute_data(zend_op_array *op_array, zend_bool nested TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
#if PHP_VERSION_ID >= 50500
|
#if PHP_VERSION_ID >= 50500
|
||||||
|
|
|
@ -20,21 +20,13 @@
|
||||||
#ifndef PHPDBG_PROMPT_H
|
#ifndef PHPDBG_PROMPT_H
|
||||||
#define PHPDBG_PROMPT_H
|
#define PHPDBG_PROMPT_H
|
||||||
|
|
||||||
|
/* {{{ */
|
||||||
void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default TSRMLS_DC);
|
void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default TSRMLS_DC);
|
||||||
int phpdbg_interactive(TSRMLS_D);
|
int phpdbg_interactive(TSRMLS_D);
|
||||||
void phpdbg_print_opline(zend_execute_data *execute_data, zend_bool ignore_flags TSRMLS_DC);
|
|
||||||
char *phpdbg_decode_opline(zend_op_array *ops, zend_op *op, HashTable *vars TSRMLS_DC);
|
|
||||||
int phpdbg_compile(TSRMLS_D);
|
int phpdbg_compile(TSRMLS_D);
|
||||||
void phpdbg_clean(zend_bool full TSRMLS_DC);
|
void phpdbg_clean(zend_bool full TSRMLS_DC); /* }}} */
|
||||||
void phpdbg_sigint_handler(int signo);
|
|
||||||
|
|
||||||
#if PHP_VERSION_ID >= 50500
|
/* {{{ phpdbg command handlers */
|
||||||
void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC);
|
|
||||||
#else
|
|
||||||
void phpdbg_execute_ex(zend_op_array *op_array TSRMLS_DC);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* {{{ */
|
|
||||||
PHPDBG_COMMAND(exec);
|
PHPDBG_COMMAND(exec);
|
||||||
PHPDBG_COMMAND(compile);
|
PHPDBG_COMMAND(compile);
|
||||||
PHPDBG_COMMAND(step);
|
PHPDBG_COMMAND(step);
|
||||||
|
@ -59,4 +51,14 @@ PHPDBG_COMMAND(oplog);
|
||||||
PHPDBG_COMMAND(register);
|
PHPDBG_COMMAND(register);
|
||||||
PHPDBG_COMMAND(quit); /* }}} */
|
PHPDBG_COMMAND(quit); /* }}} */
|
||||||
|
|
||||||
|
/* {{{ prompt commands */
|
||||||
|
extern const phpdbg_command_t phpdbg_prompt_commands[]; /* }}} */
|
||||||
|
|
||||||
|
/* {{{ */
|
||||||
|
#if PHP_VERSION_ID >= 50500
|
||||||
|
void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC);
|
||||||
|
#else
|
||||||
|
void phpdbg_execute_ex(zend_op_array *op_array TSRMLS_DC);
|
||||||
|
#endif /* }}} */
|
||||||
|
|
||||||
#endif /* PHPDBG_PROMPT_H */
|
#endif /* PHPDBG_PROMPT_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue