(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tracing) op: Equal rhs: {(/sys/kernel/debug/tracing)} spids: [175] ) ] spids: [175] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:flock) op: Equal rhs: {(/var/tmp/.ftrace-lock)} spids: [178] ) ] spids: [178] ) (CommandList children: [ (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_duration) op:Equal rhs:{(0)} spids:[181])] spids: [181] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:duration) op: Equal rhs: {(EmptyPart)} spids: [185] ) ] spids: [185] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_pid) op:Equal rhs:{(0)} spids:[188])] spids: [188] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pid) op:Equal rhs:{(EmptyPart)} spids:[192])] spids: [192] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_tid) op:Equal rhs:{(0)} spids:[195])] spids: [195] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:tid) op:Equal rhs:{(EmptyPart)} spids:[199])] spids: [199] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pidtext) op:Equal rhs:{(EmptyPart)} spids:[202])] spids: [202] ) ] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_headers) op:Equal rhs:{(0)} spids:[204])] spids: [204] ) (C {(trap)} {(SQ <':'>)} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)}) (FuncDef name: usage body: (BraceGroup children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op: <Redir_DLessDash '<<-'> fd: 16777215 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 ") (Right_DoubleQuote '"') (sleep) (Right_DoubleQuote '"') ('\n') (" functrace -p 198 'vfs*' # trace ") (Right_DoubleQuote '"') ('vfs*') (Right_DoubleQuote '"') (' funcs for PID 198\n') (" functrace 'tcp*' > out # trace all ") (Right_DoubleQuote '"') ('tcp*') (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:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)}) ] ) (ControlFlow token:<ControlFlow_Exit exit>) ] spids: [231] ) spids: [227 230] ) (FuncDef name: warn body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children:[(C {(eval)} {(DQ ($ VSub_At '$@'))})] negated:T) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ('WARNING: command failed ') (EscapedLiteralPart token: <Lit_EscapedChar '\\"'> ) ($ VSub_At '$@') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ) } ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) ] spids: [16777215 294] ) ] spids: [16777215 310] ) ] spids: [280] ) spids: [276 279] ) (FuncDef name: end body: (BraceGroup children: [ (SimpleCommand words: [{(echo)}] redirects: [(Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})] ) (SimpleCommand words: [{(echo)} {(DQ ('Ending tracing...'))}] redirects: [(Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})] ) (C {(cd)} {($ VSub_Name '$tracing')}) (C {(warn)} {(DQ ('echo nop > current_tracer'))}) (AndOr ops: [Op_DAmp] children: [ (DParen child: (ArithBinary op_id: Arith_DPipe left: (ArithVarRef name:opt_pid) right: (ArithVarRef name:opt_tid) ) spids: [354 363] ) (C {(warn)} {(DQ ('echo > set_ftrace_pid'))}) ] ) (C {(warn)} {(DQ ('echo > set_ftrace_filter'))}) (C {(warn)} {(DQ ('echo > trace'))}) (AndOr ops: [Op_DAmp] children: [ (DParen child:(ArithVarRef name:wroteflock) spids:[388 393]) (C {(warn)} {(DQ ('rm ') ($ VSub_Name '$flock'))}) ] ) ] spids: [319] ) spids: [315 318] ) (FuncDef name: die body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_At '$@'))}] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [411] ) spids: [407 410] ) (FuncDef name: edie body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_At '$@'))}] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (SimpleCommand words: [{(exec)}] redirects: [ (Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)}) (Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)}) ] ) (C {(end)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [435] ) spids: [431 434] ) (WhileUntil keyword: <KW_While while> cond: [(C {(getopts)} {(d) (Lit_Other ':') (hHp) (Lit_Other ':') (L) (Lit_Other ':')} {(opt)})] body: (DoGroup children: [ (Case to_match: {($ VSub_Name '$opt')} arms: [ (case_arm pat_list: [{(d)}] action: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_duration) op: Equal rhs: {(1)} spids: [500] ) ] spids: [500] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:duration) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [504] ) ] spids: [504] ) ] spids: [497 498 507 16777215] ) (case_arm pat_list: [{(p)}] action: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_pid) op: Equal rhs: {(1)} spids: [513] ) ] spids: [513] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pid) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [517] ) ] spids: [517] ) ] spids: [510 511 520 16777215] ) (case_arm pat_list: [{(L)}] action: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_tid) op: Equal rhs: {(1)} spids: [526] ) ] spids: [526] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tid) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [530] ) ] spids: [530] ) ] spids: [523 524 533 16777215] ) (case_arm pat_list: [{(H)}] action: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_headers) op: Equal rhs: {(1)} spids: [539] ) ] spids: [539] ) terminator: <Op_Semi ';'> ) ] spids: [536 537 543 16777215] ) (case_arm pat_list: [{(h)} {(Lit_Other '?')}] action: [(C {(usage)})] spids: [546 549 553 16777215] ) ] spids: [490 494 556] ) ] spids: [487 558] ) ) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithWord w:{($ VSub_Name '$OPTIND')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [562 571] ) } ) (AndOr ops: [Op_DAmp] children: [ (DParen child: (ArithBinary op_id: Arith_DEqual left: (ArithWord w:{($ VSub_Pound '$#')}) right: (ArithWord w:{(Lit_Digits 0)}) ) spids: [577 586] ) (C {(usage)}) ] ) (AndOr ops: [Op_DAmp] children: [ (DParen child: (ArithBinary op_id: Arith_DAmp left: (ArithVarRef name:opt_pid) right: (ArithVarRef name:opt_tid) ) spids: [592 601] ) (C {(edie)} {(DQ ('ERROR: You can use -p or -L but not both.'))}) ] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:funcs) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [611] ) ] spids: [611] ) (AndOr ops: [Op_DAmp] children: [ (DParen child:(ArithVarRef name:opt_pid) spids:[616 621]) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pidtext) op: Equal rhs: {(DQ (' for PID ') ($ VSub_Name '$pid'))} spids: [625] ) ] spids: [625] ) ] ) (AndOr ops: [Op_DAmp] children: [ (DParen child:(ArithVarRef name:opt_tid) spids:[631 636]) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pidtext) op: Equal rhs: {(DQ (' for TID ') ($ VSub_Name '$pid'))} spids: [640] ) ] spids: [640] ) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_duration) spids:[648 653]) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} { (DQ ('Tracing ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$funcs') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$pidtext') (' for ') ($ VSub_Name '$duration') (' seconds...') ) } ) ] spids: [16777215 656] ) ] else_action: [ (C {(echo)} { (DQ ('Tracing ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$funcs') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$pidtext') ('... Ctrl-C to end.') ) } ) ] spids: [672 686] ) (AndOr ops: [Op_DPipe] children: [ (C {(cd)} {($ VSub_Name '$tracing')}) (C {(die)} { (DQ ('ERROR: accessing tracing. Root user? Kernel has FTRACE?\n') (' debugfs mounted? (mount -t debugfs debugfs /sys/kernel/debug)') ) } ) ] ) (AndOr ops: [Op_DAmp] children: [ (DBracket expr:(BoolUnary op_id:BoolUnary_e child:{($ VSub_Name '$flock')})) (C {(die)} { (DQ ('ERROR: ftrace may be in use by PID ') (CommandSubPart command_list: (CommandList children:[(C {(cat)} {($ VSub_Name '$flock')})]) left_token: <Left_CommandSub '$('> spids: [723 727] ) (' ') ($ VSub_Name '$flock') ) } ) ] ) (AndOr ops: [Op_DPipe] children: [ (SimpleCommand words: [{(echo)} {($ VSub_Dollar '$$')}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{($ VSub_Name '$flock')})] ) (C {(die)} {(DQ ('ERROR: unable to write ') ($ VSub_Name '$flock') (.))}) ] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:wroteflock) op:Equal rhs:{(1)} spids:[750])] spids: [750] ) (C {(sysctl)} {(-q)} {(kernel.ftrace_enabled) (Lit_Other '=') (1)}) (SimpleCommand words: [{(read)} {(mode)}] redirects: [(Redir op:<Redir_Less '<'> fd:16777215 arg_word:{(current_tracer)})] ) (AndOr ops: [Op_DAmp] children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ ($ VSub_Name '$mode'))} right: {(DQ (nop))} ) ) (C {(edie)} {(DQ ('ERROR: ftrace active (current_tracer=') ($ VSub_Name '$mode') (')'))}) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_pid) spids:[802 807]) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(set_ftrace_pid)})] ) (ForEach iter_name: tid iter_words: [{(/proc/) ($ VSub_Name '$pid') (/task/) (Lit_Other '*')}] do_arg_iter: F body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [ {(echo)} { (BracedVarSub token: <VSub_Name tid> suffix_op: (StringUnary op_id: VOp1_DPound arg_word: {('*') (Lit_Slash /)} ) spids: [845 850] ) } ] redirects: [ (Redir op: <Redir_DGreat '>>'> fd: 16777215 arg_word: {(set_ftrace_pid)} ) ] ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (C {(edie)} { (DQ ('ERROR: setting -p ') ($ VSub_Name '$pid') (' (PID exist?). Exiting.') ) } ) ] spids: [16777215 857] ) ] spids: [16777215 869] ) ] spids: [836 872] ) spids: [829 834] ) ] spids: [16777215 810] ) ] spids: [16777215 874] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_tid) spids:[878 883]) terminator: <Op_Semi ';'> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(echo)} {($ VSub_Name '$tid')}] redirects: [ (Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(set_ftrace_pid)} ) ] ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (C {(edie)} {(DQ ('ERROR: setting -L ') ($ VSub_Name '$tid') (' (TID exist?). Exiting.'))} ) ] spids: [16777215 902] ) ] spids: [16777215 914] ) ] spids: [16777215 886] ) ] spids: [16777215 916] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Name '$funcs'))}] redirects: [ (Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(set_ftrace_filter)} ) ] ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (C {(edie)} { (DQ ('ERROR: enabling ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$funcs') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('. Exiting.') ) } ) ] spids: [16777215 933] ) ] spids: [16777215 946] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(echo)} {(KW_Function function)}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(current_tracer)})] ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (C {(edie)} { (DQ ('ERROR: setting current_tracer to ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (function) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('. Exiting.') ) } ) ] spids: [16777215 961] ) ] spids: [16777215 974] ) (C {(warn)} {(DQ ('echo > trace'))}) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_duration) spids:[988 993]) terminator: <Op_Semi ';'> ) ] action: [ (C {(sleep)} {($ VSub_Name '$duration')}) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_headers) spids:[1006 1011]) terminator: <Op_Semi ';'> ) ] action: [(C {(cat)} {(trace)})] spids: [16777215 1014] ) ] else_action: [(C {(grep)} {(-v)} {(SQ <'^#'>)} {(trace)})] spids: [1022 1036] ) ] spids: [16777215 996] ) ] else_action: [ (AndOr ops: [Op_DAmp] children: [ (DParen child:(ArithVarRef name:opt_headers) spids:[1045 1050]) (C {(cat)} {(trace)}) ] ) (C {(cat)} {(trace_pipe)}) ] spids: [1038 1063] ) (C {(end)}) ] )