From 2966b067cb2dce29a6f4089220ec89fa1808afb9 Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Fri, 24 Apr 2015 11:14:47 +0000 Subject: [PATCH] Implement --enable-debug. --- CMakeLists.txt | 3 +++ README | 5 ++++- config-cmake.h.in | 1 + configure.ac | 15 ++++++++++++++- doc/pcre2build.3 | 15 +++++++++++++-- maint/ManyConfigTests | 6 +++++- src/pcre2_jit_compile.c | 5 +++++ 7 files changed, 45 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 81e2fec..b76a953 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,7 @@ # 2013-10-08 PH got rid of the "source" command, which is a bash-ism (use ".") # 2013-11-05 PH added support for PARENS_NEST_LIMIT # 2014-08-29 PH converted the file for PCRE2 (which has no C++). +# 2015-04024 PH added support for PCRE2_DEBUG PROJECT(PCRE2 C) @@ -118,6 +119,8 @@ OPTION(PCRE2_BUILD_PCRE2_16 "Build 16 bit PCRE2 library" OFF) OPTION(PCRE2_BUILD_PCRE2_32 "Build 32 bit PCRE2 library" OFF) +OPTION(PCRE2_DEBUG "Include debugging code" OFF) + SET(PCRE2_EBCDIC OFF CACHE BOOL "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems.)") diff --git a/README b/README index 508fd1e..c7eb375 100644 --- a/README +++ b/README @@ -293,6 +293,9 @@ library. They are also documented in the pcre2build man page. both EBCDIC and UTF-8/16/32. There is a second option, --enable-ebcdic-nl25, which specifies that the code value for the EBCDIC NL character is 0x25 instead of the default 0x15. + +. If you specify --enable-debug, additional debugging code is included in the + build. This option is intended for use by the PCRE2 maintainers. . In environments where valgrind is installed, if you specify @@ -829,4 +832,4 @@ The distribution should contain the files listed below. Philip Hazel Email local part: ph10 Email domain: cam.ac.uk -Last updated: 26 January 2015 +Last updated: 24 April 2015 diff --git a/config-cmake.h.in b/config-cmake.h.in index 22d4bbe..b74a7aa 100644 --- a/config-cmake.h.in +++ b/config-cmake.h.in @@ -17,6 +17,7 @@ #cmakedefine SUPPORT_PCRE2_8 1 #cmakedefine SUPPORT_PCRE2_16 1 #cmakedefine SUPPORT_PCRE2_32 1 +#cmakedefine PCRE2_DEBUG 1 #cmakedefine SUPPORT_LIBBZ2 1 #cmakedefine SUPPORT_LIBEDIT 1 diff --git a/configure.ac b/configure.ac index 00ddc40..caf38e0 100644 --- a/configure.ac +++ b/configure.ac @@ -130,12 +130,18 @@ AC_ARG_ENABLE(pcre2-32, , enable_pcre2_32=unset) AC_SUBST(enable_pcre2_32) +# Handle --dnable-debug (disabled by default) +AC_ARG_ENABLE(debug, + AS_HELP_STRING([--enable-debug], + [enable debugging code]), + , enable_debug=no) + # Handle --enable-jit (disabled by default) AC_ARG_ENABLE(jit, AS_HELP_STRING([--enable-jit], [enable Just-In-Time compiling support]), , enable_jit=no) - + # Handle --disable-pcre2grep-jit (enabled by default) AC_ARG_ENABLE(pcre2grep-jit, AS_HELP_STRING([--disable-pcre2grep-jit], @@ -381,6 +387,7 @@ AC_CHECK_HEADERS([windows.h], [HAVE_WINDOWS_H=1]) AM_CONDITIONAL(WITH_PCRE2_8, test "x$enable_pcre2_8" = "xyes") AM_CONDITIONAL(WITH_PCRE2_16, test "x$enable_pcre2_16" = "xyes") AM_CONDITIONAL(WITH_PCRE2_32, test "x$enable_pcre2_32" = "xyes") +AM_CONDITIONAL(WITH_DEBUG, test "x$enable_debug" = "xyes") AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes") AM_CONDITIONAL(WITH_JIT, test "x$enable_jit" = "xyes") AM_CONDITIONAL(WITH_UNICODE, test "x$enable_unicode" = "xyes") @@ -504,6 +511,11 @@ if test "$enable_pcre2_32" = "yes"; then Define to any value to enable the 32 bit PCRE2 library.]) fi +if test "$enable_debug" = "yes"; then + AC_DEFINE([PCRE2_DEBUG], [], [ + Define to any value to include debugging code.]) +fi + # Unless running under Windows, JIT support requires pthreads. if test "$enable_jit" = "yes"; then @@ -864,6 +876,7 @@ $PACKAGE-$VERSION configuration summary: Build 8-bit pcre2 library ....... : ${enable_pcre2_8} Build 16-bit pcre2 library ...... : ${enable_pcre2_16} Build 32-bit pcre2 library ...... : ${enable_pcre2_32} + Include debugging code .......... : ${enable_debug} Enable JIT compiling support .... : ${enable_jit} Enable Unicode support .......... : ${enable_unicode} Newline char/sequence ........... : ${enable_newline} diff --git a/doc/pcre2build.3 b/doc/pcre2build.3 index e298321..de4590d 100644 --- a/doc/pcre2build.3 +++ b/doc/pcre2build.3 @@ -1,4 +1,4 @@ -.TH PCRE2BUILD 3 "13 April 2015" "PCRE2 10.20" +.TH PCRE2BUILD 3 "23 April 2015" "PCRE2 10.20" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) . @@ -410,6 +410,17 @@ automatically included, you may need to add something like immediately before the \fBconfigure\fP command. . . +.SH "INCLUDING DEBUGGING CODE" +.rs +.sp +If you add +.sp + --enable-debug +.sp +to the \fBconfigure\fP command, additional debugging code is included in the +build. This feature is intended for use by the PCRE2 maintainers. +. +. .SH "DEBUGGING WITH VALGRIND SUPPORT" .rs .sp @@ -499,6 +510,6 @@ Cambridge, England. .rs .sp .nf -Last updated: 13 April 2015 +Last updated: 24 April 2015 Copyright (c) 1997-2015 University of Cambridge. .fi diff --git a/maint/ManyConfigTests b/maint/ManyConfigTests index b2663b2..7cb7f1c 100755 --- a/maint/ManyConfigTests +++ b/maint/ManyConfigTests @@ -184,7 +184,7 @@ runtest() # Update the total count whenever a new test is added; it is used to show # progess as each test is run. -testtotal=`expr 20 \* $usemain + \ +testtotal=`expr 21 \* $usemain + \ 1 \* $usetmp + \ 1 \* $ISGCC \* $usemain + \ 1 \* $ISGCC \* $usemain \* $useasan + \ @@ -239,6 +239,10 @@ echo "---------- CFLAGS for the remaining tests ----------" echo "CFLAGS=$CFLAGS" if [ $usemain -ne 0 ]; then + echo "---------- Maximally configured test with --enable-debug ----------" + opts="--disable-shared $enable_jit --enable-pcre2-16 --enable-pcre2-32 --enable-debug" + runtest + echo "---------- Non-JIT tests in the current directory ----------" for opts in \ "" \ diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c index 067e82e..654f4b7 100644 --- a/src/pcre2_jit_compile.c +++ b/src/pcre2_jit_compile.c @@ -54,7 +54,12 @@ system files. */ #define SLJIT_CONFIG_AUTO 1 #define SLJIT_CONFIG_STATIC 1 #define SLJIT_VERBOSE 0 + +#ifdef PCRE2_DEBUG +#define SLJIT_DEBUG 1 +#else #define SLJIT_DEBUG 0 +#endif #define SLJIT_MALLOC(size, allocator_data) pcre2_jit_malloc(size, allocator_data) #define SLJIT_FREE(ptr, allocator_data) pcre2_jit_free(ptr, allocator_data)