From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15685 invoked by alias); 1 Sep 2008 12:33:51 -0000 Received: (qmail 15337 invoked by uid 48); 1 Sep 2008 12:32:37 -0000 Date: Mon, 01 Sep 2008 12:33:00 -0000 Message-ID: <20080901123237.15336.qmail@sourceware.org> From: "mjw at redhat dot com" To: systemtap@sources.redhat.com In-Reply-To: <20080529170209.6580.fche@redhat.com> References: <20080529170209.6580.fche@redhat.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug tapsets/6580] revamp backtrace-related tapset functions X-Bugzilla-Reason: AssignedTo Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2008-q3/txt/msg00530.txt.bz2 ------- Additional Comments From mjw at redhat dot com 2008-09-01 12:32 ------- caller()/ucaller() can probably be implemented more efficiently than as full wrappers around the caller(1)/ucaller(1). For example the following currently works to get a quick user space symbol, without need to do a full unwind (a full unwind is necessary for getting anything more). If you just want to get the user address and symbol (for static binaries included with -d only for now): # Returns the address in userspace that the current task was at when the # probe occurred. function uaddr:long () %{ /* pure */ #include struct pt_regs *uregs; uregs = task_pt_regs(current); THIS->__retvalue = (int64_t) REG_IP(uregs); %} # Translates an address to a function symbol. Might be expensive # so use sparingly in probes, try translating only in end probes. function uaddr_symbol:string (uaddr: long) %{ /* pure */ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->uaddr); %} Can be used with something like the following for a quick and dirty "profiler": stap -d /path/to/my-static-binary -e 'probe timer.ms(100) {t = tid(); if (t != 0) { printf("%s:.%d 0x%xd:%s\n", execname(), tid(), uaddr(), uaddr_symbol(uaddr())); } }' -- http://sourceware.org/bugzilla/show_bug.cgi?id=6580 ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.