zend_function* fbc;
char *func_name = str;
size_t func_name_len = len;
-
+
/* search active scope if begins with period */
if (func_name[0] == '.') {
if (EG(scope)) {
} else {
func_table = EG(function_table);
}
-
+
/* use lowercase names, case insensitive */
func_name = zend_str_tolower_dup(func_name, func_name_len);
-
+
if (zend_hash_find(func_table, func_name, func_name_len+1,
(void**)&fbc) == SUCCESS) {
phpdbg_list_function(fbc TSRMLS_CC);
} else {
phpdbg_error("Function %s not found", func_name);
}
-
+
efree(func_name);
}
PHPDBG_LIST(lines) /* {{{ */
{
- switch (param->type) {
- case NUMERIC_PARAM:
- case EMPTY_PARAM: {
- if (PHPDBG_G(exec) || zend_is_executing(TSRMLS_C)) {
- if (param->type == EMPTY_PARAM) {
- phpdbg_list_file(phpdbg_current_file(TSRMLS_C), 0, 0 TSRMLS_CC);
- } else phpdbg_list_file(phpdbg_current_file(TSRMLS_C), param->num, 0 TSRMLS_CC);
- } else phpdbg_error("Not executing, and execution context not set");
- } break;
-
- default:
- phpdbg_error("Unsupported parameter type (%s) for function", phpdbg_get_param_type(param TSRMLS_CC));
- }
-
+ if (!PHPDBG_G(exec) || !zend_is_executing(TSRMLS_C)) {
+ phpdbg_error("Not executing, and execution context not set");
+ return SUCCESS;
+ }
+
+ switch (param->type) {
+ case NUMERIC_PARAM:
+ case EMPTY_PARAM:
+ phpdbg_list_file(phpdbg_current_file(TSRMLS_C),
+ param->type == EMPTY_PARAM ? 0 : param->num,
+ zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
+ break;
+ case FILE_PARAM:
+ phpdbg_list_file(param->file.name, param->file.line, 0 TSRMLS_CC);
+ break;
+ default:
+ phpdbg_error("Unsupported parameter type (%s) for function",
+ phpdbg_get_param_type(param TSRMLS_CC));
+ }
+
return SUCCESS;
} /* }}} */
phpdbg_error(
"Unsupported parameter type (%s) for function", phpdbg_get_param_type(param TSRMLS_CC));
}
-
+
return SUCCESS;
} /* }}} */
{
if (param->type == METHOD_PARAM) {
zend_class_entry **ce;
-
+
if (zend_lookup_class(param->method.class, strlen(param->method.class), &ce TSRMLS_CC) == SUCCESS) {
zend_function *function;
char *lcname = zend_str_tolower_dup(
param->method.name, strlen(param->method.name));
-
+
if (zend_hash_find(&(*ce)->function_table, lcname, strlen(lcname)+1, (void**) &function) == SUCCESS) {
phpdbg_list_function(
function TSRMLS_CC);
} else {
phpdbg_error("Could not find ::%s in %s", param->method.name, param->method.class);
}
-
+
efree(lcname);
} else {
phpdbg_error("Could not find the class %s", param->method.class);
phpdbg_error(
"Unsupported parameter type (%s) for function", phpdbg_get_param_type(param TSRMLS_CC));
}
-
+
return SUCCESS;
} /* }}} */
{
if (param->type == STR_PARAM) {
zend_class_entry **ce;
-
+
if (zend_lookup_class(param->str, param->len, &ce TSRMLS_CC) == SUCCESS) {
if ((*ce)->type == ZEND_USER_CLASS) {
if ((*ce)->info.user.filename) {
phpdbg_error(
"Unsupported parameter type (%s) for function", phpdbg_get_param_type(param TSRMLS_CC));
}
-
+
return SUCCESS;
} /* }}} */
{
switch (param->type) {
case NUMERIC_PARAM:
- case EMPTY_PARAM: {
- if (PHPDBG_G(exec) || zend_is_executing(TSRMLS_C)) {
- if (param->type == EMPTY_PARAM) {
- phpdbg_list_file(phpdbg_current_file(TSRMLS_C), 0, 0 TSRMLS_CC);
- } else phpdbg_list_file(phpdbg_current_file(TSRMLS_C), param->num, 0 TSRMLS_CC);
- } else phpdbg_error("Not executing, and execution context not set");
- } break;
-
+ case EMPTY_PARAM:
+ return PHPDBG_LIST_HANDLER(lines)(param TSRMLS_CC);
+
case FILE_PARAM:
- phpdbg_list_file(param->file.name, param->file.line, 0 TSRMLS_CC);
- break;
-
+ return PHPDBG_LIST_HANDLER(lines)(param TSRMLS_CC);
+
case STR_PARAM: {
i_phpdbg_list_func(param->str, param->len TSRMLS_CC);
} break;
-
+
case METHOD_PARAM:
- phpdbg_do_list_method(param TSRMLS_CC);
- break;
-
+ return PHPDBG_LIST_HANDLER(method)(param TSRMLS_CC);
+
default:
phpdbg_error(
"Unsupported parameter type (%s) for function", phpdbg_get_param_type(param TSRMLS_CC));
/**
* Command Declarators
*/
+#define PHPDBG_LIST_HANDLER(name) phpdbg_do_list_##name
#define PHPDBG_LIST_D(name, tip) \
{PHPDBG_STRL(#name), tip, sizeof(tip)-1, 0, phpdbg_do_list_##name, NULL}
#define PHPDBG_LIST_EX_D(name, tip, alias) \
{PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, phpdbg_do_list_##name, NULL}
#define PHPDBG_LIST(name) \
- int phpdbg_do_list_##name(phpdbg_param_t *param TSRMLS_DC)
+ int PHPDBG_LIST_HANDLER(name)(phpdbg_param_t *param TSRMLS_DC)
+
PHPDBG_LIST(lines);
PHPDBG_LIST(class);