From 8f30180df2f201a7d2a4e960ddc382a9596fbc5e Mon Sep 17 00:00:00 2001 From: Philippe Waroquiers Date: Sun, 7 Jun 2015 10:38:39 +0000 Subject: [PATCH] Inline ensure_valid. This improves reading the debug info of big executables by 1 to 2% git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15327 --- coregrind/m_debuginfo/image.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/coregrind/m_debuginfo/image.c b/coregrind/m_debuginfo/image.c index 819a77097e..00b61009fe 100644 --- a/coregrind/m_debuginfo/image.c +++ b/coregrind/m_debuginfo/image.c @@ -798,6 +798,20 @@ inline Bool ML_(img_valid)(const DiImage* img, DiOffT offset, SizeT size) return img->size > 0 && offset + size <= (DiOffT)img->size; } +__attribute__((noinline)) +static void ensure_valid_failed (const DiImage* img, DiOffT offset, SizeT size, + const HChar* caller) +{ + VG_(umsg)("Valgrind: debuginfo reader: ensure_valid failed:\n"); + VG_(umsg)("Valgrind: during call to %s\n", caller); + VG_(umsg)("Valgrind: request for range [%llu, +%llu) exceeds\n", + (ULong)offset, (ULong)size); + VG_(umsg)("Valgrind: valid image size of %llu for image:\n", + (ULong)img->size); + VG_(umsg)("Valgrind: \"%s\"\n", img->source.name); + give_up__image_overrun(); +} + /* Check the given range is valid, and if not, shut down the system. An invalid range would imply that we're trying to read outside the image, which normally means the image is corrupted somehow, or the @@ -808,14 +822,8 @@ static void ensure_valid(const DiImage* img, DiOffT offset, SizeT size, { if (LIKELY(ML_(img_valid)(img, offset, size))) return; - VG_(umsg)("Valgrind: debuginfo reader: ensure_valid failed:\n"); - VG_(umsg)("Valgrind: during call to %s\n", caller); - VG_(umsg)("Valgrind: request for range [%llu, +%llu) exceeds\n", - (ULong)offset, (ULong)size); - VG_(umsg)("Valgrind: valid image size of %llu for image:\n", - (ULong)img->size); - VG_(umsg)("Valgrind: \"%s\"\n", img->source.name); - give_up__image_overrun(); + else + ensure_valid_failed(img, offset, size, caller); } -- 2.47.3