git-svn-id: svn://svn.lighttpd.net/xcache/trunk@982 c26eb9a1-5813-0410-bd6c-c2e55f420ca73.0
parent
f9f7ff5d27
commit
ef5a13d72a
@ -0,0 +1,105 @@
|
||||
#! /bin/bash
|
||||
SELF="$0"
|
||||
|
||||
if test -e prepare.devel.inc ; then
|
||||
. prepare.devel.inc
|
||||
else
|
||||
echo prepare.devel.inc is required, see prepare.devel.inc.example >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
CTAGS=`which ctags 2>/dev/null || which exuberant-ctags 2>/dev/null `
|
||||
AWK=`which gawk 2>/dev/null || which awk 2>/dev/null `
|
||||
|
||||
make_all() {
|
||||
make_xc_opcode_spec_def.h
|
||||
make_xc_const_string
|
||||
test -e tags && echo tags exists, skipping. use \""$0" tags\" to rebuild || make_tags
|
||||
}
|
||||
|
||||
make_clean() {
|
||||
make_clean_xc_const_string
|
||||
echo "*" rm -f tags xc_opcode_spec_def.h
|
||||
rm -f tags xc_opcode_spec_def.h
|
||||
}
|
||||
|
||||
make_xc_const_string() {
|
||||
make_xc_const_string_opcodes_php4.x.h
|
||||
make_xc_const_string_opcodes_php5.0.h
|
||||
make_xc_const_string_opcodes_php5.1.h
|
||||
make_xc_const_string_opcodes_php5.4.h
|
||||
make_xc_const_string_opcodes_php6.x.h
|
||||
}
|
||||
|
||||
make_clean_xc_const_string() {
|
||||
echo "*" rm -f main/xc_const_string_opcodes_php*.h{,.tmp}
|
||||
rm -f main/xc_const_string_opcodes_php*.h
|
||||
}
|
||||
|
||||
make_xc_const_string_opcodes_php4.x.h() {
|
||||
precheck main/xc_const_string_opcodes_php4.x.h "${PHP4_x_DIR}/Zend/zend_compile.h" && "$AWK" -f ./devel/gen_const_string_opcodes.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
|
||||
}
|
||||
|
||||
make_xc_const_string_opcodes_php5.0.h() {
|
||||
precheck main/xc_const_string_opcodes_php5.0.h "${PHP5_0_DIR}/Zend/zend_compile.h" && "$AWK" -f ./devel/gen_const_string_opcodes.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
|
||||
}
|
||||
|
||||
make_xc_const_string_opcodes_php5.1.h() {
|
||||
precheck main/xc_const_string_opcodes_php5.1.h "${PHP5_1_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./devel/gen_const_string_opcodes.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
|
||||
}
|
||||
|
||||
make_xc_const_string_opcodes_php5.4.h() {
|
||||
precheck main/xc_const_string_opcodes_php5.4.h "${PHP5_4_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./devel/gen_const_string_opcodes.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
|
||||
}
|
||||
|
||||
make_xc_const_string_opcodes_php6.x.h() {
|
||||
precheck main/xc_const_string_opcodes_php6.x.h "${PHP6_x_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./devel/gen_const_string_opcodes.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
|
||||
}
|
||||
|
||||
make_xc_opcode_spec_def.h() {
|
||||
precheck main/xc_opcode_spec_def.h "${EA_DIR}/opcodes.c" && "$AWK" -f ./devel/gen_xc_opcode_spec.awk < "$I" > "$O"
|
||||
}
|
||||
|
||||
make_tags() {
|
||||
if test -z "$CTAGS" ; then
|
||||
echo tool ctags not found, skip building tags >&2
|
||||
return
|
||||
fi
|
||||
|
||||
if test -d "${PHP_DEVEL_DIR}" ; then
|
||||
echo "* Making tags with ${PHP_DEVEL_DIR}"
|
||||
"$CTAGS" -R . "${PHP_DEVEL_DIR}/main" "${PHP_DEVEL_DIR}/Zend" "${PHP_DEVEL_DIR}/TSRM" "${PHP_DEVEL_DIR}/ext/standard"
|
||||
else
|
||||
echo "* Making tags without php source files"
|
||||
"$CTAGS" -R .
|
||||
fi
|
||||
}
|
||||
|
||||
error() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
precheck() {
|
||||
if test -e "$2" ; then :; else
|
||||
error X skipping "$1" because "$2" not found
|
||||
return 1
|
||||
fi
|
||||
if test "$1" -ot "$2" ; then :; else
|
||||
echo O "$1" is up to date.
|
||||
return 1
|
||||
fi
|
||||
O="$1"
|
||||
I="$2"
|
||||
echo "* Making $1 from $2"
|
||||
return 0
|
||||
}
|
||||
|
||||
if test -z "$1" ; then
|
||||
make_all
|
||||
else
|
||||
while ! test -z "$1" ; do
|
||||
eval "make_$1"
|
||||
shift
|
||||
done
|
||||
fi
|
||||
|
@ -1,4 +1,4 @@
|
||||
# copy this file as devel.prepare.inc before modifying
|
||||
# copy this file as ../devel.prepare.inc before modifying
|
||||
PHP4_x_DIR=
|
||||
PHP5_0_DIR=
|
||||
PHP5_1_DIR=
|
@ -0,0 +1,137 @@
|
||||
#!/bin/bash
|
||||
# this script is for developers only
|
||||
|
||||
. run.cfg
|
||||
|
||||
basename=$(basename $(pwd))
|
||||
if echo $basename | grep -- - >/dev/null; then :; else
|
||||
dirs=${dirs:-php5-debug}
|
||||
|
||||
for dir in $dirs; do
|
||||
cd ../${basename}-${dir} || exit
|
||||
|
||||
rm -f php-src
|
||||
find -L . -type l | xargs rm -f
|
||||
lndir ../$basename >/dev/null
|
||||
find . -iname .\*.swp | xargs rm -f
|
||||
ln -sf ~/src/php/$dir php-src
|
||||
for i in ~/src/php/$dir/sapi/cgi/php{,-cgi}; do
|
||||
[[ -r $i ]] && ln -sf "$i" php-cgi
|
||||
done
|
||||
ln -sf ~/src/php/$dir/sapi/cli/php php-cli
|
||||
|
||||
pwd
|
||||
$0 "$@"
|
||||
done
|
||||
exit
|
||||
fi
|
||||
phpbasename=${basename#*-}
|
||||
xcachebasename=${basename%%-*}
|
||||
|
||||
if [[ ! -z $1 ]]; then
|
||||
type=$1
|
||||
shift
|
||||
|
||||
if [[ ! -z $1 ]]; then
|
||||
args=("$@")
|
||||
elif [[ -z $args ]]; then
|
||||
args=(test.php)
|
||||
fi
|
||||
fi
|
||||
|
||||
case $type in
|
||||
prepare)
|
||||
exec ./devel/prepare.devel
|
||||
;;
|
||||
tags)
|
||||
exec ./devel/prepare.devel tags
|
||||
;;
|
||||
rebuild)
|
||||
PHPDIRS=${PHPDIRS:-$HOME/test}
|
||||
if [[ ! -x $PHPDIRS/$phpbasename/bin/phpize ]]; then
|
||||
echo $PHPDIRS/$phpbasename/bin/phpize not found
|
||||
exit
|
||||
fi
|
||||
export PATH=$PHPDIRS/$phpbasename/bin:$PATH
|
||||
phpize --clean \
|
||||
&& phpize \
|
||||
&& CFLAGS="-Wall -Wno-unused -W -Wshadow -std=gnu99" ./configure --enable-xcache-disassembler --enable-xcache-test --enable-xcache-constant \
|
||||
&& make
|
||||
exit
|
||||
;;
|
||||
make)
|
||||
MAKEARGS=("$@")
|
||||
;;
|
||||
esac
|
||||
|
||||
LANG=C /usr/bin/make $MAKEOPTS "${MAKEARGS[@]}" 2>&1 | hi error implicit warn FAIL
|
||||
ret=${PIPESTATUS[0]}
|
||||
if [[ $ret -ne 0 || $type = make ]]; then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
cmd=()
|
||||
tracer=()
|
||||
case "$basename" in
|
||||
*-apache1*)
|
||||
cmd=($HOME/apache1/bin/httpd -X)
|
||||
;;
|
||||
*-apache*)
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
cmd=(./php-cgi -q -c php.ini)
|
||||
"${cmd[@]}" -v
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${args[0]}" in
|
||||
fcgi)
|
||||
args=(-b 1026)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$type" in
|
||||
ltr*)
|
||||
export USE_ZEND_ALLOC=0
|
||||
tracer=(ltrace -s1024 -e malloc,realloc,free,write)
|
||||
;;
|
||||
str*)
|
||||
tracer=(strace -s1024 -T ./php-cgi)
|
||||
;;
|
||||
gdb)
|
||||
#USE_ZEND_ALLOC=0
|
||||
tracer=(gdb --args)
|
||||
;;
|
||||
val*)
|
||||
export USE_ZEND_ALLOC=0
|
||||
tracer=(valgrind --gen-suppressions=all)
|
||||
;;
|
||||
dc)
|
||||
exec ./php-cli -c php.ini ./bin/phpdc.phpr "${args[@]}" | tee decompiled.php
|
||||
;;
|
||||
dop)
|
||||
exec ./php-cli -c php.ini ./bin/phpdop.phpr "${args[@]}"
|
||||
;;
|
||||
retest)
|
||||
exec make xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`"
|
||||
;;
|
||||
test)
|
||||
case "${args[0]}" in
|
||||
*.phpt)
|
||||
exec make xcachetest TEST_ARGS=-v TESTS="${args[*]}"
|
||||
;;
|
||||
*/)
|
||||
exec make xcachetest TESTS="${args[@]}"
|
||||
;;
|
||||
*)
|
||||
exec make xcachetest
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
export XCACHE_SKIP_FCGI_WARNING=1
|
||||
echo "${tracer[@]}" "${cmd[@]}" "${args[@]}"
|
||||
exec "${tracer[@]}" "${cmd[@]}" "${args[@]}"
|
@ -0,0 +1 @@
|
||||
understructure
|
@ -0,0 +1 @@
|
||||
#include "xc_processor_real.c"
|
@ -1,105 +0,0 @@
|
||||
#! /bin/bash
|
||||
SELF="$0"
|
||||
|
||||
if test -e prepare.devel.inc ; then
|
||||
. prepare.devel.inc
|
||||
else
|
||||
echo prepare.devel.inc is required, see prepare.devel.inc.example >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
CTAGS=`which ctags 2>/dev/null || which exuberant-ctags 2>/dev/null `
|
||||
AWK=`which gawk 2>/dev/null || which awk 2>/dev/null `
|
||||
|
||||
make_all() {
|
||||
make_opcode_spec_def.h
|
||||
make_const_string
|
||||
test -e tags && echo tags exists, skipping. use \""$0" tags\" to rebuild || make_tags
|
||||
}
|
||||
|
||||
make_clean() {
|
||||
make_clean_const_string
|
||||
echo "*" rm -f tags opcode_spec_def.h
|
||||
rm -f tags opcode_spec_def.h
|
||||
}
|
||||
|
||||
make_const_string() {
|
||||
make_const_string_opcodes_php4.x.h
|
||||
make_const_string_opcodes_php5.0.h
|
||||
make_const_string_opcodes_php5.1.h
|
||||
make_const_string_opcodes_php5.4.h
|
||||
make_const_string_opcodes_php6.x.h
|
||||
}
|
||||
|
||||
make_clean_const_string() {
|
||||
echo "*" rm -f const_string_opcodes_php*.h{,.tmp}
|
||||
rm -f const_string_opcodes_php*.h
|
||||
}
|
||||
|
||||
make_const_string_opcodes_php4.x.h() {
|
||||
precheck const_string_opcodes_php4.x.h "${PHP4_x_DIR}/Zend/zend_compile.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
|
||||
}
|
||||
|
||||
make_const_string_opcodes_php5.0.h() {
|
||||
precheck const_string_opcodes_php5.0.h "${PHP5_0_DIR}/Zend/zend_compile.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
|
||||
}
|
||||
|
||||
make_const_string_opcodes_php5.1.h() {
|
||||
precheck const_string_opcodes_php5.1.h "${PHP5_1_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
|
||||
}
|
||||
|
||||
make_const_string_opcodes_php5.4.h() {
|
||||
precheck const_string_opcodes_php5.4.h "${PHP5_4_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
|
||||
}
|
||||
|
||||
make_const_string_opcodes_php6.x.h() {
|
||||
precheck const_string_opcodes_php6.x.h "${PHP6_x_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
|
||||
}
|
||||
|
||||
make_opcode_spec_def.h() {
|
||||
precheck "opcode_spec_def.h" "${EA_DIR}/opcodes.c" && "$AWK" -f ./mkopcode_spec.awk < "$I" > "$O"
|
||||
}
|
||||
|
||||
make_tags() {
|
||||
if test -z "$CTAGS" ; then
|
||||
echo tool ctags not found, skip building tags >&2
|
||||
return
|
||||
fi
|
||||
|
||||
if test -d "${PHP_DEVEL_DIR}" ; then
|
||||
echo "* Making tags with ${PHP_DEVEL_DIR}"
|
||||
"$CTAGS" -R . "${PHP_DEVEL_DIR}/main" "${PHP_DEVEL_DIR}/Zend" "${PHP_DEVEL_DIR}/TSRM" "${PHP_DEVEL_DIR}/ext/standard"
|
||||
else
|
||||
echo "* Making tags without php source files"
|
||||
"$CTAGS" -R .
|
||||
fi
|
||||
}
|
||||
|
||||
error() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
precheck() {
|
||||
if test -e "$2" ; then :; else
|
||||
error X skipping "$1" because "$2" not found
|
||||
return 1
|
||||
fi
|
||||
if test "$1" -ot "$2" ; then :; else
|
||||
echo O "$1" is up to date.
|
||||
return 1
|
||||
fi
|
||||
O="$1"
|
||||
I="$2"
|
||||
echo "* Making $1 from $2"
|
||||
return 0
|
||||
}
|
||||
|
||||
if test -z "$1" ; then
|
||||
make_all
|
||||
else
|
||||
while ! test -z "$1" ; do
|
||||
eval "make_$1"
|
||||
shift
|
||||
done
|
||||
fi
|
||||
|
@ -1 +0,0 @@
|
||||
#include "processor_real.c"
|
@ -1,102 +1,2 @@
|
||||
#!/bin/bash
|
||||
# this script is for developers only
|
||||
|
||||
. run.cfg
|
||||
|
||||
basename=$(basename $(pwd))
|
||||
if echo $basename | grep -- - >/dev/null; then :; else
|
||||
dirs=${dirs:-php5-debug}
|
||||
for dir in $dirs; do
|
||||
cd ../${basename}-${dir} || exit
|
||||
pwd
|
||||
$0 "$@"
|
||||
done
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ ! -z $1 ]]; then
|
||||
type=$1
|
||||
shift
|
||||
|
||||
if [[ ! -z $1 ]]; then
|
||||
args=("$@")
|
||||
elif [[ -z $args ]]; then
|
||||
args=(test.php)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $type = make ]]; then
|
||||
MAKEARGS=("$@")
|
||||
fi
|
||||
|
||||
LANG=C /usr/bin/make $MAKEOPTS "${MAKEARGS[@]}" 2>&1 | hi error warn FAIL
|
||||
ret=${PIPESTATUS[0]}
|
||||
if [[ $ret -ne 0 || $type = make ]]; then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
cmd=()
|
||||
tracer=()
|
||||
case "$basename" in
|
||||
*-apache1*)
|
||||
cmd=($HOME/apache1/bin/httpd -X)
|
||||
;;
|
||||
*-apache*)
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
cmd=(./php-cgi -q -c php.ini)
|
||||
"${cmd[@]}" -v
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${args[0]}" in
|
||||
fcgi)
|
||||
args=(-b 1026)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$type" in
|
||||
ltr*)
|
||||
export USE_ZEND_ALLOC=0
|
||||
tracer=(ltrace -s1024 -e malloc,realloc,free,write)
|
||||
;;
|
||||
str*)
|
||||
tracer=(strace -s1024 -T ./php-cgi)
|
||||
;;
|
||||
gdb)
|
||||
#USE_ZEND_ALLOC=0
|
||||
tracer=(gdb --args)
|
||||
;;
|
||||
val*)
|
||||
export USE_ZEND_ALLOC=0
|
||||
tracer=(valgrind --gen-suppressions=all)
|
||||
;;
|
||||
dc)
|
||||
exec ./php-cli -c php.ini ./phpdc.phpr "${args[@]}" | tee decompiled.php
|
||||
;;
|
||||
dop)
|
||||
exec ./php-cgi -q -c php.ini ./phpdop.phpr "${args[@]}"
|
||||
;;
|
||||
retest)
|
||||
exec make xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`"
|
||||
;;
|
||||
test)
|
||||
case "${args[0]}" in
|
||||
*.phpt)
|
||||
exec make xcachetest TEST_ARGS=-v TESTS="${args[*]}"
|
||||
;;
|
||||
*/)
|
||||
exec make xcachetest TESTS="${args[@]}"
|
||||
;;
|
||||
*)
|
||||
exec make xcachetest
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
export XCACHE_SKIP_FCGI_WARNING=1
|
||||
echo "${tracer[@]}" "${cmd[@]}" "${args[@]}"
|
||||
exec "${tracer[@]}" "${cmd[@]}" "${args[@]}"
|
||||
#!/bin/sh
|
||||
exec devel/run "$@"
|
||||
|
@ -1,11 +1,8 @@
|
||||
#include "disassembler.h"
|
||||
#include "xc_disassembler.h"
|
||||
#include "xcache.h"
|
||||
#include "utils.h"
|
||||
#include "processor.h"
|
||||
#include "xc_utils.h"
|
||||
#include "xc_processor.h"
|
||||
|
||||
#ifndef HAVE_XCACHE_OPCODE_SPEC_DEF
|
||||
#error disassembler cannot be built without xcache/opcode_spec_def.h
|
||||
#endif
|
||||
static void xc_dasm(zval *output, zend_op_array *op_array TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
const Bucket *b;
|
@ -0,0 +1 @@
|
||||
generic utility stuffs unrelatived to ZendEngine
|
@ -1,6 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "stack.h"
|
||||
#include "xc_stack.h"
|
||||
typedef xc_stack_t* S;
|
||||
|
||||
void xc_stack_init_ex(S stack, int initsize)
|
@ -0,0 +1,56 @@
|
||||
#ifndef XC_VECTOR_H_0957AC4E1A44E838C7B8DBECFF9C4B3B
|
||||
#define XC_VECTOR_H_0957AC4E1A44E838C7B8DBECFF9C4B3B
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
typedef struct {
|
||||
zend_uint size;
|
||||
zend_uint cnt;
|
||||
void *data;
|
||||
} xc_vector_t;
|
||||
|
||||
#define xc_vector_init(type, vector) do { \
|
||||
(vector)->cnt = 0; \
|
||||
(vector)->size = 0; \
|
||||
(vector)->data = NULL; \
|
||||
} while (0)
|
||||
|
||||
#define xc_vector_add(type, vector, value) do { \
|
||||
if ((vector)->cnt == (vector)->size) { \
|
||||
if ((vector)->size) { \
|
||||
(vector)->size <<= 1; \
|
||||
(vector)->data = erealloc((vector)->data, sizeof(type) * (vector)->size); \
|
||||
} \
|
||||
else { \
|
||||
(vector)->size = 8; \
|
||||
(vector)->data = emalloc(sizeof(type) * (vector)->size); \
|
||||
} \
|
||||
} \
|
||||
((type *) (vector)->data)[(vector)->cnt++] = value; \
|
||||
} while (0)
|
||||
|
||||
static inline void *xc_vector_detach_impl(xc_vector_t *vector)
|
||||
{
|
||||
void *data = vector->data;
|
||||
vector->data = NULL;
|
||||
vector->size = 0;
|
||||
vector->cnt = 0;
|
||||
return data;
|
||||
}
|
||||
|
||||
#define xc_vector_detach(type, vector) ((type *) xc_vector_detach_impl(vector))
|
||||
|
||||
static inline void xc_vector_free_impl(xc_vector_t *vector TSRMLS_DC)
|
||||
{
|
||||
if (vector->data) {
|
||||
efree(vector->data);
|
||||
}
|
||||
vector->size = 0;
|
||||
vector->cnt = 0;
|
||||
}
|
||||
|
||||
#define xc_vector_free(type, vector) xc_vector_free_impl(vector TSRMLS_CC)
|
||||
|
||||
#endif /* XC_VECTOR_H_0957AC4E1A44E838C7B8DBECFF9C4B3B */
|
Loading…
Reference in new issue