refactor: fix build, easier devel
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@998 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
parent
4b1466d23e
commit
4e78a9ddec
34
.cvsignore
34
.cvsignore
|
@ -1,34 +0,0 @@
|
|||
acinclude.m4
|
||||
aclocal.m4
|
||||
build
|
||||
config.cache
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.nice
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
configure.in
|
||||
conftest
|
||||
conftest.c
|
||||
.deps
|
||||
include
|
||||
includes.i
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
Makefile
|
||||
Makefile.fragments
|
||||
Makefile.global
|
||||
Makefile.objects
|
||||
missing
|
||||
mkinstalldirs
|
||||
modules
|
||||
processor.h
|
||||
processor.out
|
||||
processor_real.c
|
||||
run-tests.php
|
||||
structinfo.m4
|
||||
autom4te.cache
|
|
@ -1,7 +1,7 @@
|
|||
XCACHE_PROC_SRC=$(srcdir)/processor/main.m4
|
||||
XCACHE_PROC_OUT=$(builddir)/processor.out
|
||||
XCACHE_PROC_C=$(builddir)/xcache/xc_processor_real.c
|
||||
XCACHE_PROC_H=$(builddir)/xcache/xc_processor.h
|
||||
XCACHE_PROC_OUT=$(builddir)/processor.out.c
|
||||
XCACHE_PROC_C=$(builddir)/xc_processor.c.h
|
||||
XCACHE_PROC_H=$(builddir)/xc_processor.h
|
||||
XCACHE_INCLUDES_SRC=$(srcdir)/includes.c
|
||||
XCACHE_INCLUDES_I=$(builddir)/includes.i
|
||||
XCACHE_STRUCTINFO_OUT=$(builddir)/structinfo.m4
|
||||
|
@ -25,16 +25,17 @@ $(XCACHE_PROC_C): $(XCACHE_PROC_OUT) $(XCACHE_PROC_H)
|
|||
cp $(XCACHE_PROC_OUT) $(XCACHE_PROC_C)
|
||||
-$(XCACHE_INDENT) < $(XCACHE_PROC_OUT) > $(XCACHE_PROC_C).tmp && mv $(XCACHE_PROC_C).tmp $(XCACHE_PROC_C)
|
||||
|
||||
$(builddir)/xcache/xc_processor.lo: $(XCACHE_PROC_C) $(XCACHE_PROC_H) $(srcdir)/xcache/xc_processor.c
|
||||
$(builddir)/xcache/xc_processor.lo: $(XCACHE_PROC_C) $(XCACHE_PROC_H)
|
||||
|
||||
$(builddir)/submodules/xc_disassembler.lo: $(XCACHE_PROC_H) $(srcdir)/xcache/xc_processor.c
|
||||
$(builddir)/submodules/xc_disassembler.lo: $(XCACHE_PROC_H)
|
||||
|
||||
$(builddir)/xc_opcode_spec.lo: $(srcdir)/xcache.h $(srcdir)/xc_opcode_spec.c $(srcdir)/xc_opcode_spec_def.h $(srcdir)/xc_const_string.h
|
||||
|
||||
$(builddir)/xcache.lo: $(XCACHE_PROC_H) $(srcdir)/xcache/xc_shm.h $(srcdir)/util/xc_stack.h $(srcdir)/xcache_globals.h $(srcdir)/xcache.c $(srcdir)/util/xc_foreachcoresig.h $(srcdir)/xcache/xc_utils.h
|
||||
|
||||
xcachesvnclean: clean
|
||||
cat $(srcdir)/.cvsignore | grep -v ^Makefile | grep -v ^config.nice | xargs rm -rf
|
||||
-svn propget svn:ignore . > .svnignore.tmp 2>/dev/null && mv .svnignore.tmp .svnignore
|
||||
cat .svnignore | grep -v devel | grep -v svnignore | grep -v ^Makefile | grep -v ^config.nice | xargs rm -rf
|
||||
|
||||
xcachetest: all
|
||||
$(SED) "s#\\./modules/#$(top_builddir)/modules/#" < $(srcdir)/xcache-test.ini > $(top_builddir)/tmp-php.ini
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#! /bin/bash
|
||||
SELF="$0"
|
||||
|
||||
if test -e prepare.inc ; then
|
||||
. prepare.inc
|
||||
if test -e devel/prepare.inc ; then
|
||||
. devel/prepare.inc
|
||||
else
|
||||
echo prepare.inc is required, see prepare.inc.example >&2
|
||||
echo devel/prepare.inc is required, see devel/prepare.inc.example >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# copy this file as ../devel.prepare.inc before modifying
|
||||
# copy this file as prepare.cfg before modifying
|
||||
PHP4_x_DIR=
|
||||
PHP5_0_DIR=
|
||||
PHP5_1_DIR=
|
57
devel/run
57
devel/run
|
@ -1,23 +1,33 @@
|
|||
#!/bin/bash
|
||||
# this script is for developers only
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
. devel/run.cfg
|
||||
if [[ ! -z $1 ]]; then
|
||||
type=$1
|
||||
fi
|
||||
|
||||
case "$type" in
|
||||
prep*)
|
||||
exec ./devel/prepare
|
||||
;;
|
||||
xtest)
|
||||
exec /usr/bin/make -f devel/test.mak
|
||||
;;
|
||||
tags)
|
||||
exec ./devel/prepare tags
|
||||
;;
|
||||
esac
|
||||
|
||||
. run.cfg
|
||||
|
||||
basename=$(basename $(pwd))
|
||||
if echo $basename | grep -- - >/dev/null; then :; else
|
||||
dirs=${dirs:-php5-debug}
|
||||
svn propget svn:ignore . > .svnignore
|
||||
|
||||
dirs=${dirs:-php5-debug}
|
||||
for dir in $dirs; do
|
||||
mkdir -p ../${basename}-${dir}
|
||||
cd ../${basename}-${dir} || exit
|
||||
lndir ../${basename} > /dev/null
|
||||
|
||||
pwd
|
||||
$0 "$@"
|
||||
|
@ -29,16 +39,6 @@ phpbasename=${basename#*-}
|
|||
xcachebasename=${basename%%-*}
|
||||
xcachesrcdir=../$xcachebasename
|
||||
|
||||
rm -f php-src
|
||||
find -L . -type l | xargs rm -f
|
||||
lndir "$xcachesrcdir" >/dev/null
|
||||
find . -iname .\*.swp | xargs rm -f
|
||||
ln -sf ~/src/php/$phpbasename php-src
|
||||
for i in ~/src/php/$phpbasename/sapi/cgi/php{,-cgi}; do
|
||||
[[ -r $i ]] && ln -sf "$i" php-cgi
|
||||
done
|
||||
ln -sf ~/src/php/$phpbasename/sapi/cli/php php-cli
|
||||
|
||||
if [[ ! -z $1 ]]; then
|
||||
type=$1
|
||||
shift
|
||||
|
@ -46,10 +46,30 @@ if [[ ! -z $1 ]]; then
|
|||
if [[ ! -z $1 ]]; then
|
||||
args=("$@")
|
||||
elif [[ -z $args ]]; then
|
||||
args=(test.php)
|
||||
args=(devel.php)
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$type" in
|
||||
reb*)
|
||||
if [[ -r Makefile ]]; then
|
||||
make xcachesvnclean
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
rm -f php-src
|
||||
find -L . -type l | xargs rm -f
|
||||
lndir "$xcachesrcdir" >/dev/null
|
||||
find . -iname .\*.swp | xargs rm -f
|
||||
ln -sf ~/src/php/$phpbasename php-src
|
||||
for i in ~/src/php/$phpbasename/sapi/cgi/php{,-cgi}; do
|
||||
if [[ -r $i ]]; then
|
||||
ln -sf "$i" php-cgi
|
||||
fi
|
||||
done
|
||||
ln -sf ~/src/php/$phpbasename/sapi/cli/php php-cli
|
||||
|
||||
case "$type" in
|
||||
reb*)
|
||||
PHPDIRS=${PHPDIRS:-$HOME/test}
|
||||
|
@ -58,7 +78,6 @@ reb*)
|
|||
exit
|
||||
fi
|
||||
export PATH=$PHPDIRS/$phpbasename/bin:$PATH
|
||||
[[ -r Makefile ]] && make xcachesvnclean
|
||||
phpize --clean \
|
||||
&& phpize \
|
||||
&& CFLAGS="-Wall -Wno-unused -W -Wshadow -std=gnu99" ./configure --enable-xcache-disassembler --enable-xcache-test --enable-xcache-constant \
|
||||
|
@ -86,7 +105,7 @@ case "$basename" in
|
|||
exit 1
|
||||
;;
|
||||
*)
|
||||
cmd=(./php-cgi -q -c php.ini)
|
||||
cmd=(./php-cgi -q -c devel.ini)
|
||||
"${cmd[@]}" -v
|
||||
;;
|
||||
esac
|
||||
|
@ -115,10 +134,10 @@ val*)
|
|||
tracer=(valgrind --gen-suppressions=all)
|
||||
;;
|
||||
dc)
|
||||
exec ./php-cli -c php.ini ./bin/phpdc.phpr "${args[@]}" | tee decompiled.php
|
||||
exec ./php-cli -c devel.ini ./bin/phpdc.phpr "${args[@]}" | tee decompiled.php
|
||||
;;
|
||||
dop)
|
||||
exec ./php-cli -c php.ini ./bin/phpdop.phpr "${args[@]}"
|
||||
exec ./php-cli -c devel.ini ./bin/phpdop.phpr "${args[@]}"
|
||||
;;
|
||||
retest)
|
||||
exec make xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`"
|
||||
|
|
|
@ -3,19 +3,16 @@
|
|||
EXES=mem_test
|
||||
OBJS=mem.o
|
||||
CC=gcc
|
||||
CFLAGS=-g -O0 -D TEST -Wall
|
||||
CFLAGS=-g -O0 -I. -D TEST -Wall
|
||||
TEST=valgrind
|
||||
|
||||
all: mem
|
||||
|
||||
mem_test: mem.c
|
||||
$(CC) $(CFLAGS) -o mem_test mem.c
|
||||
mem_test: xcache/xc_mem.c xcache/xc_mem.h util/xc_trace.c util/xc_trace.h
|
||||
$(CC) $(CFLAGS) -o mem_test xcache/xc_mem.c util/xc_trace.c
|
||||
|
||||
mem: mem_test
|
||||
$(TEST) ./mem_test
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(EXES)
|
||||
|
||||
leakcheck:
|
||||
valgrind php -c test.ini test.ini
|
||||
|
|
|
@ -12,7 +12,7 @@ divert(0)
|
|||
#include "xcache.h"
|
||||
#include "util/xc_align.h"
|
||||
#include "xcache/xc_const_string.h"
|
||||
#include "xcache/xc_processor.h"
|
||||
#include "xc_processor.h"
|
||||
#include "xcache_globals.h"
|
||||
|
||||
#if defined(HARDENING_PATCH_HASH_PROTECT) && HARDENING_PATCH_HASH_PROTECT
|
||||
|
|
2
xcache.c
2
xcache.c
|
@ -44,7 +44,7 @@
|
|||
#endif
|
||||
|
||||
#include "xcache_globals.h"
|
||||
#include "xcache/xc_processor.h"
|
||||
#include "xc_processor.h"
|
||||
#include "xcache/xc_const_string.h"
|
||||
#include "xcache/xc_opcode_spec.h"
|
||||
#include "xcache/xc_utils.h"
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
#ifdef TEST
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
# include <limits.h>
|
||||
# include <stdio.h>
|
||||
# define XCACHE_DEBUG
|
||||
typedef int zend_bool;
|
||||
# define ZEND_ATTRIBUTE_PTR_FORMAT(a, b, c)
|
||||
# define zend_error(type, error) fprintf(stderr, "%s", error)
|
||||
#else
|
||||
#include <php.h>
|
||||
# include <php.h>
|
||||
#endif
|
||||
|
||||
#ifdef XCACHE_DEBUG
|
||||
|
@ -17,7 +20,7 @@
|
|||
#define XC_MEMBLOCK_IMPL _xc_mem_block_t
|
||||
#define XC_MEM_IMPL _xc_mem_mem_t
|
||||
#include "xc_shm.h"
|
||||
#include "xc_utils.h"
|
||||
// #include "xc_utils.h"
|
||||
#include "util/xc_align.h"
|
||||
#include "util/xc_trace.h"
|
||||
|
||||
|
@ -322,7 +325,12 @@ static XC_MEM_DESTROY(xc_mem_destroy) /* {{{ */
|
|||
#ifdef TEST
|
||||
/* {{{ testing */
|
||||
#undef CHECK
|
||||
#define CHECK(a, msg) do { if ((a) == NULL) { puts(msg); return -1; } } while (0)
|
||||
#define CHECK(a, msg) do { \
|
||||
if (!(a)) { \
|
||||
fprintf(stderr, "%s\n", msg); return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#include <time.h>
|
||||
|
||||
int main()
|
||||
|
@ -330,8 +338,8 @@ int main()
|
|||
int count = 0;
|
||||
void *p;
|
||||
void *memory;
|
||||
xc_mem_t *mem;
|
||||
void **ptrs;
|
||||
xc_mem_t mem_holder, *mem = &mem_holder;
|
||||
int size, i;
|
||||
|
||||
#if 0
|
||||
|
@ -341,10 +349,11 @@ int main()
|
|||
size = 100;
|
||||
#endif
|
||||
CHECK(memory = malloc(size), "OOM");
|
||||
CHECK(ptrs = malloc(size * sizeof(void*)), "OOM");
|
||||
CHECK(mem = xc_mem_init(memory, size), "Failed init memory allocator");
|
||||
CHECK(ptrs = malloc(size * sizeof(void *)), "OOM");
|
||||
CHECK(mem = xc_mem_init(memory, mem, size), "Failed init memory allocator");
|
||||
|
||||
while ((p = xc_mem_malloc(mem, 1))) {
|
||||
fprintf(stderr, "%d %p\n", count, ptrs);
|
||||
ptrs[count ++] = p;
|
||||
}
|
||||
fprintf(stderr, "count=%d, random freeing\n", count);
|
||||
|
|
|
@ -1 +1 @@
|
|||
#include "xc_processor_real.c"
|
||||
#include "../xc_processor.c.h"
|
||||
|
|
Loading…
Reference in New Issue