Description of problem: From https://bugzilla.redhat.com/show_bug.cgi?id=546006#c5 > > I'm also sometimes seeing error messages in pass 1 of the > > form: > > semantic error: No cfa_ops supplied, but needed by DW_OP_call_frame_cfa > > when I make the script more complex; should I file that as a separate bug? > Yes please, if you see it after updating to systemtap-1.1. > There has been one bug fix for 1.1 that addresses one case of > DW_OP_call_frame_cfa not being found, but there seems to be some other issue > lurking out there. If you get anything with a good reproducer that would b > very appreciated. I'm seeing this with systemtap-1.1-1.fc12.i686, trying to instrument python. Simplified script is: probe process("/usr/lib/libpython2.6.so.1.0").function("PyObject_Malloc") { printf("PyObject_Malloc(%i)\n", $nbytes); } $ stap python-mem-simplified.stp -c "python -c 'import gtk; import dbus'" semantic error: No cfa_ops supplied, but needed by DW_OP_call_frame_cfa: identifier '$nbytes' at python-mem-simplified.stp:2:35 source: printf("PyObject_Malloc(%i)\n", $nbytes); ^ Pass 2: analysis failed. Try again with another '--vp 01' option. $ stap -vvvv python-mem-simplified.stp -c "python -c 'import gtk; import dbus'" SystemTap translator/driver (version 1.1/0.143 non-git sources) Copyright (C) 2005-2009 Red Hat, Inc. and others This is free software; see the source for copying conditions. Session arch: i386 release: 2.6.31.9-174.fc12.i686.PAE Created temporary directory "/tmp/staprQVQaC" Parsed kernel "/lib/modules/2.6.31.9-174.fc12.i686.PAE/build/.config", number of tuples: 3260 Searched "/usr/share/systemtap/tapset/i386/*.stp", found 3 Searched "/usr/share/systemtap/tapset/*.stp", found 62 Pass 1: parsed user script and 65 library script(s) using 20104virt/12264res/2076shr kb, in 220usr/10sys/285real ms. dwarf_builder::build for /usr/lib/libpython2.6.so.1.0 parsed 'PyObject_Malloc', func 'PyObject_Malloc' pattern '/usr/lib/libpython2.6.so.1.0' matches module '/usr/lib/libpython2.6.so.1.0' focused on module '/usr/lib/libpython2.6.so.1.0 = [0x4eea000-0x5078b6c, bias 0x0] file /usr/lib/debug/usr/lib/libpython2.6.so.1.0.debug ELF machine i?86|x86_64 (code 3) focused on module '/usr/lib/libpython2.6.so.1.0' selected function PyObject_Malloc prologue searching function 'PyObject_Malloc' 0x6c000-0x6c642@Objects/obmalloc.c:724 checking line record 0x6c000@Objects/obmalloc.c:725 prologue found function 'PyObject_Malloc' (naked) = 0x6c000 probe PyObject_Malloc@Objects/obmalloc.c:724 process=/usr/lib/libpython2.6.so.1.0 reloc=.dynamic pc=0x6c000 entry-pc lookup (dwarf_entrypc dieoffset: 0x51118) = 0x6c000 (rc 0) finding location for local 'nbytes' near address 0x6c000, module bias 0x4eea000 get_cfa_ops @0x6c000, module_start @0x4eea000 dwfl_module_dwarf_cfi failed: no error got eh cfi bias: 0x10000 dwarf_cfi_addrframe failed: no matching address range not found cfa dwarf_builder releasing user dwflpp /usr/lib/libpython2.6.so.1.0 Eliding side-effect-free singleton block operator '{' at python-mem-simplified.stp:1:75 Resolution problem with probe probe_1905 printf("PyObject_Malloc(%i)\\n", $nbytes) semantic error: No cfa_ops supplied, but needed by DW_OP_call_frame_cfa: identifier '$nbytes' at python-mem-simplified.stp:2:35 source: printf("PyObject_Malloc(%i)\n", $nbytes); ^ Pass 2: analyzed script: 1 probe(s), 0 function(s), 0 embed(s), 0 global(s) using 25260virt/15548res/4104shr kb, in 40usr/10sys/86real ms. Pass 2: analysis failed. Try again with another '--vp 01' option. Running rm -rf /tmp/staprQVQaC Spawn waitpid result (0x802): 0
Created attachment 385528 [details] /usr/lib/libpython2.6.so.1.0 that's showing this
Created attachment 385530 [details] .debug file
Replicated against: python-2.6.2-2.fc12.i686 systemtap-1.1-1.fc12.i686 [mark@fedora32 ~]$ stap -e 'probe process("/usr/lib/libpython2.6.so.1.0").function("PyObject_Malloc") {printf("PyObject_Malloc(%i)\n", $nbytes);}' semantic error: No cfa_ops supplied, but needed by DW_OP_call_frame_cfa: identifier '$nbytes' at <input>:1:108 source: probe process("/usr/lib/libpython2.6.so.1.0").function("PyObject_Malloc") {printf("PyObject_Malloc(%i)\n", $nbytes);} ^ Pass 2: analysis failed. Try again with another '--vp 01' option. Also fails against current systemtap git-trunk.
For the record, doesn't fail on x86_64.
Fixed upstream: commit 87748e2b87e574d3c83866ccd0d83678c3c68d93 Author: Mark Wielaard <mjw> Date: Tue Feb 2 13:47:19 2010 +0100 Make sure cfa_ops are always retrieved through dwfl global address. dwflpp::translate_location() works on the dw address space, but get_cfa_ops() starts out with dwfl calls (only dwarf_cfi_addrframe() needs to be adjusted for bias). * dwflpp.cxx (translate_location): Pass pc plus module bias through to get_cfa_ops. (get_cfa_ops): Adjust for bias when calling dwarf_cfi_addrframe(), add frame start/end address when found if verbose logging. * testsuite/systemtap.exelib/lib.stp: Add $foo and $bar variables to process.function probes. * testsuite/systemtap.exelib/libmarkunamestack.stp: Likewise. * testsuite/systemtap.exelib/lib.tcl: Expect correct values for process.function probe variables. * testsuite/systemtap.exelib/libmarkunamestack.tcl: Likewise.
The patch in comment #5 relies on an elfutils fix for bug #563528
systemtap-1.1-2.fc13 and systemtap-1.1-2.fc12 have been pushed with the fix from comment #5. Which should fix this issue mostly. Full fix will be when new elfutils 0.145 lands (any day now).