summaryrefslogtreecommitdiffstats
path: root/tapset/logging.stp
blob: 54f4c2723c41afeda37bcc0d1683c8bafb04550a (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
// logging tapset
// Copyright (C) 2005 Red Hat Inc.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.

function print (msg:string) %{
    _stp_print (THIS->msg);
%}

// like print but with a newline
function log (msg:string) %{
    _stp_printf ("%s\n", THIS->msg);
%}

function warn (msg:string) %{
    _stp_warn ("%s", THIS->msg);
%}

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

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