return SUCCESS;
} /* }}} */
+
+PHPDBG_PRINT(class) /* {{{ */
+{
+ zend_class_entry **ce;
+
+ if (expr && expr_len > 0L) {
+ if (zend_lookup_class(expr, strlen(expr), &ce TSRMLS_CC) == SUCCESS) {
+
+ } else {
+ phpdbg_error("Cannot find class %s/%lu", expr, expr_len);
+ }
+ } else {
+ phpdbg_error("No class name provided!");
+ }
+
+ return SUCCESS;
+} /* }}} */
* Printer Forward Declarations
*/
PHPDBG_PRINT(opline);
+PHPDBG_PRINT(class);
/**
* Commands
*/
static const phpdbg_command_t phpdbg_print_commands[] = {
PHPDBG_PRINT_D(opline, "print the current opline information"),
+ PHPDBG_PRINT_D(class, "print out the instructions in the specified class"),
{NULL, 0, 0}
};
int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_len TSRMLS_DC) /* {{{ */
{
- char *params = NULL;
+ char *expr = NULL;
#ifndef _WIN32
- const char *cmd = strtok_r(cmd_line, " ", ¶ms);
+ const char *cmd = strtok_r(cmd_line, " ", &expr);
#else
- const char *cmd = strtok_s(cmd_line, " ", ¶ms);
+ const char *cmd = strtok_s(cmd_line, " ", &expr);
#endif
- size_t expr_len = cmd != NULL ? strlen(cmd) : 0;
-
+ size_t expr_len = (cmd != NULL) ? strlen(cmd) : 0;
+
while (command && command->name) {
if (command->name_len == expr_len
&& memcmp(cmd, command->name, expr_len) == 0) {
+
PHPDBG_G(last) = (phpdbg_command_t*) command;
- PHPDBG_G(last_params) = params;
- PHPDBG_G(last_params_len) = cmd_len - expr_len;
- return command->handler(params, cmd_len - expr_len TSRMLS_CC);
+ PHPDBG_G(last_params) = expr;
+ PHPDBG_G(last_params_len) = ((cmd_len - expr_len) - sizeof(" "))+1;
+
+ return command->handler(
+ PHPDBG_G(last_params), PHPDBG_G(last_params_len) TSRMLS_CC);
}
++command;
}
efree(buffer);
}
} /* }}} */
+
+char *phpdbg_trim(const char *expr, size_t *expr_len) /* {{{ */
+{
+ char *pointer = expr;
+
+ while (*pointer && isspace(*pointer)) {
+ pointer++;
+ (*expr_len)--;
+ }
+
+ while (expr_len > 0L && isspace(pointer[(*expr_len)-1])) {
+ pointer[--(*expr_len)]='\0';
+ }
+
+ return pointer;
+} /* }}} */
int phpdbg_is_addr(const char*);
int phpdbg_is_class_method(const char*, size_t, char**, char**);
+/**
+ * Input trim function
+ * NOTE: efree all the things
+ */
+char *phpdbg_trim(const char*, size_t*);
+
/**
* Error/notice/formatting helper
*/