本文整理汇总了C++中PHPDBG_G函数的典型用法代码示例。如果您正苦于以下问题:C++ PHPDBG_G函数的具体用法?C++ PHPDBG_G怎么用?C++ PHPDBG_G使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHPDBG_G函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SigIoWatcherThread
VOID
SigIoWatcherThread(VOID *p)
{
zend_uchar sig;
struct win32_sigio_watcher_data *swd = (struct win32_sigio_watcher_data *)p;
#ifdef ZTS
void ***tsrm_ls = swd->tsrm_ls;
#endif
top:
(void)phpdbg_consume_bytes(swd->fd, &sig, 1, -1 TSRMLS_CC);
if (3 == sig) {
/* XXX completely not sure it is done right here */
if (PHPDBG_G(flags) & PHPDBG_IS_INTERACTIVE) {
if (raise(sig)) {
goto top;
}
}
if (PHPDBG_G(flags) & PHPDBG_IS_SIGNALED) {
phpdbg_set_sigsafe_mem(&sig TSRMLS_CC);
zend_try {
phpdbg_force_interruption(TSRMLS_C);
} zend_end_try();
phpdbg_clear_sigsafe_mem(TSRMLS_C);
goto end;
}
if (!(PHPDBG_G(flags) & PHPDBG_IS_INTERACTIVE)) {
PHPDBG_G(flags) |= PHPDBG_IS_SIGNALED;
}
end:
/* XXX set signaled flag to the caller thread, question is - whether it's needed */
ExitThread(sig);
} else {
示例2: phpdbg_output_pager
static int phpdbg_output_pager(int sock, const char *ptr, int len) {
int count = 0, bytes = 0;
const char *p = ptr, *endp = ptr + len;
while ((p = memchr(p, '\n', endp - p))) {
count++;
p++;
if (count % PHPDBG_G(lines) == 0) {
bytes += write(sock, ptr + bytes, (p - ptr) - bytes);
if (memchr(p, '\n', endp - p)) {
char buf[PHPDBG_MAX_CMD];
zend_quiet_write(sock, ZEND_STRL("\r---Type <return> to continue or q <return> to quit---"));
phpdbg_consume_stdin_line(buf);
if (*buf == 'q') {
break;
}
write(sock, "\r", 1);
} else break;
}
}
if (bytes && count % PHPDBG_G(lines) != 0) {
bytes += write(sock, ptr + bytes, len - bytes);
} else if (!bytes) {
bytes += write(sock, ptr, len);
}
return bytes;
}
示例3: phpdbg_mixed_write
PHPDBG_API int phpdbg_mixed_write(int sock, const char *ptr, int len) {
if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) {
return phpdbg_send_bytes(sock, ptr, len);
}
if ((PHPDBG_G(flags) & PHPDBG_HAS_PAGINATION)
&& !(PHPDBG_G(flags) & PHPDBG_WRITE_XML)
&& PHPDBG_G(io)[PHPDBG_STDOUT].fd == sock
&& PHPDBG_G(lines) > 0) {
return phpdbg_output_pager(sock, ptr, len);
}
return write(sock, ptr, len);
}
示例4: phpdbg_eol_global_update
int phpdbg_eol_global_update(char *name)
{
if (0 == memcmp(name, "CRLF", 4) || 0 == memcmp(name, "crlf", 4) || 0 == memcmp(name, "DOS", 3) || 0 == memcmp(name, "dos", 3)) {
PHPDBG_G(eol) = PHPDBG_EOL_CRLF;
} else if (0 == memcmp(name, "LF", 2) || 0 == memcmp(name, "lf", 2) || 0 == memcmp(name, "UNIX", 4) || 0 == memcmp(name, "unix", 4)) {
PHPDBG_G(eol) = PHPDBG_EOL_LF;
} else if (0 == memcmp(name, "CR", 2) || 0 == memcmp(name, "cr", 2) || 0 == memcmp(name, "MAC", 3) || 0 == memcmp(name, "mac", 3)) {
PHPDBG_G(eol) = PHPDBG_EOL_CR;
} else {
return FAILURE;
}
return SUCCESS;
}
示例5: phpdbg_mixed_read
PHPDBG_API int phpdbg_mixed_read(int sock, char *ptr, int len, int tmo) {
if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) {
return phpdbg_consume_bytes(sock, ptr, len, tmo);
}
return read(sock, ptr, len);
}
示例6: phpdbg_mixed_write
PHPDBG_API int phpdbg_mixed_write(int sock, const char *ptr, int len) {
if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) {
return phpdbg_send_bytes(sock, ptr, len);
}
return write(sock, ptr, len);
}
示例7: phpdbg_consume_stdin_line
/* is easy to generalize ... but not needed for now */
PHPDBG_API int phpdbg_consume_stdin_line(char *buf) {
int bytes = PHPDBG_G(input_buflen), len = 0;
if (PHPDBG_G(input_buflen)) {
memcpy(buf, PHPDBG_G(input_buffer), bytes);
}
PHPDBG_G(last_was_newline) = 1;
do {
int i;
if (bytes <= 0) {
continue;
}
for (i = len; i < len + bytes; i++) {
if (buf[i] == '\x03') {
if (i != len + bytes - 1) {
memmove(buf + i, buf + i + 1, len + bytes - i - 1);
}
len--;
i--;
continue;
}
if (buf[i] == '\n') {
PHPDBG_G(input_buflen) = len + bytes - 1 - i;
if (PHPDBG_G(input_buflen)) {
memcpy(PHPDBG_G(input_buffer), buf + i + 1, PHPDBG_G(input_buflen));
}
if (i != PHPDBG_MAX_CMD - 1) {
buf[i + 1] = 0;
}
return i;
}
}
len += bytes;
} while ((bytes = phpdbg_mixed_read(PHPDBG_G(io)[PHPDBG_STDIN].fd, buf + len, PHPDBG_MAX_CMD - len, -1)) > 0);
if (bytes <= 0) {
PHPDBG_G(flags) |= PHPDBG_IS_QUITTING | PHPDBG_IS_DISCONNECTED;
zend_bailout();
return 0;
}
return bytes;
}
示例8: zend_mm_mem_alloc
static void* zend_mm_mem_alloc(zend_mm_storage *storage, size_t size, size_t alignment) {
if (EXPECTED(size == PHPDBG_SIGSAFE_MEM_SIZE && !PHPDBG_G(sigsafe_mem).allocated)) {
PHPDBG_G(sigsafe_mem).allocated = 1;
return PHPDBG_G(sigsafe_mem).mem;
}
write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Tried to allocate more than " EXP_STR(PHPDBG_SIGSAFE_MEM_SIZE) " bytes from stack memory in signal handler ... bailing out of signal handler\n"));
if (*EG(bailout)) {
LONGJMP(*EG(bailout), FAILURE);
}
write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Bailed out without a bailout address in signal handler!\n"));
return NULL;
}
示例9: phpdbg_init_lexer
void phpdbg_init_lexer (phpdbg_param_t *stack, char *input) {
PHPDBG_G(parser_stack) = stack;
YYSETCONDITION(INITIAL);
LEX(text) = YYCURSOR = (unsigned char *) input;
LEX(len) = strlen(input);
}
示例10: phpdbg_print_opline_ex
void phpdbg_print_opline_ex(zend_execute_data *execute_data, HashTable *vars, zend_bool ignore_flags) /* {{{ */
{
/* 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 = (zend_op *) execute_data->opline;
char *decode = phpdbg_decode_opline(&execute_data->func->op_array, opline, vars);
if (ignore_flags || (!(PHPDBG_G(flags) & PHPDBG_IS_QUIET) || (PHPDBG_G(flags) & PHPDBG_IS_STEPPING))) {
/* output line info */
phpdbg_notice("opline", "line=\"%u\" opline=\"%p\" opcode=\"%s\" op=\"%s\" file=\"%s\"", "L%-5u %16p %-30s %s %s",
opline->lineno,
opline,
phpdbg_decode_opcode(opline->opcode),
decode,
execute_data->func->op_array.filename ? execute_data->func->op_array.filename->val : "unknown");
}
if (!ignore_flags && PHPDBG_G(oplog)) {
phpdbg_log_ex(fileno(PHPDBG_G(oplog)), "L%-5u %16p %-30s %s %s",
opline->lineno,
opline,
phpdbg_decode_opcode(opline->opcode),
decode,
execute_data->func->op_array.filename ? execute_data->func->op_array.filename->val : "unknown");
}
if (decode) {
free(decode);
}
}
} /* }}} */
示例11: PHP_FUNCTION
/* {{{ proto void phpdbg_clear(void)
instructs phpdbg to clear breakpoints */
static PHP_FUNCTION(phpdbg_clear)
{
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FUNCTION_OPLINE]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD_OPLINE]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_OPLINE]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_COND]);
} /* }}} */
示例12: phpdbg_remove_watch_collision
static void phpdbg_remove_watch_collision(phpdbg_watchpoint_t *watch) {
phpdbg_watch_collision *cur;
if ((cur = zend_hash_index_find_ptr(&PHPDBG_G(watch_collisions), (zend_ulong) Z_COUNTED_P(watch->addr.zv)))) {
if (cur->refs && !--cur->refs) {
phpdbg_delete_watchpoints_recursive(watch);
}
zend_hash_del(&cur->watches, watch->str);
zend_hash_del(&cur->implicit_watches, watch->str);
if (zend_hash_num_elements(&cur->watches) > 0) {
cur->watch = Z_PTR_P(zend_hash_get_current_data_ex(&cur->watches, NULL));
} else if (zend_hash_num_elements(&cur->implicit_watches) > 0) {
cur->watch = Z_PTR_P(zend_hash_get_current_data_ex(&cur->implicit_watches, NULL));
} else {
phpdbg_deactivate_watchpoint(cur->watch);
phpdbg_remove_watchpoint(cur->watch);
zend_hash_index_del(&PHPDBG_G(watch_collisions), (zend_ulong) Z_COUNTED_P(watch->addr.zv));
}
}
}
示例13: phpdbg_mixed_read
PHPDBG_API int phpdbg_mixed_read(int sock, char *ptr, int len, int tmo) {
int ret;
if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) {
return phpdbg_consume_bytes(sock, ptr, len, tmo);
}
do {
ret = read(sock, ptr, len);
} while (ret == -1 && errno == EINTR);
return ret;
}
示例14: phpdbg_set_sigsafe_mem
void phpdbg_set_sigsafe_mem(char *buffer) {
phpdbg_signal_safe_mem *mem = &PHPDBG_G(sigsafe_mem);
const zend_mm_handlers phpdbg_handlers = {
zend_mm_mem_alloc,
zend_mm_mem_free,
NULL,
NULL,
};
mem->mem = buffer;
mem->allocated = 0;
mem->heap = zend_mm_startup_ex(&phpdbg_handlers, NULL, 0);
mem->old_heap = zend_mm_set_heap(mem->heap);
}
示例15: phpdbg_btree_find_closest
static phpdbg_watchpoint_t *phpdbg_check_for_watchpoint(void *addr) {
phpdbg_watchpoint_t *watch;
phpdbg_btree_result *result = phpdbg_btree_find_closest(&PHPDBG_G(watchpoint_tree), (zend_ulong)phpdbg_get_page_boundary(addr) + phpdbg_pagesize - 1);
if (result == NULL) {
return NULL;
}
watch = result->ptr;
/* check if that addr is in a mprotect()'ed memory area */
if ((char *) phpdbg_get_page_boundary(watch->addr.ptr) > (char *) addr || (char *) phpdbg_get_page_boundary(watch->addr.ptr) + phpdbg_get_total_page_size(watch->addr.ptr, watch->size) < (char *) addr) {
/* failure */
return NULL;
}
return watch;
}