SystemTap 笔记 (9)—— “?”和“!”

probe后面有时会跟?或是!字符:

kernel.function("no_such_function") ?
module("awol").function("no_such_function") !

对此,man手册的解释如下:

However, a probe point may be followed by a “?” character, to indicate that it is optional, and that no error should result if it fails to resolve. Optionalness passes down through all levels of alias/wildcard expansion. Alternately, a probe point may be followed by a “!” character, to indicate that it is both optional and sufficient. (Think vaguely of the prolog cut operator.) If it does resolve, then no further probe points in the same comma-separated list will be resolved. Therefore, the “!” sufficiency mark only makes sense in a list of probe point alternatives.

?表明probe是可选的,即使不存在相应的probe,也不会导致命令出错,而是继续解析其它的probe!表明probe一旦解析成功,则不会继续解析后面的probe。因此!只在存在probe列表的情况下才有效。