diff --git i/src/.gdbinit w/src/.gdbinit index a4e9f70..d17d1ba 100644 --- i/src/.gdbinit +++ w/src/.gdbinit @@ -1280,3 +1280,22 @@ commands end continue end + +# bug 24315 +break re_match_2_internal if (size2>2000 && size2==stop) +commands + p debug = 1 + continue +end +break debug_spot +commands + watch -l string1[0] + disable 4 + # cond 4 (string1[0] != 'D') + # continue +end +# break debug_malloc if ((mem <= 0x1834980) && (0x1834980 < mem + size)) + + + + diff --git i/src/gmalloc.c w/src/gmalloc.c index 00b8364..5084609 100644 --- i/src/gmalloc.c +++ w/src/gmalloc.c @@ -914,6 +914,10 @@ _malloc_internal_nolock (size_t size) return result; } +void debug_malloc (void* mem, size_t size) +{ +} + void * _malloc_internal (size_t size) { @@ -923,6 +927,7 @@ _malloc_internal (size_t size) result = _malloc_internal_nolock (size); UNLOCK (); + debug_malloc (result, size); return result; } diff --git i/src/regex.c w/src/regex.c index 164eb46..861b800 100644 --- i/src/regex.c +++ w/src/regex.c @@ -828,6 +828,7 @@ extract_number_and_incr (re_char **source) interactively. And if linked with the main program in `main.c' and the other test files, you can run the already-written tests. */ +#define DEBUG #ifdef DEBUG /* We use standard I/O for debugging. */ @@ -838,6 +839,13 @@ extract_number_and_incr (re_char **source) static int debug = -100000; +static void debug_spot (int fail_stack_avail, const char*string1, const char*string2) +{ + extern void r_alloc_check (void); + //r_alloc_check (); + fail_stack_avail++; +} + # define DEBUG_STATEMENT(e) e # define DEBUG_PRINT(...) if (debug > 0) printf (__VA_ARGS__) # define DEBUG_COMPILES_ARGUMENTS @@ -1172,16 +1180,31 @@ print_double_string (re_char *where, re_char *string1, ssize_t size1, printf ("(null)"); else { + int i; if (FIRST_STRING_P (where)) { - for (this_char = where - string1; this_char < size1; this_char++) - putchar (string1[this_char]); + for (i = 0, this_char = where - string1; this_char < size1; i++, this_char++) + { + if (i > 20) + { + putchar ('.'); putchar ('.'); putchar ('.'); + break; + } + putchar (string1[this_char]); + } where = string2; } - for (this_char = where - string2; this_char < size2; this_char++) - putchar (string2[this_char]); + for (i = 0, this_char = where - string2; this_char < size2; i++, this_char++) + { + if (i > 20) + { + putchar ('.'); putchar ('.'); putchar ('.'); + break; + } + putchar (string2[this_char]); + } } } @@ -1533,6 +1556,7 @@ while (REMAINING_AVAIL_SLOTS <= space) { \ of 0 + -1 isn't done as unsigned. */ \ \ DEBUG_STATEMENT (nfailure_points_pushed++); \ + if (debug > 0) debug_spot((fail_stack).avail, string1,string2); \ DEBUG_PRINT ("\nPUSH_FAILURE_POINT:\n"); \ DEBUG_PRINT (" Before push, next avail: %zd\n", (fail_stack).avail); \ DEBUG_PRINT (" size: %zd\n", (fail_stack).size);\