From: Mark Wielaard Date: Sun, 28 Feb 2021 23:26:00 +0000 (+0100) Subject: VG_(get_fnname_kind): Recognize gcc "optimized" below main functions. X-Git-Tag: VALGRIND_3_17_0~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24a94df7386ce4de56a9779bbb5a3214d20067af;p=thirdparty%2Fvalgrind.git VG_(get_fnname_kind): Recognize gcc "optimized" below main functions. The VG_(get_fnname_kind) function detects some special "below main" function names. Specifically __libc_start_main and generic_start_main both of which are used to call the actual main () function from the application. We already recognized one variant, generic_start_main.isra.0, but only for powerpc. Recognize all possibly specialed optimized variants gcc can produce by simply checking for the function name with dot as prefix. This fixes the memcheck/tests/supp_unknown.vgtest and massif/tests/deep-D.vgtest with gcc 11. We can now also get rid of the special cases in massif/tests/deep-D.post.exp-ppc64 and memcheck/tests/supp_unknown.supp. https://bugs.kde.org/show_bug.cgi?id=430158 --- diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 13e528e5df..c4a5ea593a 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -2286,10 +2286,9 @@ Vg_FnNameKind VG_(get_fnname_kind) ( const HChar* name ) } else if ( # if defined(VGO_linux) VG_STREQ("__libc_start_main", name) || // glibc glibness + VG_STREQN(18, "__libc_start_main.", name) || // gcc optimization VG_STREQ("generic_start_main", name) || // Yellow Dog doggedness -# if defined(VGA_ppc32) || defined(VGA_ppc64be) || defined(VGA_ppc64le) - VG_STREQ("generic_start_main.isra.0", name) || // ppc glibness -# endif + VG_STREQN(19, "generic_start_main.", name) || // gcc optimization # elif defined(VGO_darwin) // See readmacho.c for an explanation of this. VG_STREQ("start_according_to_valgrind", name) || // Darwin, darling diff --git a/massif/tests/deep-D.post.exp-ppc64 b/massif/tests/deep-D.post.exp-ppc64 deleted file mode 100644 index ce68e3bec2..0000000000 --- a/massif/tests/deep-D.post.exp-ppc64 +++ /dev/null @@ -1,55 +0,0 @@ --------------------------------------------------------------------------------- -Command: ./deep -Massif arguments: --stacks=no --time-unit=B --alloc-fn=a1 --alloc-fn=a2 --alloc-fn=a3 --alloc-fn=a4 --alloc-fn=a5 --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 --alloc-fn=main --depth=20 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element -ms_print arguments: massif.out --------------------------------------------------------------------------------- - - - KB -3.984^ : - | : - | @@@@@@@: - | @ : - | :::::::@ : - | : @ : - | :::::::: @ : - | : : @ : - | :::::::: : @ : - | : : : @ : - | :::::::: : : @ : - | : : : : @ : - | ::::::::: : : : @ : - | : : : : : @ : - | :::::::: : : : : @ : - | : : : : : : @ : - | :::::::: : : : : : @ : - | : : : : : : : @ : - | :::::::: : : : : : : @ : - | : : : : : : : : @ : - 0 +----------------------------------------------------------------------->KB - 0 3.984 - -Number of snapshots: 11 - Detailed snapshots: [9] - --------------------------------------------------------------------------------- - n time(B) total(B) useful-heap(B) extra-heap(B) stacks(B) --------------------------------------------------------------------------------- - 0 0 0 0 0 0 - 1 408 408 400 8 0 - 2 816 816 800 16 0 - 3 1,224 1,224 1,200 24 0 - 4 1,632 1,632 1,600 32 0 - 5 2,040 2,040 2,000 40 0 - 6 2,448 2,448 2,400 48 0 - 7 2,856 2,856 2,800 56 0 - 8 3,264 3,264 3,200 64 0 - 9 3,672 3,672 3,600 72 0 -98.04% (3,600B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc. -->98.04% (3,600B) 0x........: generic_start_main.isra.0 (in /...libc...) - ->98.04% (3,600B) 0x........: (below main) - --------------------------------------------------------------------------------- - n time(B) total(B) useful-heap(B) extra-heap(B) stacks(B) --------------------------------------------------------------------------------- - 10 4,080 4,080 4,000 80 0 diff --git a/memcheck/tests/supp_unknown.supp b/memcheck/tests/supp_unknown.supp index 00ea65ab44..50ef42595a 100644 --- a/memcheck/tests/supp_unknown.supp +++ b/memcheck/tests/supp_unknown.supp @@ -13,10 +13,3 @@ fun:main } -{ - - Memcheck:Jump - obj:* - fun:generic_start_main.isra.0 - fun:(below main) -}