diff --git a/lib/bcheck.c b/lib/bcheck.c index f609a228..2b78aa65 100644 --- a/lib/bcheck.c +++ b/lib/bcheck.c @@ -559,7 +559,9 @@ void * __bound_ptr_add(void *p, size_t offset) if (tree->is_invalid || addr + offset > tree->size) { POST_SEM (); if (print_warn_ptr_add) - bound_warning("%p is outside of the region", p + offset); + bound_warning("%p is outside of the region (0x%lx..0x%lx)", + p + offset, (long)tree->start, + (long)(tree->start + tree->size - 1)); if (never_fatal <= 0) return INVALID_POINTER; /* return an invalid pointer */ return p + offset; @@ -605,7 +607,9 @@ void * __bound_ptr_indir ## dsize (void *p, size_t offset) \ if (addr <= tree->size) { \ if (tree->is_invalid || addr + offset + dsize > tree->size) { \ POST_SEM (); \ - bound_warning("%p is outside of the region", p + offset); \ + bound_warning("%p is outside of the region (0x%lx..0x%lx)", \ + p + offset, (long)tree->start, \ + (long)(tree->start + tree->size - 1)); \ if (never_fatal <= 0) \ return INVALID_POINTER; /* return an invalid pointer */ \ return p + offset; \ @@ -1105,11 +1109,9 @@ add_bounds: while (p[0] != 0) { tree = splay_insert(p[0], p[1], tree); #if BOUND_DEBUG - if (print_calls) { - dprintf(stderr, "%s, %s(): static var %p 0x%lx\n", - __FILE__, __FUNCTION__, - (void *) p[0], (unsigned long) p[1]); - } + dprintf(stderr, "%s, %s(): static var %p 0x%lx\n", + __FILE__, __FUNCTION__, + (void *) p[0], (unsigned long) p[1]); #endif p += 2; } diff --git a/tests/tests2/126_bound_global.expect b/tests/tests2/126_bound_global.expect index fcdea900..969c20aa 100644 --- a/tests/tests2/126_bound_global.expect +++ b/tests/tests2/126_bound_global.expect @@ -1,2 +1,2 @@ -126_bound_global.c:11: at main: BCHECK: ........ is outside of the region +126_bound_global.c:11: at main: BCHECK: ........ is outside of the region (..................) 126_bound_global.c:11: at main: RUNTIME ERROR: invalid memory access