(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] ) (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_id: Redir_DLessDash fd: 16777215 body: { (DQ ('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') ) } do_expansion: True here_end: END was_filled: T spids: [236] ) (Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[239]) ] ) (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_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[298])] ) ] spids: [16777215 293] ) ] spids: [16777215 309] ) ] spids: [279] ) spids: [275 278] ) (FuncDef name: end body: (BraceGroup children: [ (SimpleCommand words: [{(echo)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[327])] ) (SimpleCommand words: [{(echo)} {(DQ ('Ending tracing...'))}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[337])] ) (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) ) ) (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)) (C {(warn)} {(DQ ('rm ') ($ VSub_Name '$flock'))}) ] ) ] spids: [318] ) spids: [314 317] ) (FuncDef name: die body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_At '$@'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[415])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [410] ) spids: [406 409] ) (FuncDef name: edie body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_At '$@'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[443])] ) (SimpleCommand words: [{(exec)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(/dev/null)} spids: [453] ) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[456]) ] ) (C {(end)}) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [434] ) spids: [430 433] ) (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: [499] ) ] spids: [499] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:duration) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [503] ) ] spids: [503] ) ] spids: [496 497 506 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: [512] ) ] spids: [512] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pid) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [516] ) ] spids: [516] ) ] spids: [509 510 519 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: [525] ) ] spids: [525] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tid) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [529] ) ] spids: [529] ) ] spids: [522 523 532 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: [538] ) ] spids: [538] ) terminator: <Op_Semi ';'> ) ] spids: [535 536 542 16777215] ) (case_arm pat_list: [{(h)} {(Lit_Other '?')}] action: [(C {(usage)})] spids: [545 548 552 16777215] ) ] spids: [489 493 555] ) ] spids: [486 557] ) ) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithWord w:{($ VSub_Name '$OPTIND')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [561 570] ) } ) (AndOr ops: [Op_DAmp] children: [ (DParen child: (ArithBinary op_id: Arith_DEqual left: (ArithWord w:{($ VSub_Pound '$#')}) right: (ArithWord w:{(Lit_Digits 0)}) ) ) (C {(usage)}) ] ) (AndOr ops: [Op_DAmp] children: [ (DParen child: (ArithBinary op_id: Arith_DAmp left: (ArithVarRef name:opt_pid) right: (ArithVarRef name:opt_tid) ) ) (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: [610] ) ] spids: [610] ) (AndOr ops: [Op_DAmp] children: [ (DParen child:(ArithVarRef name:opt_pid)) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pidtext) op: Equal rhs: {(DQ (' for PID ') ($ VSub_Name '$pid'))} spids: [624] ) ] spids: [624] ) ] ) (AndOr ops: [Op_DAmp] children: [ (DParen child:(ArithVarRef name:opt_tid)) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pidtext) op: Equal rhs: {(DQ (' for TID ') ($ VSub_Name '$pid'))} spids: [639] ) ] spids: [639] ) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_duration)) 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 655] ) ] 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: [671 685] ) (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: [722 726] ) (' ') ($ VSub_Name '$flock') ) } ) ] ) (AndOr ops: [Op_DPipe] children: [ (SimpleCommand words: [{(echo)} {($ VSub_Dollar '$$')}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {($ VSub_Name '$flock')} spids: [735] ) ] ) (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:[749])] spids: [749] ) (C {(sysctl)} {(-q)} {(kernel.ftrace_enabled) (Lit_Other '=') (1)}) (SimpleCommand words: [{(read)} {(mode)}] redirects: [(Redir op_id:Redir_Less fd:16777215 arg_word:{(current_tracer)} spids:[771])] ) (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)) terminator:<Op_Semi ';'>)] action: [ (SimpleCommand words: [{(echo)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(set_ftrace_pid)} spids: [814] ) ] ) (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: [844 849] ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: 16777215 arg_word: {(set_ftrace_pid)} spids: [851] ) ] ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (C {(edie)} { (DQ ('ERROR: setting -p ') ($ VSub_Name '$pid') (' (PID exist?). Exiting.') ) } ) ] spids: [16777215 856] ) ] spids: [16777215 868] ) ] spids: [835 871] ) spids: [828 833] ) ] spids: [16777215 809] ) ] spids: [16777215 873] ) (If arms: [ (if_arm cond: [(Sentence child:(DParen child:(ArithVarRef name:opt_tid)) terminator:<Op_Semi ';'>)] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(echo)} {($ VSub_Name '$tid')}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(set_ftrace_pid)} spids: [896] ) ] ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (C {(edie)} {(DQ ('ERROR: setting -L ') ($ VSub_Name '$tid') (' (TID exist?). Exiting.'))} ) ] spids: [16777215 901] ) ] spids: [16777215 913] ) ] spids: [16777215 885] ) ] spids: [16777215 915] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Name '$funcs'))}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(set_ftrace_filter)} spids: [927] ) ] ) ] 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 932] ) ] spids: [16777215 945] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(echo)} {(KW_Function function)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(current_tracer)} spids: [955] ) ] ) ] 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 960] ) ] spids: [16777215 973] ) (C {(warn)} {(DQ ('echo > trace'))}) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_duration)) terminator: <Op_Semi ';'> ) ] action: [ (C {(sleep)} {($ VSub_Name '$duration')}) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_headers)) terminator: <Op_Semi ';'> ) ] action: [(C {(cat)} {(trace)})] spids: [16777215 1013] ) ] else_action: [(C {(grep)} {(-v)} {(SQ <'^#'>)} {(trace)})] spids: [1021 1035] ) ] spids: [16777215 995] ) ] else_action: [ (AndOr ops: [Op_DAmp] children: [(DParen child:(ArithVarRef name:opt_headers)) (C {(cat)} {(trace)})] ) (C {(cat)} {(trace_pipe)}) ] spids: [1037 1062] ) (C {(end)}) ] )