This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how can we decode the output of task_backtrace inside systemtap script ?


Hi hit201j,

On Tue, 2010-12-07 at 23:34 +0800, hit201j wrote:
> Some commands like df might hang sometime,so i want to find out the
> backtrace of those processes and i found dumpstack.stp in the
> examples;
> but in this script,the task_backtrace() just show us a string of
> addresses without space, which can't be decoded directly by
> print_stack()
> How can we decode the ouput of task_backtrace() inside the systemtap
> script?Any function design for this purpose?

You already found print_stack () which does this.
Except that I introduced a bug in the latest systemtap :{
Sorry about that.

The current version of task_backtrace () doesn't insert spaces between
the hex addresses, which makes print_stack () unable to decode them.

The patch below fixes it.
I'll commit and push to git.

If you want to fix it by hand in your local copy just edit 
/usr/share/systemtap/tapset/context-unwind.stp and replace the '0' in
the function task_backtrace _stp_stack_snprint_tsk call with
'_STP_SYM_NONE'.

Thanks,

Mark

diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp
index 6a1240c..14feb58 100644
--- a/tapset/context-unwind.stp
+++ b/tapset/context-unwind.stp
@@ -92,7 +92,8 @@ function backtrace:string () %{ /* pure */
  */
 function task_backtrace:string (task:long) %{ /* pure */
         _stp_stack_snprint_tsk(THIS->__retvalue, MAXSTRINGLEN,
-               (struct task_struct *)(unsigned long)THIS->task, 0, MAXTRACE);
+                               (struct task_struct *)(unsigned long)THIS->task,
+                               _STP_SYM_NONE, MAXTRACE);
 %}
 
 /**



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]