]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
VG_(get_fnname_kind): Recognize gcc "optimized" below main functions.
authorMark Wielaard <mark@klomp.org>
Sun, 28 Feb 2021 23:26:00 +0000 (00:26 +0100)
committerMark Wielaard <mark@klomp.org>
Sun, 28 Feb 2021 23:26:00 +0000 (00:26 +0100)
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

coregrind/m_debuginfo/debuginfo.c
massif/tests/deep-D.post.exp-ppc64 [deleted file]
memcheck/tests/supp_unknown.supp

index 13e528e5dfafe34a38bb26c338594bcb0573c6e7..c4a5ea593a31ff4ea2cc884fbdf52ec7f99eb5be 100644 (file)
@@ -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 (file)
index ce68e3b..0000000
+++ /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
index 00ea65ab444eb859e5c5c3ced9c45c2c1a04100a..50ef42595a49a2fcfb761c7b3882ea01bcc08520 100644 (file)
    fun:main
 }
 
-{
-   <insert_a_suppression_name_here>
-   Memcheck:Jump
-   obj:*
-   fun:generic_start_main.isra.0
-   fun:(below main)
-}