(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: [112] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:flock) op: assign_op.Equal rhs: {(/var/tmp/.ftrace-lock)} spids: [115] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_force) op: assign_op.Equal rhs: {(0)} spids: [118] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:120) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_quiet) op: assign_op.Equal rhs: {(0)} spids: [122] ) ] ) ] ) (command.ShFunction name: usage body: (command.BraceGroup children: [ (command.Simple words: [{(cat)}] redirects: [ (redir.HereDoc op: (Token id:Id.Redir_DLessDash val:'<<-' span_id:135) fd: -1 here_begin: {(END)} here_end_span_id: 148 stdin_parts: [ ('USAGE: reset-ftrace [-fhq]\n') (' -f # force: delete ftrace lock file\n') (' -q # quiet: reset, but say nothing\n') (' -h # this usage message\n') (' eg,\n') (' reset-ftrace # disable active ftrace session\n') ] ) (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:138) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:150) ) ] ) ) (command.ShFunction name: warn body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [(C {(eval)} {(DQ ($ Id.VSub_At '$@'))})] negated: T ) terminator: (Token id:Id.Op_Semi val:';' span_id:171) ) ] action: [ (command.Simple words: [ {(echo)} { (DQ ('WARNING: command failed ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:183) ) ($ Id.VSub_At '$@') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:185) ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:178) fd: -1 arg_word: {(2)} ) ] ) ] spids: [162 173] ) ] ) ] ) ) (command.ShFunction name: die body: (command.BraceGroup children: [ (command.Simple words: [{(echo)} {(DQ ($ Id.VSub_At '$@'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:203) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:211) arg_word: {(1)} ) ] ) ) (command.ShFunction name: vecho body: (command.BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:opt_quiet span_id:227) ) ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:234) ) ] ) (C {(echo)} {(DQ ($ Id.VSub_At '$@'))}) ] ) ) (command.ShFunction name: writefile body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:file) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [256] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:string) op: assign_op.Equal rhs: {($ Id.VSub_Number '$2')} spids: [260] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.LogicalNot child: (bool_expr.Unary op_id: Id.BoolUnary_w child: {($ Id.VSub_DollarName '$file')} ) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:278) ) ] action: [ (command.Simple words: [ {(echo)} { (DQ ('WARNING: file ') ($ Id.VSub_DollarName '$file') (' not writable/exists. Skipping.') ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:285) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:295) ) ] spids: [267 280] ) ] ) (C {(vecho)} {(DQ ($ Id.VSub_DollarName '$file') (', before:'))}) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child: (arith_expr.Unary op_id: Id.Arith_Bang child: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:opt_quiet span_id:313) ) ) ) (C {(cat)} {(-n)} {($ Id.VSub_DollarName '$file')}) ] ) (C {(warn)} {(DQ ('echo ') ($ Id.VSub_DollarName '$string') (' > ') ($ Id.VSub_DollarName '$file'))} ) (C {(vecho)} {(DQ ($ Id.VSub_DollarName '$file') (', after:'))}) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child: (arith_expr.Unary op_id: Id.Arith_Bang child: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:opt_quiet span_id:349) ) ) ) (C {(cat)} {(-n)} {($ Id.VSub_DollarName '$file')}) ] ) (C {(vecho)}) ] ) ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:371) cond: [(C {(getopts)} {(fhq)} {(opt)})] body: (command.DoGroup children: [ (command.Case to_match: {($ Id.VSub_DollarName '$opt')} arms: [ (case_arm pat_list: [{(f)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_force) op: assign_op.Equal rhs: {(1)} spids: [392] ) ] ) ] spids: [389 390 395 -1] ) (case_arm pat_list: [{(q)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_quiet) op: assign_op.Equal rhs: {(1)} spids: [401] ) ] ) ] spids: [398 399 404 -1] ) (case_arm pat_list: [{(h)} {(Id.Lit_QMark '?')}] action: [(C {(usage)})] spids: [407 410 414 -1] ) ] ) ] ) ) (C {(shift)} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$OPTIND')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id:Id.BoolUnary_e child:{($ Id.VSub_DollarName '$flock')}) ) terminator: (Token id:Id.Op_Semi val:';' span_id:447) ) ] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:opt_force span_id:456) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:460) ) ] action: [(C {(warn)} {(rm)} {($ Id.VSub_DollarName '$flock')})] spids: [452 462] ) ] else_action: [ (command.Simple words: [ {(echo)} {(-e)} { (DQ ('ERROR: ftrace lock (') ($ Id.VSub_DollarName '$flock') (') exists. It shows') ) } { (DQ ('ftrace may be in use by PID ') (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:492) command_list: (command.CommandList children: [(C {(cat)} {($ Id.VSub_DollarName '$flock')})] ) ) (.) (Id.Lit_Other '\\') ('nDouble check') ) } {(DQ ('to see if that PID is still active. If not, consider'))} {(DQ ('using -f to force a reset. Exiting.'))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:479) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:515) arg_word: {(1)} ) ] ) ] spids: [438 449] ) ] ) (C {(vecho)} {(DQ ('Reseting ftrace state...'))}) (C {(vecho)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(cd)} {($ Id.VSub_DollarName '$tracing')}) (C {(die)} {(DQ ('ERROR: accessing tracing. Root user? Kernel has FTRACE?'))}) ] ) (C {(writefile)} {(current_tracer)} {(nop)}) (C {(writefile)} {(set_ftrace_filter)}) (C {(writefile)} {(set_graph_function)}) (C {(writefile)} {(set_ftrace_pid)}) (C {(writefile)} {(events/enable)} {(0)}) (C {(writefile)} {(tracing_thresh)} {(0)}) (C {(writefile)} {(kprobe_events)}) (C {(writefile)} {(tracing_on)} {(1)}) (C {(vecho)} {(DQ (Done.))}) ] )