Bug 185801 - exp-ptrcheck: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
Summary: exp-ptrcheck: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
Status: RESOLVED UNMAINTAINED
Alias: None
Product: valgrind
Classification: Developer tools
Component: sgcheck (show other bugs)
Version: 3.4 SVN
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: wanted3.6.0
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-28 14:55 UTC by Arvid Norlander
Modified: 2020-10-28 11:04 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arvid Norlander 2009-02-28 14:55:42 UTC
It seems that using sinf() causes the warning:
 evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
With -v there is also:
 warning: addVar: unknown size (__EH_FRAME_BEGIN__)

Only exp-ptrcheck seems to be affected.

A simple test case is included below.


System info
-----------
The test case was compiled with GCC 4.1.2 on Gentoo Linux x86_64.
Glibc 2.8_p20080602-r1.
Valgrind was compiled from VALGRIND_3_4_BRANCH revision 9293.
$ gcc --version
gcc (GCC) 4.1.2 20070214 (  (gdc 0.24, using dmd 1.020)) (Gentoo 4.1.2 p1.1)
$ uname -a
Linux tux.lan 2.6.27-gentoo-r8-1 #1 Sat Jan 31 04:55:36 CET 2009 x86_64 AMD Sempron(tm) Processor 3300+ AuthenticAMD GNU/Linux


Test case
---------
$ cat test.c
#include <stdio.h>
#include <math.h>
int main(void) {
    printf("%f\n", sinf(23));
    return 0;
}
$ gcc -std=c99 -O0 -ggdb3 test.c -lm
$ ~/local/valgrind/bin/valgrind -v --tool=exp-ptrcheck ./a.out
==14661== exp-ptrcheck, a heap, stack & global array overrun detector.
==14661== NOTE: This is an Experimental-Class Valgrind Tool.
==14661== Copyright (C) 2003-2008, and GNU GPL'd, by OpenWorks Ltd et al.
==14661== Using LibVEX rev 1883, a library for dynamic binary translation.
==14661== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==14661== Using valgrind-3.4.1.SVN, a dynamic binary instrumentation framework.
==14661== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==14661==
--14661-- Command line
--14661--    ./a.out
--14661-- Startup, with flags:
--14661--    -v
--14661--    --tool=exp-ptrcheck
--14661-- Contents of /proc/version:
--14661--   Linux version 2.6.27-gentoo-r8-1 (root@tux.lan) (gcc version 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) (Gentoo 4.1.2 p1.1)) #1 Sat Jan 31 04:55:36 CET 2009
--14661-- Arch and hwcaps: AMD64, amd64-sse2
--14661-- Page sizes: currently 4096, max supported 4096
--14661-- Valgrind library directory: /home/arvid/local/valgrind/lib/valgrind
--14661-- Reading syms from /home/arvid/src/cfunge/trunk/build/a.out (0x400000)
--14661-- Reading syms from /home/arvid/local/valgrind/lib/valgrind/amd64-linux/exp-ptrcheck (0x38000000)
--14661--    object doesn't have a dynamic symbol table
--14661-- Reading syms from /lib64/ld-2.8.so (0x3377a00000)
--14661-- Reading debug info from /usr/lib/debug/lib64/ld-2.8.so.debug ..
--14661-- Reading suppressions file: /home/arvid/local/valgrind/lib/valgrind/default.supp
--14661-- Reading syms from /home/arvid/local/valgrind/lib/valgrind/amd64-linux/vgpreload_core.so (0x4802000)
--14661-- Reading syms from /home/arvid/local/valgrind/lib/valgrind/amd64-linux/vgpreload_exp-ptrcheck.so (0x4a04000)
--14661-- Reading syms from /lib64/libm-2.8.so (0x3378200000)
--14661-- Reading debug info from /usr/lib/debug/lib64/libm-2.8.so.debug ..
--14661-- Reading syms from /lib64/libc-2.8.so (0x3377e00000)
--14661-- Reading debug info from /usr/lib/debug/lib64/libc-2.8.so.debug ..
--14661-- warning: addVar: unknown size (__EH_FRAME_BEGIN__)
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
--14661-- REDIR: 0x3377e784f0 (strlen) redirected to 0x4a07a30 (strlen)
-0.846220
==14661==
==14661== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
--14661--   h_:           0 client allocs,          0 client frees
--14661--   h_:           0 Segs allocd,            0 Segs recycled
--14661--  sg_:  49,560 total accesses, of which:
--14661--  sg_:     stack0:           90 classify
--14661--  sg_:     stackN:            0 classify
--14661--  sg_:     global:            0 classify
--14661--  sg_:    unknown:        3,725 classify
--14661--  sg_:  0 Invars preened, of which 0 changed
--14661--  sg_:   t_i_b_MT:       45,431
--14661--  sg_:     qcache: 49,470 searches, 52,232 probes, 3,725 misses
--14661--  sg_:  htab-fast: 39,456 hits
--14661--  sg_:  htab-slow: 10,104 searches, 24,763 probes, 392 resizes
--14661-- translate:            fast SP updates identified: 0 (  0.0%)
--14661-- translate:   generic_known SP updates identified: 98 ( 61.2%)
--14661-- translate: generic_unknown SP updates identified: 62 ( 38.7%)
--14661--     tt/tc: 3,652 tt lookups requiring 3,681 probes
--14661--     tt/tc: 3,652 fast-cache updates, 2 flushes
--14661--  transtab: new        1,822 (36,847 -> 1,053,051; ratio 285:10) [0 scs]
--14661--  transtab: dumped     0 (0 -> ??)
--14661--  transtab: discarded  0 (0 -> ??)
--14661-- scheduler: 26,125 jumps (bb entries).
--14661-- scheduler: 0/1,883 major/minor sched events.
--14661--    sanity: 1 cheap, 1 expensive checks.
--14661--    exectx: 1,543 lists, 1,082 contexts (avg 0 per list)
--14661--    exectx: 1,158 searches, 658 full compares (568 per 1000)
--14661--    exectx: 0 cmp2, 0 cmp4, 0 cmpAll
--14661--  errormgr: 0 supplist searches, 0 comparisons during search
--14661--  errormgr: 0 errlist searches, 0 comparisons during search


I have no idea how to debug this further.
Comment 1 Julian Seward 2009-03-01 01:56:02 UTC
Can't reproduce with gcc-4.3.1 (opensuse 11.0).  I guess it
depends on the particular gcc version.
Comment 2 Arvid Norlander 2009-03-01 10:40:55 UTC
Hm, would it help to have the binary to look at? I could compress and attach it I guess.
Comment 3 Julian Seward 2009-03-01 22:21:39 UTC
DW_OP_ 0x93 is DW_OP_piece, which is used to describe a variable
which has been split into pieces and the pieces stored in 
different locations.  eg a 64-bit value in two 32-bit registers.
Figuring out what the right thing to do here is not a 10-second
operation.

The offending DW_OP_ is in libm-2.8.so.debug in this case.  
A quick workaround might be to strip the debuginfo from libm.

To see the DW_OP_piece expressions, do
readelf -wi libm-2.8.so.debug | grep DW_OP_piece

Deferring until after 3.4.1 release.
Comment 4 Bart Van Assche 2009-08-28 20:09:25 UTC
This issue also occurs on Darwin. See also the Darwin 9.7.0 i386 nightly build output.

$ svn info . | grep Revision
Revision: 10872

$ ./vg-in-place -v --read-var-info=yes --tool=helgrind helgrind/tests/hg03_inherit                                            
==24319== Helgrind, a thread error detector                                    
==24319== Copyright (C) 2007-2009, and GNU GPL'd, by OpenWorks LLP et al.      
==24319== Using Valgrind-3.6.0.SVN and LibVEX; rerun with -h for copyright info
==24319== Command: helgrind/tests/hg03_inherit                                 
==24319==                                                                      
--24319-- Valgrind options:                                                    
--24319--    -v                                                                
--24319--    --read-var-info=yes                                               
--24319--    --tool=helgrind                                                   
--24319-- Contents of /proc/version:                                           
--24319--   can't open /proc/version                                           
--24319-- Arch and hwcaps: X86, x86-sse1-sse2                                  
--24319-- Page sizes: currently 4096, max supported 4096                       
--24319-- Valgrind library directory: /Users/bart/software/valgrind/./.in_place
--24319-- helgrind/tests/hg03_inherit (0x1000)                                 
--24319--    reading syms   from primary file (7 23)                           
--24319--    dSYM= helgrind/tests/hg03_inherit.dSYM/Contents/Resources/DWARF/hg03_inherit                                                                     
--24319--    reading dwarf3 from dsyms file                                    
--24319-- /usr/lib/dyld (0x8fe00000)                                           
--24319--    reading syms   from primary file (17 981)                         
--24319-- Reading suppressions file: /Users/bart/software/valgrind/./.in_place/default.supp                                                                   
--24319-- /Users/bart/software/valgrind/coregrind/vgpreload_core-x86-darwin.so (0xa000)                                                                       
--24319--    reading syms   from primary file (3 633)                          
--24319--    dSYM= /Users/bart/software/valgrind/coregrind/vgpreload_core-x86-darwin.so.dSYM/Contents/Resources/DWARF/vgpreload_core-x86-darwin.so            
--24319--    reading dwarf3 from dsyms file                                    
--24319-- /Users/bart/software/valgrind/helgrind/vgpreload_helgrind-x86-darwin.so (0x14000)                                                                   
--24319--    reading syms   from primary file (108 1114)                       
--24319--    dSYM= /Users/bart/software/valgrind/helgrind/vgpreload_helgrind-x86-darwin.so.dSYM/Contents/Resources/DWARF/vgpreload_helgrind-x86-darwin.so     
--24319--    reading dwarf3 from dsyms file                                    
--24319-- /usr/lib/libSystem.B.dylib (0x1ed000)                                
--24319--    reading syms   from primary file (3987 3467)                      
--24319-- /usr/lib/libgcc_s.1.dylib (0x29000)                                  
--24319--    reading syms   from primary file (85 0)                           
--24319-- /usr/lib/system/libmathCommon.A.dylib (0x36000)                      
--24319--    reading syms   from primary file (32 33)                          
--24319-- REDIR: 0x1f3a60 (memcpy) redirected to 0x190eb (memcpy)              
--24319-- REDIR: 0x1f52cc (pthread_mutex_lock) redirected to 0x17b3f (pthread_mutex_lock)                                                                     
--24319-- REDIR: 0x1f5f64 (calloc) redirected to 0x1551b (calloc)              
--24319-- REDIR: 0x1ee795 (malloc) redirected to 0x165a0 (malloc)              
--24319-- REDIR: 0x1f8f03 (pthread_mutex_init) redirected to 0x19de9 (pthread_mutex_init)                                                                     
--24319-- REDIR: 0x1f55d5 (pthread_mutex_unlock) redirected to 0x17efa (pthread_mutex_unlock)                                                                 
--24319-- REDIR: 0x21e4d7 (pthread_create) redirected to 0x19ffb (pthread_create)                                                                             
--24319-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0xf0                 
--24319-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0xf0                 
--24319-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0xf0                 
--24319-- REDIR: 0x23a44b (pthread_join$UNIX2003) redirected to 0x17942 (pthread_join*)                                                                       
--24319-- REDIR: 0x1f7ff0 (realloc) redirected to 0x16757 (realloc)            
==24319== Thread #3 was created                                                
==24319==    at 0x21EADE: __bsdthread_create (in /usr/lib/libSystem.B.dylib)   
==24319==    by 0x19F87: pthread_create_WRK (hg_intercepts.c:229)              
==24319==    by 0x1A014: pthread_create (hg_intercepts.c:262)                  
==24319==    by 0x1FAD: main (hg03_inherit.c:46)                               
==24319==                                                                      
==24319== Thread #1 is the program's root thread                               
==24319==                                                                      
==24319== Possible data race during write of size 4 at 0x2034 by thread #3     
==24319==    at 0x1EFE: t2 (hg03_inherit.c:28)                                 
==24319==    by 0x1A07D: mythread_wrapper (hg_intercepts.c:201)                
==24319==    by 0x21EC54: _pthread_start (in /usr/lib/libSystem.B.dylib)       
==24319==    by 0x21EB11: thread_start (in /usr/lib/libSystem.B.dylib)         
==24319==  This conflicts with a previous read of size 4 by thread #1          
==24319==    at 0x1FD8: main (hg03_inherit.c:60)                               
==24319==  Location 0x2034 is 0 bytes inside shared[1],                        
==24319==  declared at hg03_inherit.c:11, in frame #0 of thread 3              
==24319==                                                                      
==24319==                                                                      
==24319== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 77 from 61)     
==24319==
==24319== 1 errors in context 1 of 1:
==24319== Possible data race during write of size 4 at 0x2034 by thread #3
==24319==    at 0x1EFE: t2 (hg03_inherit.c:28)
==24319==    by 0x1A07D: mythread_wrapper (hg_intercepts.c:201)
==24319==    by 0x21EC54: _pthread_start (in /usr/lib/libSystem.B.dylib)
==24319==    by 0x21EB11: thread_start (in /usr/lib/libSystem.B.dylib)
==24319==  This conflicts with a previous read of size 4 by thread #1
==24319==    at 0x1FD8: main (hg03_inherit.c:60)
==24319==  Location 0x2034 is 0 bytes inside shared[1],
==24319==  declared at hg03_inherit.c:11, in frame #0 of thread 3
==24319==
--24319--
--24319-- used_suppression:     53 helgrind-darwinlibc-nuke-everything-in-libSystem.B.dylib
--24319-- used_suppression:     14 helgrind-darwinlibc-nuke-everything-in-???-(unknown-code)
--24319-- used_suppression:      2 helgrind-darwinlibc--pthread_create_WRK-pthread_create
--24319-- used_suppression:      2 helgrind-darwinlibc--mythread_wrapper-*thread*start*
--24319-- used_suppression:      2 __keymgr_initializer unlock failed
--24319-- used_suppression:      2 __keymgr_initializer bogus unlock
--24319-- used_suppression:      2 __keymgr_initializer lock failed
==24319==
==24319== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 77 from 61)
Comment 5 Tom Tromey 2011-05-19 16:21:05 UTC
In the last year or two, GCC has started emitting many other
DWARF opcodes that it previously did not.
In addition to the DWARF 4 extensions (implicit_value and stack_value)
it can use some GNU extensions.  For the most part these are
documented; from gcc's include/dwarf2.h:

    /* The GNU implicit pointer extension.
       See http://www.dwarfstd.org/ShowIssue.php?issue=100831.1&type=open .  */
    DW_OP_GNU_implicit_pointer = 0xf2,
    /* The GNU entry value extension.
       See http://www.dwarfstd.org/ShowIssue.php?issue=100909.1&type=open .  */
    DW_OP_GNU_entry_value = 0xf3,
    /* The GNU typed stack extension.
       See http://www.dwarfstd.org/doc/040408.1.html .  */
    DW_OP_GNU_const_type = 0xf4,
    DW_OP_GNU_regval_type = 0xf5,
    DW_OP_GNU_deref_type = 0xf6,
    DW_OP_GNU_convert = 0xf7,
    DW_OP_GNU_reinterpret = 0xf9,

Test programs demonstrating these are in the GCC and GDB test suites.
Comment 6 Florian Krohm 2011-10-22 13:59:39 UTC
We also see this issue now in our regression buckets.
For instance exp-sgcheck/tests/bad_percentify fails on Fedora 15 and other platforms:

warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x...

Note: these warnings are currently being suppressed (r12180).
They should be re-enabled once 3.7.0 is out.
Comment 7 Bart Van Assche 2012-02-02 18:54:52 UTC
Here is another one (F16, 32-bit and with r12180 reverted):
$ cd memcheck/tests
$ ../../vg-in-place --read-var-info=yes ./varinfo5
[ ... ]
--20524-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0xf3
[ ... ]
Comment 8 Bart Van Assche 2012-02-05 17:01:24 UTC
From a 64-bit openSUSE 12.1 system (with r12180 reverted):

$ ./vg-in-place -q --tool=exp-sgcheck --read-var-info=yes exp-sgcheck/tests/bad_percentify
--3678-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93
[ ... ]
Comment 9 Tom Tromey 2012-03-26 16:09:06 UTC
I used sed et al to extract lists of DWARF opcodes from GCC's dwarf2.h and from valgrind.
Then I compared the lists and came up with 3 categories of opcodes that are currently
not handled by valgrind:

First, opcodes that I believe GCC can actually emit under the right circumstances:

-DW_OP_bit_piece
-DW_OP_call2
-DW_OP_call4
-DW_OP_call_ref
-DW_OP_form_tls_address
-DW_OP_GNU_const_type
-DW_OP_GNU_convert
-DW_OP_GNU_deref_type
-DW_OP_GNU_encoded_addr
-DW_OP_GNU_entry_value
-DW_OP_GNU_implicit_pointer
-DW_OP_GNU_parameter_ref
-DW_OP_GNU_push_tls_address
-DW_OP_GNU_regval_type
-DW_OP_GNU_reinterpret
-DW_OP_GNU_uninit    
-DW_OP_piece
-DW_OP_push_object_address

It isn't always obvious how to make GCC emit a given opcode; and at least the two TLS ones seem to be target dependent.

Second, opcodes in the DWARF standard that GCC does not emit:

-DW_OP_xderef
-DW_OP_xderef_size

Finally, extensions that are in GCC's dwarf2.h but which presumably aren't relevant:

-DW_OP_HP_fltconst4  
-DW_OP_HP_fltconst8  
-DW_OP_HP_is_value   
-DW_OP_HP_mod_range  
-DW_OP_HP_tls        
-DW_OP_HP_unknown    
-DW_OP_HP_unmod_range
-DW_OP_PGI_omp_thread_num

GCC doesn't emit any of these.
Comment 10 Hans Ecke 2012-06-21 16:36:03 UTC
Using the helgrind and DRD tools, I see a lot of these:

warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0xf3

This is Fedora 16 64bit gcc 4.6.3 compiling with "-ggdb3".
Comment 11 Tom Tromey 2012-06-21 19:31:47 UTC
(In reply to comment #10)
> Using the helgrind and DRD tools, I see a lot of these:
> 
> warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0xf3

This is:

/* The GNU entry value extension.
   See http://www.dwarfstd.org/ShowIssue.php?issue=100909.1&type=open .  */
DW_OP (DW_OP_GNU_entry_value, 0xf3)