]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Inline ensure_valid. This improves reading the debug info of big executables
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 7 Jun 2015 10:38:39 +0000 (10:38 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 7 Jun 2015 10:38:39 +0000 (10:38 +0000)
by 1 to 2%

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15327

coregrind/m_debuginfo/image.c

index 819a77097ead5306b00e5ff3448d2a9964adac7b..00b61009fedb1d2299db71bacb0f210694442f53 100644 (file)
@@ -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);
 }