From fc204b30292a3a5f1aa602171dc44d937cb2c20f Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 7 Apr 2009 12:25:53 +0200 Subject: Create usymname and usymdata variant that trigger STP_NEED_VMA_TRACKER. * tapset/context-symbols.stp (syname, symdata): Pass NULL for kernel address. * tapset/ucontext-symbols.stp: New file defining usymname and usymdata. * testsuite/systemtap.context/usymbols.exp: Use usymname, remove STP_NEED_VMA_TRACKER hack. * testsuite/buildok/usymdata.stp: New test. * testsuite/buildok/usymname.stp: Likewise. --- tapset/ucontext-symbols.stp | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tapset/ucontext-symbols.stp (limited to 'tapset/ucontext-symbols.stp') diff --git a/tapset/ucontext-symbols.stp b/tapset/ucontext-symbols.stp new file mode 100644 index 00000000..3813a8bf --- /dev/null +++ b/tapset/ucontext-symbols.stp @@ -0,0 +1,52 @@ +// User context symbols tapset +// Copyright (C) 2009 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. + +// +// User context symbol functions provide additional information about +// addresses from an application. These functions can provide +// information about the user space map (library) that the event occured or +// the function symbol of an address. +// + +%{ +#ifndef STP_NEED_SYMBOL_DATA +#define STP_NEED_SYMBOL_DATA 1 +#endif +#ifndef STP_NEED_VMA_TRACKER +#define STP_NEED_VMA_TRACKER 1 +#endif +%} + +/** + * sfunction usymname - Return the symbol of an address in the current task. + * @addr: The address to translate. + * + * Description: Returns the (function) symbol name associated with the + * given address if known. If not known it will return the hex string + * representation of addr. + */ +function usymname:string (addr: long) %{ /* pure */ + _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, + current, 0); +%} + +/** + * sfunction usymdata - Return the symbol and module offset of an address. + * @addr: The address to translate. + * + * Description: Returns the (function) symbol name associated with the + * given address in the current task if known, plus the module name + * (between brackets) and the offset inside the module (shared library), + * plus the size of the symbol function. If any element is not known it + * will be ommitted and if the symbol name is unknown it will return the + * hex string for the given address. + */ +function usymdata:string (addr: long) %{ /* pure */ + _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, + current, 1); +%} -- cgit From c45319065d6e3ae91ae833f7afbf0edba6c87d89 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 21 Apr 2009 17:16:51 +0200 Subject: Add ubacktrace(), print_ustack() and print_ubacktrace(). * runtime/sym.c (_stp_usymbol_print): New function. * tapset/ucontext-unwind.stp (print_ubacktrace): New tapset function. (ubacktrace): Likewise. * tapset/ucontext-symbols.stp (print_ustack): Likewise. * testsuite/buildok/ustack.stp: New test for above three functions. --- tapset/ucontext-symbols.stp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tapset/ucontext-symbols.stp') diff --git a/tapset/ucontext-symbols.stp b/tapset/ucontext-symbols.stp index 3813a8bf..2e7ad25b 100644 --- a/tapset/ucontext-symbols.stp +++ b/tapset/ucontext-symbols.stp @@ -50,3 +50,26 @@ function usymdata:string (addr: long) %{ /* pure */ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, current, 1); %} + +/** + * sfunction print_ustack - Print out stack for the current task from string. + * @stk: String with list of hexidecimal addresses for the current task. + * + * Perform a symbolic lookup of the addresses in the given string, + * which is assumed to be the result of a prior call to + * ubacktrace() for the current task. + * + * Print one line per address, including the address, the + * name of the function containing the address, and an estimate of + * its position within that function. Return nothing. + */ +function print_ustack(stk:string) %{ + char *ptr = THIS->stk; + char *tok = strsep(&ptr, " "); + while (tok && *tok) { + _stp_print_char(' '); + _stp_usymbol_print (simple_strtol(tok, NULL, 16), current); + _stp_print_char('\n'); + tok = strsep(&ptr, " "); + } +%} -- cgit From 7d7f074398802c84f544e263995ce15874b9f408 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 21 Apr 2009 19:57:02 +0200 Subject: Mark ucontext tapset functions EXPERIMENTAL. * tapset/ucontext-symbols.stp (usymname, usymdata, print_ustack): mark EXPERIMENTAL. * tapset/ucontext-unwind.stp (print_ubacktrace, ubacktrace): Likewise. --- tapset/ucontext-symbols.stp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tapset/ucontext-symbols.stp') diff --git a/tapset/ucontext-symbols.stp b/tapset/ucontext-symbols.stp index 2e7ad25b..5502f5cd 100644 --- a/tapset/ucontext-symbols.stp +++ b/tapset/ucontext-symbols.stp @@ -23,7 +23,7 @@ %} /** - * sfunction usymname - Return the symbol of an address in the current task. + * sfunction usymname - Return the symbol of an address in the current task. EXPERIMENTAL! * @addr: The address to translate. * * Description: Returns the (function) symbol name associated with the @@ -36,7 +36,7 @@ function usymname:string (addr: long) %{ /* pure */ %} /** - * sfunction usymdata - Return the symbol and module offset of an address. + * sfunction usymdata - Return the symbol and module offset of an address. EXPERIMENTAL! * @addr: The address to translate. * * Description: Returns the (function) symbol name associated with the @@ -52,7 +52,7 @@ function usymdata:string (addr: long) %{ /* pure */ %} /** - * sfunction print_ustack - Print out stack for the current task from string. + * sfunction print_ustack - Print out stack for the current task from string. EXPERIMENTAL! * @stk: String with list of hexidecimal addresses for the current task. * * Perform a symbolic lookup of the addresses in the given string, -- cgit