(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tracing) op: assign_op.Equal rhs: {<'/sys/kernel/debug/tracing'>} spids: [175] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:flock) op: assign_op.Equal rhs: {<'/var/tmp/.ftrace-lock'>} spids: [178] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_duration) op: assign_op.Equal rhs: {<0>} spids: [181] ) ] ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:duration) op: assign_op.Equal rhs: (word.Empty) spids: [185] ) ] ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_pid) op: assign_op.Equal rhs: {<0>} spids: [188] ) ] ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pid) op: assign_op.Equal rhs: (word.Empty) spids: [192] ) ] ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_tid) op: assign_op.Equal rhs: {<0>} spids: [195] ) ] ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tid) op: assign_op.Equal rhs: (word.Empty) spids: [199] ) ] ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pidtext) op: assign_op.Equal rhs: (word.Empty) spids: [202] ) ] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_headers) op: assign_op.Equal rhs: {<0>} spids: [204] ) ] ) (C {<trap>} {(SQ <':'>)} {<INT>} {<QUIT>} {<TERM>} {<PIPE>} {<HUP>}) (command.ShFunction name: usage body: (BraceGroup children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<END>} here_end_span_id: 269 stdin_parts: [ <'USAGE: functrace [-hH] [-p PID] [-L TID] [-d secs] funcstring\n'> <' -d seconds # trace duration, and use buffers\n'> <' -h # this usage message\n'> <' -H # include column headers\n'> <' -p PID # trace when this pid is on-CPU\n'> <' -L TID # trace when this thread is on-CPU\n'> <' eg,\n'> <' functrace do_nanosleep # trace the do_nanosleep() function\n'> <' functrace \'*sleep\' # trace functions ending in '> <Id.Right_DoubleQuote '"'> <sleep> <Id.Right_DoubleQuote '"'> <'\n'> <' functrace -p 198 \'vfs*\' # trace '> <Id.Right_DoubleQuote '"'> <'vfs*'> <Id.Right_DoubleQuote '"'> <' funcs for PID 198\n'> <' functrace \'tcp*\' > out # trace all '> <Id.Right_DoubleQuote '"'> <'tcp*'> <Id.Right_DoubleQuote '"'> <' funcs to out file\n'> < ' functrace -d 1 \'tcp*\' > out # trace 1 sec, then write out file\n' > <'\n'> <'See the man page and example file for more info.\n'> ] ) ) (redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>}) ] do_fork: T ) (command.ControlFlow token:<Id.ControlFlow_Exit exit>) ] ) ) (command.ShFunction name: warn body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [(C {<eval>} {(DQ ($ Id.VSub_At '$@'))})] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [ {<echo>} { (DQ <'WARNING: command failed '> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\"'> ) ($ Id.VSub_At '$@') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ) } ] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) ] spids: [283 294] ) ] ) ] ) ) (command.ShFunction name: end body: (BraceGroup children: [ (command.Simple words: [{<echo>}] redirects: [(redir op:<Id.Redir_Great '2>'> loc:(redir_loc.Fd fd:2) arg:{<'/dev/null'>})] do_fork: T ) (command.Simple words: [{<echo>} {(DQ <'Ending tracing...'>)}] redirects: [(redir op:<Id.Redir_Great '2>'> loc:(redir_loc.Fd fd:2) arg:{<'/dev/null'>})] do_fork: T ) (C {<cd>} {($ Id.VSub_DollarName '$tracing')}) (C {<warn>} {(DQ <'echo nop > current_tracer'>)}) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DPipe left: <Id.Lit_ArithVarLike opt_pid> right: <Id.Lit_ArithVarLike opt_tid> ) ) (C {<warn>} {(DQ <'echo > set_ftrace_pid'>)}) ] ) (C {<warn>} {(DQ <'echo > set_ftrace_filter'>)}) (C {<warn>} {(DQ <'echo > trace'>)}) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child:<Id.Lit_ArithVarLike wroteflock>) (C {<warn>} {(DQ <'rm '> ($ Id.VSub_DollarName '$flock'))}) ] ) ] ) ) (command.ShFunction name: die body: (BraceGroup children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_At '$@'))}] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) ) (command.ShFunction name: edie body: (BraceGroup children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_At '$@'))}] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.Simple words: [{<exec>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>}) ] do_fork: T ) (C {<end>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (C {<getopts>} {<d> <Id.Lit_Colon ':'> <hHp> <Id.Lit_Colon ':'> <L> <Id.Lit_Colon ':'>} {<opt>} ) ] ) body: (command.DoGroup children: [ (command.Case to_match: {($ Id.VSub_DollarName '$opt')} arms: [ (case_arm pat_list: [{<d>}] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_duration) op: assign_op.Equal rhs: {<1>} spids: [500] ) ] ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:duration) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$OPTARG')} spids: [504] ) ] ) ] spids: [497 498 507 -1] ) (case_arm pat_list: [{<p>}] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_pid) op: assign_op.Equal rhs: {<1>} spids: [513] ) ] ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pid) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$OPTARG')} spids: [517] ) ] ) ] spids: [510 511 520 -1] ) (case_arm pat_list: [{<L>}] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_tid) op: assign_op.Equal rhs: {<1>} spids: [526] ) ] ) terminator: <Id.Op_Semi _> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tid) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$OPTARG')} spids: [530] ) ] ) ] spids: [523 524 533 -1] ) (case_arm pat_list: [{<H>}] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_headers) op: assign_op.Equal rhs: {<1>} spids: [539] ) ] ) terminator: <Id.Op_Semi _> ) ] spids: [536 537 543 -1] ) (case_arm pat_list: [{<h>} {<Id.Lit_QMark '?'>}] action: [(C {<usage>})] spids: [546 549 553 -1] ) ] ) ] ) ) (C {<shift>} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: {($ Id.VSub_DollarName '$OPTIND')} right: {<Id.Lit_Digits 1>} ) ) } ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DEqual left: {($ Id.VSub_Pound '$#')} right: {<Id.Lit_Digits 0>} ) ) (C {<usage>}) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DAmp left: <Id.Lit_ArithVarLike opt_pid> right: <Id.Lit_ArithVarLike opt_tid> ) ) (C {<edie>} {(DQ <'ERROR: You can use -p or -L but not both.'>)}) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:funcs) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [611] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child:<Id.Lit_ArithVarLike opt_pid>) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pidtext) op: assign_op.Equal rhs: {(DQ <' for PID '> ($ Id.VSub_DollarName '$pid'))} spids: [625] ) ] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child:<Id.Lit_ArithVarLike opt_tid>) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pidtext) op: assign_op.Equal rhs: {(DQ <' for TID '> ($ Id.VSub_DollarName '$pid'))} spids: [640] ) ] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child:<Id.Lit_ArithVarLike opt_duration>) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} { (DQ <'Tracing '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ($ Id.VSub_DollarName '$funcs') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ($ Id.VSub_DollarName '$pidtext') <' for '> ($ Id.VSub_DollarName '$duration') <' seconds...'> ) } ) ] spids: [646 656] ) ] else_action: [ (C {<echo>} { (DQ <'Tracing '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ($ Id.VSub_DollarName '$funcs') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ($ Id.VSub_DollarName '$pidtext') <'... Ctrl-C to end.'> ) } ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<cd>} {($ Id.VSub_DollarName '$tracing')}) (C {<die>} { (DQ <'ERROR: accessing tracing. Root user? Kernel has FTRACE?\n'> <' debugfs mounted? (mount -t debugfs debugfs /sys/kernel/debug)'> ) } ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DBracket expr: (bool_expr.Unary op_id:Id.BoolUnary_e child:{($ Id.VSub_DollarName '$flock')}) ) (C {<die>} { (DQ <'ERROR: ftrace may be in use by PID '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<cat>} {($ Id.VSub_DollarName '$flock')}) ) <' '> ($ Id.VSub_DollarName '$flock') ) } ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{<echo>} {($ Id.VSub_Dollar '$$')}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$flock')} ) ] do_fork: T ) (C {<die>} {(DQ <'ERROR: unable to write '> ($ Id.VSub_DollarName '$flock') <.>)}) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:wroteflock) op: assign_op.Equal rhs: {<1>} spids: [750] ) ] ) (C {<sysctl>} {<-q>} {<kernel.ftrace_enabled> <Id.Lit_Equals '='> <1>}) (command.Simple words: [{<read>} {<mode>}] redirects: [(redir op:<Id.Redir_Less '<'> loc:(redir_loc.Fd fd:0) arg:{<current_tracer>})] do_fork: T ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobNEqual left: {(DQ ($ Id.VSub_DollarName '$mode'))} right: {(DQ <nop>)} ) ) (C {<edie>} {(DQ <'ERROR: ftrace active (current_tracer='> ($ Id.VSub_DollarName '$mode') <')'>)} ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child:<Id.Lit_ArithVarLike opt_pid>) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [{<echo>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<set_ftrace_pid>} ) ] do_fork: T ) (command.ForEach iter_name: tid iter_words: [{<'/proc/'> ($ Id.VSub_DollarName '$pid') <'/task/'> <Id.Lit_Star '*'>}] do_arg_iter: F body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [ {<echo>} { (braced_var_sub token: <Id.VSub_Name tid> suffix_op: (suffix_op.Unary tok: <Id.VOp1_DPound '##'> arg_word: {<Id.Lit_Other '*'> <Id.Lit_Slash '/'>} ) ) } ] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {<set_ftrace_pid>} ) ] do_fork: T ) ] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<edie>} { (DQ <'ERROR: setting -p '> ($ Id.VSub_DollarName '$pid') <' (PID exist?). Exiting.'> ) } ) ] spids: [839 857] ) ] ) ] ) ) ] spids: [800 810] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child:<Id.Lit_ArithVarLike opt_tid>) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [{<echo>} {($ Id.VSub_DollarName '$tid')}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<set_ftrace_pid>} ) ] do_fork: T ) ] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<edie>} { (DQ <'ERROR: setting -L '> ($ Id.VSub_DollarName '$tid') <' (TID exist?). Exiting.'> ) } ) ] spids: [889 902] ) ] ) ] spids: [876 886] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$funcs'))}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<set_ftrace_filter>} ) ] do_fork: T ) ] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<edie>} { (DQ <'ERROR: enabling '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ($ Id.VSub_DollarName '$funcs') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <'. Exiting.'> ) } ) ] spids: [918 933] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [{<echo>} {<Id.KW_Function function>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<current_tracer>} ) ] do_fork: T ) ] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<edie>} { (DQ <'ERROR: setting current_tracer to '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <function> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <'. Exiting.'> ) } ) ] spids: [948 961] ) ] ) (C {<warn>} {(DQ <'echo > trace'>)}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child:<Id.Lit_ArithVarLike opt_duration>) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<sleep>} {($ Id.VSub_DollarName '$duration')}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child:<Id.Lit_ArithVarLike opt_headers>) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<cat>} {<trace>})] spids: [1004 1014] ) ] else_action: [(C {<grep>} {<-v>} {(SQ <'^#'>)} {<trace>})] ) ] spids: [986 996] ) ] else_action: [ (command.AndOr ops: [Id.Op_DAmp] children: [(command.DParen child:<Id.Lit_ArithVarLike opt_headers>) (C {<cat>} {<trace>})] ) (C {<cat>} {<trace_pipe>}) ] ) (C {<end>}) ] )