The same way as we list alternatives when someone misspells a $context variable, we should do the same when eliding a read-only variable: probe foo = bar { var1="foo" } probe foo { prinln(var) } # <- should list "var1" as an alternative Then one can *list* local variables available in a probe using a hack like % stap -e "probe SOMEWHERE { nosuchvar }" WARNING: read-only local variable nosuchvar (alternatives: foo, bar, baz) ... (It's conceivable to also warn for the "var1" side of the mismatch, in the "eliding unused local variable" branch in elaborate.cxx:semantic_pass_opt2.)
Bug 6611: read-only variable typo warnings should list alternatives.
Stan, I am seeing: [root@... systemtap-3july]# stap -vv testsuite/systemtap.base/warnings.stp SystemTap translator/driver (version 0.7/0.133 non-git sources) Copyright (C) 2005-2008 Red Hat, Inc. and others This is free software; see the source for copying conditions. Session arch: i686 release: 2.6.26-rc8-reloc Created temporary directory "/tmp/stapur8vlp" Searched '/usr/local/share/systemtap/tapset/i686/*.stp', found 2 Searched '/usr/local/share/systemtap/tapset/*.stp', found 41 Pass 1: parsed user script and 43 library script(s) in 500usr/20sys/526real ms. semantic error: multiple addresses for fs/bio.c:135 (try fs/bio.c:131 or fs/bio.c:136) semantic error: no match while resolving probe point kernel.statement("bio_init@fs/bio.c:135") semantic error: no match while resolving probe point probea Pass 2: analyzed script: 2 probe(s), 5 function(s), 0 embed(s), 1 global(s) in 220usr/140sys/348real ms. Pass 2: analysis failed. Try again with more '-v' (verbose) options. Running rm -rf /tmp/stapur8vlp on a 2.6.26-rc8 kernel, resulting in the test failing with a FAIL: warnings (0)
Yeah, the test case should not hard-code a line number like that. hy not just kernel.function("bio_init"); perhaps using the relative line number syntax if needed.
systemtap.base/warnings.stp: Use relative instead of absolute line.