summaryrefslogtreecommitdiffstats
path: root/tapset/logging.stp
blob: a2abf92235e4e435d4ea23bbefa8508bbff77c1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# This file contains simple bridging functions to the runtime

function _print (msg) %{
    _stp_print (THIS->msg);
%}

function print (msg) {
    _print (msg . "\n")
}

// same as print
function log (msg) {
    _print (msg . "\n")
}

function _printk (msg) %{
    printk (KERN_INFO "%s\n", THIS->msg);
%}

function printk (msg) {
    _printk (msg . "")
}

function _warn (msg) %{
    _stp_warn ("%s", THIS->msg);
%}

function warn (msg) {
    _warn (msg . "")
}

// NB: exit() does *not* cause immediate return from current function/probe
function exit () %{
    _stp_exit ();
%}

function _error (msg) %{
    CONTEXT->last_error = "called error()"; /* kill current probe */
    _stp_error ("%s", THIS->msg); /* implies _stp_exit */
%}

function error (msg) {
    _error (msg . "")
}