// context 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_regs () %{ if (CONTEXT->regs) { _stp_print_regs (CONTEXT->regs); } %} function print_backtrace () %{ if (CONTEXT->regs) { _stp_stack_print(CONTEXT->regs); } %} function backtrace:string () %{ if (CONTEXT->regs) { /* XXX: this won't be necessary when runtime and translator */ /* agree on what a string is. */ String str = _stp_string_init (0); _stp_stack_sprint (str, CONTEXT->regs, 0); strlcpy (THIS->__retvalue, _stp_string_ptr(str), MAXSTRINGLEN); } else strlcpy (THIS->__retvalue, "", MAXSTRINGLEN); %} function execname:string () %{ strlcpy (THIS->__retvalue, current->comm, MAXSTRINGLEN); %} function pid:long () %{ THIS->__retvalue = current->tgid; %} function tid:long () %{ THIS->__retvalue = current->pid; %} function ppid:long () %{ THIS->__retvalue = current->parent->tgid; %} function pexecname:string () %{ strlcpy (THIS->__retvalue, current->parent->comm, MAXSTRINGLEN); %} function gid:long () %{ THIS->__retvalue = current->gid; %} function egid:long () %{ THIS->__retvalue = current->egid; %} function uid:long () %{ THIS->__retvalue = current->uid; %} function euid:long () %{ THIS->__retvalue = current->euid; %} function cpuid:long () %{ THIS->__retvalue = current->thread_info->cpu; %} function print_stack(stk:string) %{ char *ptr = THIS->stk; char *tok = strsep(&ptr, " "); while (tok && *tok) { _stp_print_cstr(" "); _stp_symbol_print (simple_strtol(tok, NULL, 16)); _stp_print_cstr("\n"); tok = strsep(&ptr, " "); } %} function pp:string () %{ strlcpy (THIS->__retvalue, CONTEXT->probe_point, MAXSTRINGLEN); %} function target:long () %{ THIS->__retvalue = _stp_target; %}