]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
When merging multiple symbols with the same address, rather than always
authorJeremy Fitzhardinge <jeremy@valgrind.org>
Mon, 15 Dec 2003 09:00:21 +0000 (09:00 +0000)
committerJeremy Fitzhardinge <jeremy@valgrind.org>
Mon, 15 Dec 2003 09:00:21 +0000 (09:00 +0000)
choosing the longest symbol, choose the longest ignoring any of the libc
junk prefixes like __libc_, __, __GI_*, etc.  This makes the symbol
presented to the user in messages and used in *.supp files more consistent
and comprehensible.

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

17 files changed:
corecheck/tests/fdleak_cmsg.stderr.exp
corecheck/tests/fdleak_creat.stderr.exp
corecheck/tests/fdleak_dup.stderr.exp
corecheck/tests/fdleak_dup2.stderr.exp
corecheck/tests/fdleak_fcntl.stderr.exp
corecheck/tests/fdleak_ipv4.stderr.exp
corecheck/tests/fdleak_open.stderr.exp
corecheck/tests/fdleak_pipe.stderr.exp
corecheck/tests/fdleak_socketpair.stderr.exp
coregrind/vg_symtab2.c
glibc-2.1.supp
glibc-2.2.supp
glibc-2.3.supp
helgrind/tests/deadlock.stderr.exp
memcheck/tests/fwrite.stderr.exp
memcheck/tests/weirdioctl.stderr.exp
memcheck/tests/writev.stderr.exp

index 8d7f2fee8b04f07012083a98edad2a4635e2578d..512fda04233325ad39b16ec8930097b8e33289c7 100644 (file)
@@ -2,19 +2,19 @@
 
 FILE DESCRIPTORS: 7 open at exit.
 Open AF_UNIX socket .: /tmp/sock
-   at 0x........: __libc_accept (...libc...)
+   at 0x........: accept (in /...libc...)
    by 0x........: main (fdleak_cmsg.c:170)
 
 Open AF_UNIX socket .: /tmp/sock
-   at 0x........: __socket (in /...libc...)
+   at 0x........: socket (in /...libc...)
    by 0x........: main (fdleak_cmsg.c:170)
 
 Open file descriptor .: /tmp/data2
-   at 0x........: __libc_open (...libc...)
+   at 0x........: open (in /...libc...)
    by 0x........: main (fdleak_cmsg.c:170)
 
 Open file descriptor .: /tmp/data1
-   at 0x........: __libc_open (...libc...)
+   at 0x........: open (in /...libc...)
    by 0x........: main (fdleak_cmsg.c:170)
 
 Open file descriptor .: .
@@ -31,15 +31,15 @@ ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
 
 FILE DESCRIPTORS: 6 open at exit.
 Open file descriptor .: /tmp/data2
-   at 0x........: __libc_recvmsg (...libc...)
+   at 0x........: recvmsg (in /...libc...)
    by 0x........: main (fdleak_cmsg.c:174)
 
 Open file descriptor .: /tmp/data1
-   at 0x........: __libc_recvmsg (...libc...)
+   at 0x........: recvmsg (in /...libc...)
    by 0x........: main (fdleak_cmsg.c:174)
 
 Open AF_UNIX socket .: <unknown>
-   at 0x........: __socket (in /...libc...)
+   at 0x........: socket (in /...libc...)
    by 0x........: main (fdleak_cmsg.c:174)
 
 Open file descriptor .: .
index 2b2d0fdb94fa71c45b19bed0dad8655800e5eeed..66bcc392ffbea2d417fc6d6269652ca5b1c4522c 100644 (file)
@@ -3,7 +3,7 @@
 FILE DESCRIPTORS: 4 open at exit.
 Open file descriptor .: /tmp/file
 
-   at 0x........: __libc_creat (...libc...)
+   at 0x........: creat (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
index 554e023ef60f253ddffe72b852384330a4790379..3fe6ffb0198e2a09f5de234ff0fcbb49ddb58ea1 100644 (file)
@@ -2,12 +2,12 @@
 
 FILE DESCRIPTORS: 5 open at exit.
 Open file descriptor .: /dev/null
-   at 0x........: __dup (in /...libc...)
+   at 0x........: dup (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
 Open file descriptor .: /dev/null
-   at 0x........: __libc_open (...libc...)
+   at 0x........: open (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
index 6c811ce383f5f51ea73d5f1d0f7d49285e4a84ce..81eb342062a66e5b04df86b31974192484a855f8 100644 (file)
@@ -2,17 +2,17 @@
 
 FILE DESCRIPTORS: 6 open at exit.
 Open file descriptor .: /dev/null
-   at 0x........: __dup2 (in /...libc...)
+   at 0x........: dup2 (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
 Open file descriptor .: /dev/null
-   at 0x........: __dup2 (in /...libc...)
+   at 0x........: dup2 (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
 Open file descriptor .: /dev/null
-   at 0x........: __libc_open (...libc...)
+   at 0x........: open (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
index 3e2a22531be623750123cabf91036cc27cd610ef..12faca7379e99d946c63334feef9c3ae71659648 100644 (file)
@@ -2,11 +2,11 @@
 
 FILE DESCRIPTORS: 5 open at exit.
 Open file descriptor .: /dev/null
-   at 0x........: __libc_fcntl (...libc...)
+   at 0x........: fcntl (in /...libc...)
    by 0x........: main (fdleak_fcntl.c:18)
 
 Open file descriptor .: /dev/null
-   at 0x........: __libc_open (...libc...)
+   at 0x........: open (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
index b3e88b11158e95288f5de4ba01f517d35a20db7a..374960ca5f0018316eb2a195da8334da409b4656 100644 (file)
@@ -2,11 +2,11 @@
 
 FILE DESCRIPTORS: 5 open at exit.
 Open AF_INET socket 4: 127.0.0.1:... <-> 127.0.0.1:...
-   at 0x........: __libc_accept (...libc...)
+   at 0x........: accept (in /...libc...)
    by 0x........: main (fdleak_ipv4.c:100)
 
 Open AF_INET socket 3: 127.0.0.1:... <-> unbound
-   at 0x........: __socket (in /...libc...)
+   at 0x........: socket (in /...libc...)
    by 0x........: main (fdleak_ipv4.c:100)
 
 Open file descriptor .: .
@@ -23,7 +23,7 @@ ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
 
 FILE DESCRIPTORS: 4 open at exit.
 Open AF_INET socket 3: 127.0.0.1:... <-> 127.0.0.1:...
-   at 0x........: __socket (in /...libc...)
+   at 0x........: socket (in /...libc...)
    by 0x........: main (fdleak_ipv4.c:104)
 
 Open file descriptor .: .
index 85d67ae26bfb837405860fb2827848884d20915d..f24a5effe5cae3c6847417b49138d5b7381f8efa 100644 (file)
@@ -2,7 +2,7 @@
 
 FILE DESCRIPTORS: 4 open at exit.
 Open file descriptor .: /dev/null
-   at 0x........: __libc_open (...libc...)
+   at 0x........: open (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
index 41f9d8fd510e989249c988260a7f0262220c5e9b..4ac5afc022de7e5fa830d8f6c3efd312206c0560 100644 (file)
@@ -2,12 +2,12 @@
 
 FILE DESCRIPTORS: 5 open at exit.
 Open file descriptor .:
-   at 0x........: __pipe (in /...libc...)
+   at 0x........: pipe (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
 Open file descriptor .:
-   at 0x........: __pipe (in /...libc...)
+   at 0x........: pipe (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
index a63e4d644d8c1a0e753b1e5bdc716ff0b430ad51..a60040ba5715826c95c44d9749c7eb29f381c6eb 100644 (file)
@@ -2,12 +2,12 @@
 
 FILE DESCRIPTORS: 5 open at exit.
 Open AF_UNIX socket .: <unknown>
-   at 0x........: __socketpair (in /...libc...)
+   at 0x........: socketpair (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
 Open AF_UNIX socket .: <unknown>
-   at 0x........: __socketpair (in /...libc...)
+   at 0x........: socketpair (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
 
index de7ee53b6704a9bafb2cc92562580dbf510139df..5dd363e9a4ac52dca19fd9f7d843943a3de7b2a6 100644 (file)
@@ -398,6 +398,46 @@ static Int compare_RiSym(void *va, void *vb) {
    return a->addr - b->addr;
 }
 
+/* Two symbols have the same address.  Which name do we prefer?
+
+   In general we prefer the longer name, but if the choice is between
+   __libc_X and X, then choose X (similarly with __GI__ and __
+   prefixes).
+ */
+static RiSym *prefersym(RiSym *a, RiSym *b)
+{
+   Int pfx;
+
+   /* rearrange so that a is the long one */
+   if (VG_(strlen)(a->name) < VG_(strlen)(b->name)) {
+      RiSym *t;
+
+      t = a;
+      a = b;
+      b = t;
+   }
+
+   pfx = 0;
+   
+   if      (VG_(memcmp)(a->name, "__GI___libc_", 12) == 0)
+      pfx = 12;
+   else if (VG_(memcmp)(a->name, "__libc_", 7) == 0)
+      pfx = 7;
+   else if (VG_(memcmp)(a->name, "__GI___", 7) == 0)
+      pfx = 7;
+   else if (VG_(memcmp)(a->name, "__GI__", 6) == 0)
+      pfx = 6;
+   else if (VG_(memcmp)(a->name, "__GI_", 5) == 0)
+      pfx = 5;
+   else if (VG_(memcmp)(a->name, "__", 2) == 0)
+      pfx = 2;
+
+   if (pfx != 0 && VG_(strcmp)(a->name + pfx, b->name) == 0)
+      return b;
+
+   return a;
+}
+
 static 
 void canonicaliseSymtab ( SegInfo* si )
 {
@@ -427,12 +467,7 @@ void canonicaliseSymtab ( SegInfo* si )
              && si->symtab[i].size   == si->symtab[i+1].size) {
             n_merged++;
             /* merge the two into one */
-            if (VG_(strlen)(si->symtab[i].name) 
-                > VG_(strlen)(si->symtab[i+1].name)) {
-               si->symtab[si->symtab_used++] = si->symtab[i];
-            } else {
-               si->symtab[si->symtab_used++] = si->symtab[i+1];
-            }
+           si->symtab[si->symtab_used++] = *prefersym(&si->symtab[i], &si->symtab[i+1]);
             i++;
          } else {
             si->symtab[si->symtab_used++] = si->symtab[i];
index b318e202f902d611af439a08629daf00ab74754e..c7d778a6befa3ab9f105d7e65a0e45dfcc3154d2 100644 (file)
 ##----------------------------------------------------------------------##
 
 {
-   __pthread_mutex_unlock/__register_frame_info_bases
+   pthread_mutex_unlock/__register_frame_info_bases
    core:PThread
-   fun:__pthread_mutex_unlock
+   fun:pthread_mutex_unlock
    fun:__register_frame_info_bases
 }
 
 {
-   socketcall.connect(serv_addr)/__libc_connect/*(Param)
+   socketcall.connect(serv_addr)/connect/*(Param)
    Addrcheck,Memcheck:Param
    socketcall.connect(serv_addr)
-   fun:__libc_connect
+   fun:connect
    fun:*
 }
 
 }
 
 {
-   llseek(result)/__libc_lseek64/_IO_file_seek(Param)
+   llseek(result)/lseek64/_IO_file_seek(Param)
    Addrcheck,Memcheck:Param
    llseek(result)
-   fun:__libc_lseek64
+   fun:lseek64
    fun:_IO_file_seek
 }
 
 }
 
 {
-   socketcall.connect(serv_addr)/__libc_connect/*(Param)
+   socketcall.connect(serv_addr)/connect/*(Param)
    Addrcheck,Memcheck:Param
    socketcall.connect(serv_addr)
    obj:*libc-2.1.3.so
 ##----------------------------------------------------------------------##
 ## For a leak in Valgrind's own libpthread.so :(
 {
-   my_malloc/get_or_allocate_specifics_ptr/__pthread_key_create(Leak)
+   my_malloc/get_or_allocate_specifics_ptr/pthread_key_create(Leak)
    Memcheck:Leak
    fun:my_malloc
    fun:get_or_allocate_specifics_ptr
-   fun:__pthread_key_create
+   fun:pthread_key_create
 }
 
index afc65c3407cd223df28ab87a3bd20520e10ca3a0..ff1a9bdce61a0fca394ee596632ddb2a91e6b369 100644 (file)
 #-------- Threading bugs?
 # glibc 'knows' that destroying a locked mutex will unlock it
 {
-   pthread_error/__pthread_mutex_destroy/__closedir
+   pthread_error/pthread_mutex_destroy/__closedir
    core:PThread
    fun:pthread_error
-   fun:__pthread_mutex_destroy
+   fun:pthread_mutex_destroy
    fun:__closedir
 }
 
 {
-   pthread_error/__pthread_mutex_destroy/_IO_default_finish
+   pthread_error/pthread_mutex_destroy/_IO_default_finish
    core:PThread
    fun:pthread_error
-   fun:__pthread_mutex_destroy
+   fun:pthread_mutex_destroy
    fun:_IO_default_finish*
 }
 
 {
-   __pthread_mutex_unlock/_IO_funlockfile
+   pthread_mutex_unlock/_IO_funlockfile
    core:PThread
-   fun:__pthread_mutex_unlock
+   fun:pthread_mutex_unlock
    fun:_IO_funlockfile
 }
 
 
 #-------------------
 {
-   socketcall.connect(serv_addr)/__libc_connect/*
+   socketcall.connect(serv_addr)/connect/*
    Addrcheck,Memcheck:Param
    socketcall.connect(serv_addr)
-   fun:__libc_connect
+   fun:connect
    fun:*
 }
 {
 
 #----------------------
 {
-   write(buf)/__libc_write/libX11.so.6.2/libX11.so.6.2(Param)
+   write(buf)/write/libX11.so.6.2/libX11.so.6.2(Param)
    Addrcheck,Memcheck:Param
    write(buf)
-   fun:__libc_write
+   fun:write
    obj:/usr/X11R6/lib/libX11.so.6.2
    obj:/usr/X11R6/lib/libX11.so.6.2
 }
 }
 
 #{
-#   llseek(result)/__libc_lseek64/_IO_file_seek(Param)
+#   llseek(result)/lseek64/_IO_file_seek(Param)
 #   Param
 #   llseek(result)
-#   fun:__libc_lseek64
+#   fun:lseek64
 #   fun:_IO_file_seek
 #}
 
 ##----------------------------------------------------------------------##
 ## For a leak in Valgrind's own libpthread.so :(
 {
-   my_malloc/get_or_allocate_specifics_ptr/__pthread_key_create(Leak)
+   my_malloc/get_or_allocate_specifics_ptr/pthread_key_create(Leak)
    Memcheck:Leak
    fun:my_malloc
    fun:get_or_allocate_specifics_ptr
-   fun:__pthread_key_create
+   fun:pthread_key_create
 }
 
 
index 72b346a4fb4752ba9ea2550383682e3e44bef74d..7e1f34c51e30b9a68bd2faa05ad8aaeefed9e8e7 100644 (file)
    fun:dl_open_worker
 }
 
+#-------- glibc 2.3.2/ Fedora Core 1
+{
+   dl_relocate/dl_main
+   Memcheck:Cond
+   fun:_dl_relocate_object_internal
+   fun:dl_main
+}
+
+#-------- Data races
+{
+   _dl_lookup_symbol_internal/fixup/_dl_runtime_resolve
+   Helgrind:Eraser
+   fun:_dl_lookup_symbol_internal
+   fun:fixup
+   fun:_dl_runtime_resolve
+}
+{
+   _dl_lookup_versioned_symbol_internal/fixup/_dl_runtime_resolve
+   Helgrind:Eraser
+   fun:_dl_lookup_versioned_symbol_internal
+   fun:fixup
+   fun:_dl_runtime_resolve
+}
 
 #-------- Threading bugs?
 # glibc 'knows' that destroying a locked mutex will unlock it
 {
-   pthread_error/__pthread_mutex_destroy/__closedir
+   pthread_error/pthread_mutex_destroy/__closedir
    core:PThread
    fun:pthread_error
-   fun:__pthread_mutex_destroy
+   fun:pthread_mutex_destroy
    fun:__closedir
 }
 
 {
-   pthread_error/__pthread_mutex_destroy/_IO_default_finish
+   pthread_error/pthread_mutex_destroy/_IO_default_finish
    core:PThread
    fun:pthread_error
-   fun:__pthread_mutex_destroy
+   fun:pthread_mutex_destroy
    fun:_IO_default_finish*
 }
 
 {
-   __pthread_mutex_unlock/_IO_funlockfile
+   pthread_mutex_unlock/_IO_funlockfile
    core:PThread
-   fun:__pthread_mutex_unlock
+   fun:pthread_mutex_unlock
    fun:_IO_funlockfile
 }
 
 ##----------------------------------------------------------------------##
 ## For a leak in Valgrind's own libpthread.so :(
 {
-   my_malloc/get_or_allocate_specifics_ptr/__pthread_key_create(Leak)
+   my_malloc/get_or_allocate_specifics_ptr/pthread_key_create(Leak)
    Memcheck:Leak
    fun:my_malloc
    fun:get_or_allocate_specifics_ptr
-   fun:__pthread_key_create
+   fun:pthread_key_create
 }
 
 ##----------------------------------------------------------------------##
index a60d08713df141a724eeb6dbd96c78a9e87ea910..050d0087893cb02cbc2bcebdc7f5b2178f9c7303 100644 (file)
@@ -1,13 +1,13 @@
 
 Thread 3:
 Mutex 0x........(m1) locked in inconsistent order
-   at 0x........: __pthread_mutex_lock (vg_libpthread.c:...)
+   at 0x........: pthread_mutex_lock (vg_libpthread.c:...)
    by 0x........: t2 (deadlock.c:20)
    by 0x........: thread_wrapper (vg_libpthread.c:...)
    by 0x........: do__quit (vg_scheduler.c:...)
  while holding locks 0x........(m2)
  0x........(m2) last locked at
-   at 0x........: __pthread_mutex_lock (vg_libpthread.c:...)
+   at 0x........: pthread_mutex_lock (vg_libpthread.c:...)
    by 0x........: t2 (deadlock.c:19)
    by 0x........: thread_wrapper (vg_libpthread.c:...)
    by 0x........: do__quit (vg_scheduler.c:...)
index 4cf2593c2ebba7711dfdaf63df081ab100ea0d00..76f922190ac2f16d7b45c8572439167f48380bdc 100644 (file)
@@ -1,5 +1,5 @@
 Syscall param write(buf) contains uninitialised or unaddressable byte(s)
-   at 0x........: __libc_write (...libc...)
+   at 0x........: write (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
  Address 0x........ is 0 bytes inside a block of size 10 alloc'd
index 42ea90a2ebcfb98e89ce82d4f71ae0442a1311c3..37a24aac15a54f863642102a4babdfc322370d26 100644 (file)
@@ -1,5 +1,5 @@
 Syscall param ioctl(TCSET{A,AW,AF}) contains uninitialised or unaddressable byte(s)
-   at 0x........: __ioctl (in /...libc...)
+   at 0x........: ioctl (in /...libc...)
    by 0x........: __libc_start_main (...libc...)
    by 0x........: ...
  Address 0x........ is on thread 1's stack
index acbd5f3c260662c2f73fa04341cc7302920e4858..e2347325ebd196fd722ce6b5c5dfdcf568baba0b 100644 (file)
@@ -1,19 +1,19 @@
 
 Test file created.
 Syscall param writev(vector[...]) contains uninitialised or unaddressable byte(s)
-   at 0x........: __libc_writev (...libc...)
+   at 0x........: writev (in /...libc...)
    by 0x........: main (writev.c:56)
  Address 0x........ is not stack'd, malloc'd or free'd
 Received EFAULT as expected
 
 Syscall param writev(vector) contains uninitialised or unaddressable byte(s)
-   at 0x........: __libc_writev (...libc...)
+   at 0x........: writev (in /...libc...)
    by 0x........: main (writev.c:68)
  Address 0x........ is not stack'd, malloc'd or free'd
 Received EINVAL as expected
 
 Syscall param readv(vector) contains uninitialised or unaddressable byte(s)
-   at 0x........: __libc_readv (...libc...)
+   at 0x........: readv (in /...libc...)
    by 0x........: main (writev.c:76)
  Address 0x........ is not stack'd, malloc'd or free'd
 Received EINVAL as expected