(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tracing)
          op: Equal
          rhs: {(/sys/kernel/debug/tracing)}
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:flock)
                  op: Equal
                  rhs: {(/var/tmp/.ftrace-lock)}
                )
              ]
            )
          terminator: <Op_Semi ';'>
        )
        (command.ShAssignment
          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:wroteflock) op:Equal rhs:{(0)})]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_duration) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:duration) op:Equal rhs:(word.Empty))]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_pid) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:pid) op:Equal rhs:(word.Empty))]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_tid) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.ShAssignment
          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:tid) op:Equal rhs:(word.Empty))]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_filter) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:filter) op:Equal rhs:(word.Empty))]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_view) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_headers) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_stack) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.ShAssignment
          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:dmesg) op:Equal rhs:{(2)})]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:debug) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.ShAssignment
          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_force) op:Equal rhs:{(0)})]
        )
      ]
    )
    (C {(trap)} {(SQ <':'>)} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)})
    (command.ShFunction
      name: usage
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.HereDoc
                  op: <Redir_DLessDash '<<-'>
                  fd: 16777215
                  here_begin: {(END)}
                  here_end_span_id: 286
                  stdin_parts: [
                    (
'USAGE: kprobe [-FhHsv] [-d secs] [-p PID] [-L TID] kprobe_definition [filter]\n'
                    )
                    ('                 -F              # force. trace despite warnings.\n')
                    ('                 -d seconds      # trace duration, and use buffers\n')
                    ('                 -p PID          # PID to match on events\n')
                    ('                 -L TID          # thread id to match on events\n')
                    ("                 -v              # view format file (don't trace)\n")
                    ('                 -H              # include column headers\n')
                    ('                 -s              # show kernel stack traces\n')
                    ('                 -h              # this usage message\n')
                    ('\n')
                    ('Note that these examples may need modification to match your kernel\n')
                    ("version's function names and platform's register usage.\n")
                    ('   eg,\n')
                    ('       kprobe p:do_sys_open\n')
                    ('                                 # trace open() entry\n')
                    ('       kprobe r:do_sys_open\n')
                    ('                                 # trace open() return\n')
                    ("       kprobe 'r:do_sys_open ")
                    (word_part.EscapedLiteral token:<Lit_EscapedChar '\\$'>)
                    ("retval'\n")
                    ('                                 # trace open() return value\n')
                    ("       kprobe 'r:myopen do_sys_open ")
                    (word_part.EscapedLiteral token:<Lit_EscapedChar '\\$'>)
                    ("retval'\n")
                    ('                                 # use a custom probe name\n')
                    ("       kprobe 'p:myopen do_sys_open mode=%cx:u16'\n")
                    ('                                 # trace open() file mode\n')
                    ("       kprobe 'p:myopen do_sys_open filename=+0(%si):string'\n")
                    ('                                 # trace open() with filename\n')
                    ("       kprobe -s 'p:myprobe tcp_retransmit_skb'\n")
                    ('                                 # show kernel stacks\n')
                    ("       kprobe 'p:do_sys_open file=+0(%si):string' 'file ~ ")
                    (Right_DoubleQuote '"')
                    ('*stat')
                    (Right_DoubleQuote '"')
                    ("'\n")
                    ('                                 # opened files ending in ')
                    (Right_DoubleQuote '"')
                    (stat)
                    (Right_DoubleQuote '"')
                    ('\n')
                    ('\n')
                    ('See the man page and example file for more info.\n')
                  ]
                )
                (redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})
              ]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit>)
          ]
        )
    )
    (command.ShFunction
      name: warn
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [(C {(eval)} {(DQ ($ VSub_At '$@'))})]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [
                        {(echo)}
                        {
                          (DQ ('WARNING: command failed ') 
                            (word_part.EscapedLiteral
                              token: <Lit_EscapedChar '\\"'>
                            ) ($ VSub_At '$@') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>)
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: end
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(echo)}]
              redirects: [(redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})]
            )
            (command.Simple
              words: [{(echo)} {(DQ ('Ending tracing...'))}]
              redirects: [(redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})]
            )
            (C {(cd)} {($ VSub_DollarName '$tracing')})
            (C {(warn)} {(DQ ('echo 0 > events/kprobes/') ($ VSub_DollarName '$kname') (/enable))})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DParen
                          child: (arith_expr.VarRef token:<Lit_ArithVarLike opt_filter>)
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(warn)} 
                      {(DQ ('echo 0 > events/kprobes/') ($ VSub_DollarName '$kname') (/filter))}
                    )
                  ]
                )
              ]
            )
            (C {(warn)} {(DQ ('echo -:') ($ VSub_DollarName '$kname') (' >> kprobe_events'))})
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (command.DParen
                  child: (arith_expr.VarRef token:<Lit_ArithVarLike opt_stack>)
                )
                (C {(warn)} {(DQ ('echo 0 > options/stacktrace'))})
              ]
            )
            (C {(warn)} {(DQ ('echo > trace'))})
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (command.DParen
                  child: (arith_expr.VarRef token:<Lit_ArithVarLike wroteflock>)
                )
                (C {(warn)} {(DQ ('rm ') ($ VSub_DollarName '$flock'))})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: die
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(echo)} {(DQ ($ VSub_At '$@'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
    )
    (command.ShFunction
      name: edie
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(echo)} {(DQ ($ VSub_At '$@'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.Simple
              words: [{(exec)}]
              redirects: [
                (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})
                (redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)})
              ]
            )
            (C {(end)})
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
    )
    (command.WhileUntil
      keyword: <KW_While while>
      cond: [
        (C {(getopts)} {(Fd) (Lit_Other ':') (hHp) (Lit_Other ':') (L) (Lit_Other ':') (sv)} {(opt)})
      ]
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ VSub_DollarName '$opt')}
              arms: [
                (case_arm
                  pat_list: [{(F)}]
                  action: [
                    (command.ShAssignment
                      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_force) op:Equal rhs:{(1)})]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(d)}]
                  action: [
                    (command.Sentence
                      child: 
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:opt_duration)
                              op: Equal
                              rhs: {(1)}
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:duration)
                          op: Equal
                          rhs: {($ VSub_DollarName '$OPTARG')}
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(p)}]
                  action: [
                    (command.Sentence
                      child: 
                        (command.ShAssignment
                          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_pid) op:Equal rhs:{(1)})]
                        )
                      terminator: <Op_Semi ';'>
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:pid)
                          op: Equal
                          rhs: {($ VSub_DollarName '$OPTARG')}
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(L)}]
                  action: [
                    (command.Sentence
                      child: 
                        (command.ShAssignment
                          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_tid) op:Equal rhs:{(1)})]
                        )
                      terminator: <Op_Semi ';'>
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:tid)
                          op: Equal
                          rhs: {($ VSub_DollarName '$OPTARG')}
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(H)}]
                  action: [
                    (command.ShAssignment
                      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_headers) op:Equal rhs:{(1)})]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(s)}]
                  action: [
                    (command.ShAssignment
                      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_stack) op:Equal rhs:{(1)})]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(v)}]
                  action: [
                    (command.ShAssignment
                      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_view) op:Equal rhs:{(1)})]
                    )
                  ]
                )
                (case_arm pat_list:[{(h)} {(Lit_QMark '?')}] action:[(C {(usage)})])
              ]
            )
          ]
        )
    )
    (C {(shift)} 
      {
        (word_part.ArithSub
          anode: 
            (arith_expr.Binary
              op_id: Arith_Minus
              left: (arith_expr.ArithWord w:{($ VSub_DollarName '$OPTIND')})
              right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
            )
        )
      }
    )
    (command.AndOr
      ops: [Op_DPipe]
      children: [(command.DParen child:(arith_expr.ArithWord w:{($ VSub_Pound '$#')})) (C {(usage)})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:kprobe) op:Equal rhs:{($ VSub_Number '$1')})]
    )
    (C {(shift)})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.ArithWord w:{($ VSub_Pound '$#')}))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_filter) op:Equal rhs:{(1)})]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filter)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                )
              ]
            )
          ]
        )
      ]
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (command.DParen
          child: 
            (arith_expr.Binary
              op_id: Arith_Great
              left: 
                (arith_expr.Binary
                  op_id: Arith_Plus
                  left: 
                    (arith_expr.Binary
                      op_id: Arith_Plus
                      left: (arith_expr.VarRef token:<Lit_ArithVarLike opt_pid>)
                      right: (arith_expr.VarRef token:<Lit_ArithVarLike opt_filter>)
                    )
                  right: (arith_expr.VarRef token:<Lit_ArithVarLike opt_tid>)
                )
              right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
            )
        )
        (C {(die)} {(DQ ('ERROR: use at most one of -p, -L, or filter.'))})
      ]
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (command.DParen
          child: 
            (arith_expr.Binary
              op_id: Arith_DAmp
              left: (arith_expr.VarRef token:<Lit_ArithVarLike opt_duration>)
              right: (arith_expr.VarRef token:<Lit_ArithVarLike opt_view>)
            )
        )
        (C {(die)} {(DQ ('ERROR: use either -d or -v.'))})
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_pid>))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_filter) op:Equal rhs:{(1)})]
            )
            (command.ForEach
              iter_name: tid
              iter_words: [{(/proc/) ($ VSub_DollarName '$pid') (/task/) (Lit_Star '*')}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:filter)
                          op: Equal
                          rhs: 
                            {
                              (DQ ($ VSub_DollarName '$filter') (' || common_pid == ') 
                                (braced_var_sub
                                  token: <VSub_Name tid>
                                  suffix_op: 
                                    (suffix_op.Unary
                                      op_id: VOp1_DPound
                                      arg_word: {('*') (Lit_Slash /)}
                                    )
                                )
                              )
                            }
                        )
                      ]
                    )
                  ]
                )
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filter)
                  op: Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <VSub_Name filter>
                        suffix_op: (suffix_op.Slice begin:(arith_expr.ArithWord w:{(Lit_Digits 3)}))
                      )
                    }
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_tid>))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_filter) op:Equal rhs:{(1)})]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filter)
                  op: Equal
                  rhs: {(DQ ('common_pid == ') ($ VSub_DollarName '$tid'))}
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalAnd
                      left: 
                        (bool_expr.Binary
                          op_id: BoolBinary_GlobNEqual
                          left: {(DQ ($ VSub_DollarName '$kprobe'))}
                          right: {(p) (Lit_Other ':') (Lit_Other '*')}
                        )
                      right: 
                        (bool_expr.Binary
                          op_id: BoolBinary_GlobNEqual
                          left: {(DQ ($ VSub_DollarName '$kprobe'))}
                          right: {(r) (Lit_Other ':') (Lit_Other '*')}
                        )
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Simple
              words: [{(echo)} {(DQ ('ERROR: invalid kprobe definition (should start with p: or r:)'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (C {(usage)})
          ]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:krest)
          op: Equal
          rhs: 
            {
              (braced_var_sub
                token: <VSub_Name kprobe>
                suffix_op: (suffix_op.Unary op_id:VOp1_Pound arg_word:{('*:')})
              )
            }
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:kname)
          op: Equal
          rhs: 
            {
              (braced_var_sub
                token: <VSub_Name krest>
                suffix_op: (suffix_op.Unary op_id:VOp1_DPercent arg_word:{(' *')})
              )
            }
        )
      ]
    )
    (C {(KW_Set set)} {(--)} {($ VSub_DollarName '$krest')})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalOr
                      left: (bool_expr.Binary op_id:BoolBinary_GlobDEqual left:{($ VSub_Number '$2')} right:{(DQ )})
                      right: 
                        (bool_expr.Binary
                          op_id: BoolBinary_GlobDEqual
                          left: {($ VSub_Number '$2')}
                          right: 
                            {(Lit_Other '*') (Lit_Other '[') (BoolBinary_GlobEqual '=') (Lit_Other '%') 
                              (word_part.EscapedLiteral
                                token: <Lit_EscapedChar '\\$'>
                              ) (Lit_Other ']') (Lit_Other '*')
                            }
                        )
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:ktype)
                  op: Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <VSub_Name kprobe>
                        suffix_op: (suffix_op.Unary op_id:VOp1_DPercent arg_word:{(':*')})
                      )
                    }
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:kprobe)
                  op: Equal
                  rhs: 
                    {
                      (DQ ($ VSub_DollarName '$ktype') (':') ($ VSub_DollarName '$kname') (' ') 
                        ($ VSub_DollarName '$krest')
                      )
                    }
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike debug>))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} 
              {
                (DQ ('kname: ') ($ VSub_DollarName '$kname') (', kprobe: ') 
                  ($ VSub_DollarName '$kprobe')
                )
              }
            )
          ]
        )
      ]
    )
    (command.AndOr
      ops: [Op_DPipe]
      children: [
        (C {(cd)} {($ VSub_DollarName '$tracing')})
        (C {(die)} 
          {
            (DQ ('ERROR: accessing tracing. Root user? Kernel has FTRACE?\n') 
              ('    debugfs mounted? (mount -t debugfs debugfs /sys/kernel/debug)')
            )
          }
        )
      ]
    )
    (C {(KW_Set set)} {(--)} {($ VSub_DollarName '$kprobe')})
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:fname) op:Equal rhs:{($ VSub_Number '$2')})]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (command.DParen
                  child: 
                    (arith_expr.Unary
                      op_id: Arith_Bang
                      child: (arith_expr.VarRef token:<Lit_ArithVarLike opt_force>)
                    )
                )
                (command.Pipeline
                  children: [
                    (command.Simple
                      words: [
                        {(grep)}
                        {(-w)}
                        {($ VSub_DollarName '$fname')}
                        {(available_filter_functions)}
                      ]
                      redirects: [
                        (redir.Redir
                          op: <Redir_Great '>'>
                          fd: 16777215
                          arg_word: {(/dev/null)}
                        )
                        (redir.Redir
                          op: <Redir_GreatAnd '2>&'>
                          fd: 2
                          arg_word: {(1)}
                        )
                      ]
                    )
                  ]
                  negated: T
                )
              ]
            )
          ]
          action: [
            (command.Simple
              words: [
                {(echo)}
                {
                  (DQ ('ERROR: func ') ($ VSub_DollarName '$fname') (' not in ') 
                    ($ VSub_DollarName '$PWD') (/available_filter_functions.)
                  )
                }
              ]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.Simple
              words: [{(printf)} {(DQ ("Either it doesn't exist, or, it might be unsafe to kprobe. "))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.Simple
              words: [{(echo)} {(DQ ('Exiting. Use -F to override.'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DParen
                  child: 
                    (arith_expr.Unary
                      op_id: Arith_Bang
                      child: (arith_expr.VarRef token:<Lit_ArithVarLike opt_view>)
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DParen
                          child: (arith_expr.VarRef token:<Lit_ArithVarLike opt_duration>)
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ ('Tracing kprobe ') ($ VSub_DollarName '$kname') (' for ') 
                          ($ VSub_DollarName '$duration') (' seconds (buffered)...')
                        )
                      }
                    )
                  ]
                )
              ]
              else_action: [
                (C {(echo)} {(DQ ('Tracing kprobe ') ($ VSub_DollarName '$kname') ('. Ctrl-C to end.'))})
              ]
            )
          ]
        )
      ]
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (command.DBracket
          expr: (bool_expr.Unary op_id:BoolUnary_e child:{($ VSub_DollarName '$flock')})
        )
        (C {(die)} 
          {
            (DQ ('ERROR: ftrace may be in use by PID ') 
              (command_sub
                left_token: <Left_DollarParen '$('>
                command_list: 
                  (command.CommandList
                    children: [(C {(cat)} {($ VSub_DollarName '$flock')})]
                  )
              ) (' ') ($ VSub_DollarName '$flock')
            )
          }
        )
      ]
    )
    (command.AndOr
      ops: [Op_DPipe]
      children: [
        (command.Simple
          words: [{(echo)} {($ VSub_Dollar '$$')}]
          redirects: [
            (redir.Redir
              op: <Redir_Great '>'>
              fd: 16777215
              arg_word: {($ VSub_DollarName '$flock')}
            )
          ]
        )
        (C {(die)} {(DQ ('ERROR: unable to write ') ($ VSub_DollarName '$flock') (.))})
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:wroteflock) op:Equal rhs:{(1)})]
    )
    (command.Simple
      words: [{(echo)} {(nop)}]
      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(current_tracer)})]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.Pipeline
                  children: [
                    (command.Simple
                      words: [{(echo)} {(DQ ($ VSub_DollarName '$kprobe'))}]
                      redirects: [
                        (redir.Redir
                          op: <Redir_DGreat '>>'>
                          fd: 16777215
                          arg_word: {(kprobe_events)}
                        )
                      ]
                    )
                  ]
                  negated: T
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.Simple
              words: [
                {(echo)}
                {
                  (DQ ('ERROR: adding kprobe ') 
                    (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) ($ VSub_DollarName '$kprobe') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (.)
                  )
                }
              ]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike dmesg>))
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [
                        {(echo)}
                        {
                          (DQ ('Last ') ($ VSub_DollarName '$dmesg') 
                            (' dmesg entries (might contain reason):')
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                    (command.Pipeline
                      children: [
                        (C {(dmesg)})
                        (C {(tail)} {(-) ($ VSub_DollarName '$dmesg')})
                        (C {(sed)} {(SQ <'s/^/    /'>)})
                      ]
                      negated: F
                    )
                  ]
                )
              ]
            )
            (C {(edie)} {(DQ (Exiting.))})
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_view>))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(cat)} {(events/kprobes/) ($ VSub_DollarName '$kname') (/format)}) (C {(edie)} {(DQ )})]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_filter>))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [{(echo)} {(DQ ($ VSub_DollarName '$filter'))}]
                              redirects: [
                                (redir.Redir
                                  op: <Redir_Great '>'>
                                  fd: 16777215
                                  arg_word: {(events/kprobes/) ($ VSub_DollarName '$kname') (/filter)}
                                )
                              ]
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(edie)} {(DQ ('ERROR: setting filter or -p. Exiting.'))})]
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_stack>))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [{(echo)} {(1)}]
                              redirects: [
                                (redir.Redir
                                  op: <Redir_Great '>'>
                                  fd: 16777215
                                  arg_word: {(options/stacktrace)}
                                )
                              ]
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(edie)} {(DQ ('ERROR: enabling stack traces (-s). Exiting'))})]
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.Pipeline
                  children: [
                    (command.Simple
                      words: [{(echo)} {(1)}]
                      redirects: [
                        (redir.Redir
                          op: <Redir_Great '>'>
                          fd: 16777215
                          arg_word: {(events/kprobes/) ($ VSub_DollarName '$kname') (/enable)}
                        )
                      ]
                    )
                  ]
                  negated: T
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(edie)} {(DQ ('ERROR: enabling kprobe ') ($ VSub_DollarName '$kname') ('. Exiting.'))})
          ]
        )
      ]
    )
    (C {(warn)} {(DQ ('echo > trace'))})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_duration>))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(sleep)} {($ VSub_DollarName '$duration')})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DParen
                          child: (arith_expr.VarRef token:<Lit_ArithVarLike opt_headers>)
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(cat)} {(trace)})]
                )
              ]
              else_action: [(C {(grep)} {(-v)} {(SQ <'^#'>)} {(trace)})]
            )
          ]
        )
      ]
      else_action: [
        (command.AndOr
          ops: [Op_DAmp]
          children: [
            (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_headers>))
            (C {(cat)} {(trace)})
          ]
        )
        (C {(cat)} {(trace_pipe)})
      ]
    )
    (C {(end)})
  ]
)