|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-09-15 11:51 UTC] messias at gmail dot com
Description: ------------ Output should contain addresses of opcodes for jump destination. Either absolute address of every opcode or base address plus relative offsets would be nice. Output is otherwise completely unusable in PHP scripting environment. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 08:00:01 2025 UTC |
Something like this: --- parsekit-1.1/parsekit.c +++ parsekit-1.1.new/parsekit.c @@ -75,9 +75,9 @@ static void php_parsekit_parse_node(zval #endif } else { /* IS_VAR || IS_TMP_VAR || IS_UNUSED */ - char sop[(sizeof(void *) * 2) + 1]; + char sop[(sizeof(void *) * 2) + 3]; - snprintf(sop, (sizeof(void *) * 2) + 1, "%X", (unsigned int)node->u.var); + snprintf(sop, (sizeof(void *) * 2) + 3, "0x%X", (unsigned int)node->u.var); if ((flags & PHP_PARSEKIT_VAR) || (options & PHP_PARSEKIT_ALL_ELEMENTS)) { @@ -125,12 +125,16 @@ static void php_parsekit_parse_op(zval * { zval *result, *op1, *op2; long flags = 0; + char opcode_addr[(sizeof(void *) * 2) + 3]; + + snprintf(opcode_addr, (sizeof(void *) * 2) + 3, "0x%X", (unsigned int)op); array_init(return_value); /* op->handler */ add_assoc_long(return_value, "opcode", op->opcode); add_assoc_string(return_value, "opcode_name", php_parsekit_define_name_ex(op->opcode, php_parsekit_opcode_names, &flags, PHP_PARSEKIT_OPCODE_UNKNOWN) , 1); + add_assoc_string(return_value, "opcode_addr", opcode_addr, 1); add_assoc_long(return_value, "flags", flags); /* args: result, op1, op2 */