Environment: 2.6.24 kernel, systemtap 20080315 snapshot and elfutils-0.130 If I use "NULL" in systemtap scripts, stap throws non-apparent error messages. Systemtap user finds it difficult to understand these error messages. So there is a need for more obvious/apparent error message for this situation. ======================================================= [root@llm27lp1 obj]# cat b.stp global array probe syscall.write { if ($buf != NULL) array[pid()]++; } .................... ..................... ====================================== Pass 3: translated to C into "/tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c" in 0usr/0sys/2real ms. Running make -C "/lib/modules/2.6.24/build" M="/tmp/stapAyIw1G" modules >/dev/null /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:92: error: expected identifier or '(' before 'void' /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:92: error: expected ')' before numeric constant /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:93: error: expected ';' before 'union' /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c: In function 'probe_1109': /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:237: error: expected identifier before '(' token /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:259: error: expected identifier before '(' token /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:268: error: 'struct probe_1109_locals' has no member named '__tmp0' /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:273: error: 'struct probe_1109_locals' has no member named '__tmp2' /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:273: error: 'struct probe_1109_locals' has no member named '__tmp0' /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:274: error: 'struct probe_1109_locals' has no member named '__tmp3' /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:274: error: 'struct probe_1109_locals' has no member named '__tmp2' /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:275: error: 'struct probe_1109_locals' has no member named '__tmp2' /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:276: error: 'struct probe_1109_locals' has no member named '__tmp0' /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:276: error: 'struct probe_1109_locals' has no member named '__tmp2' /tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.c:277: error: 'struct probe_1109_locals' has no member named '__tmp3' make[1]: *** [/tmp/stapAyIw1G/stap_7513fe211e17b3d61924ad9133f1d1e1_857.o] Error 1 make: *** [_module_/tmp/stapAyIw1G] Error 2 ==================================================
The NULL name is being treated as an implicitly declared systemtap local, and is copied into the generated C code's context structure. These names should be prefixed with something too, just like the globals already are (s_VAR). See translate.cxx: var::value() and c_varname().
Rather than tweak the local variable naming widget, which has the potential of changing the embedded-c function API, I committed a patch that defines a NULL systemtap-level global. This works because globals do have a C-level name prefixing to avoid conflict with kernel globals/macros.
patch committed