(command.CommandList
  children: [
    (command.Simple
      blame_tok: <_Dbg_help_add>
      more_env: []
      words: [
        {<_Dbg_help_add>}
        {<trace>}
        {
          (SQ <'**trace** *function*\n'> <'\n'> <'trace alias *alias*\n'> <'\n'> 
            <'Set "xtrace" (set -x) tracing when *function is called.\n'> <'\n'> <'See also "untrace" and "debug".'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.ShFunction
      keyword: <Id.KW_Function function>
      name_tok: <_Dbg_do_trace>
      name: _Dbg_do_trace
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.If
              if_kw: <Id.KW_If if>
              arms: [
                (IfArm
                  keyword: <Id.KW_If if>
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DParen
                              left: <Id.Op_DLeftParen _>
                              child: 
                                (arith_expr.Binary
                                  op_id: Id.Arith_DEqual
                                  left: {($ Id.VSub_Pound '#')}
                                  right: {<Id.Lit_Digits 0>}
                                )
                              right: <Id.Op_DRightParen _>
                              redirects: []
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  then_kw: <Id.KW_Then then>
                  action: [
                    (command.Simple
                      blame_tok: <_Dbg_errmsg>
                      more_env: []
                      words: [{<_Dbg_errmsg>} {(DQ <'trace: missing function name.'>)}]
                      redirects: []
                      do_fork: T
                    )
                    (command.ControlFlow
                      keyword: <Id.ControlFlow_Return return>
                      arg_word: {<2>}
                    )
                  ]
                  spids: [96 109]
                )
              ]
              else_action: []
              fi_kw: <Id.KW_Fi fi>
              redirects: []
            )
            (command.Simple
              blame_tok: <typeset>
              more_env: []
              words: [{<typeset>} {<-r>} {<Id.Lit_VarLike 'fn='> ($ Id.VSub_Number 1)}]
              redirects: []
              do_fork: T
            )
            (command.Simple
              blame_tok: <typeset>
              more_env: []
              words: [
                {<typeset>}
                {<-ri>}
                {<Id.Lit_VarLike 'clear_debug_trap='> 
                  (BracedVarSub
                    left: <Id.Left_DollarBrace '${'>
                    token: <Id.VSub_Number 2>
                    var_name: 2
                    suffix_op: (suffix_op.Unary op:<Id.VTest_ColonHyphen _> arg_word:{<1>})
                    right: <Id.Right_DollarBrace '}'>
                  )
                }
              ]
              redirects: []
              do_fork: T
            )
            (command.AndOr
              children: [
                (command.Simple
                  blame_tok: <_Dbg_is_function>
                  more_env: []
                  words: [
                    {<_Dbg_is_function>}
                    {(DQ ($ Id.VSub_DollarName fn))}
                    {($ Id.VSub_DollarName _Dbg_set_debug)}
                  ]
                  redirects: []
                  do_fork: T
                )
                (BraceGroup
                  left: <Id.Lit_LBrace '{'>
                  children: [
                    (command.Simple
                      blame_tok: <_Dbg_errmsg>
                      more_env: []
                      words: [
                        {<_Dbg_errmsg>}
                        {
                          (DQ <'trace: function '> 
                            (word_part.EscapedLiteral
                              token: <Id.Lit_EscapedChar '\\"'>
                              ch: '"'
                            ) ($ Id.VSub_DollarName fn) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'> ch:'"') 
                            <' is not a function.'>
                          )
                        }
                      ]
                      redirects: []
                      do_fork: T
                    )
                    (command.ControlFlow
                      keyword: <Id.ControlFlow_Return return>
                      arg_word: {<3>}
                    )
                  ]
                  redirects: []
                  right: <Id.Lit_RBrace '}'>
                )
              ]
              ops: [<Id.Op_DPipe _>]
            )
            (command.AndOr
              children: [
                (command.ShAssignment
                  left: <Id.Lit_VarLike 'cmd='>
                  pairs: [
                    (AssignPair
                      left: <Id.Lit_VarLike 'cmd='>
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'cmd='> name:cmd)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (CommandSub
                            left_token: <Id.Left_DollarParen '$('>
                            child: 
                              (command.Simple
                                blame_tok: <typeset>
                                more_env: []
                                words: [{<typeset>} {<-f>} {<-->} {(DQ ($ Id.VSub_DollarName fn))}]
                                redirects: []
                                do_fork: T
                              )
                            right: <Id.Eof_RParen _>
                          )
                        }
                    )
                  ]
                  redirects: []
                )
                (BraceGroup
                  left: <Id.Lit_LBrace '{'>
                  children: [
                    (command.Simple
                      blame_tok: <_Dbg_errmsg>
                      more_env: []
                      words: [
                        {<_Dbg_errmsg>}
                        {
                          (DQ <'Can\'t find function definition for definition '> 
                            (word_part.EscapedLiteral
                              token: <Id.Lit_EscapedChar '\\"'>
                              ch: '"'
                            ) ($ Id.VSub_DollarName fn) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'> ch:'"') <.>
                          )
                        }
                      ]
                      redirects: []
                      do_fork: T
                    )
                    (command.ControlFlow
                      keyword: <Id.ControlFlow_Return return>
                      arg_word: {<4>}
                    )
                  ]
                  redirects: []
                  right: <Id.Lit_RBrace '}'>
                )
              ]
              ops: [<Id.Op_DPipe _>]
            )
            (command.If
              if_kw: <Id.KW_If if>
              arms: [
                (IfArm
                  keyword: <Id.KW_If if>
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              left: <Id.KW_DLeftBracket '[['>
                              expr: 
                                (bool_expr.Binary
                                  op_id: Id.BoolBinary_EqualTilde
                                  left: {($ Id.VSub_DollarName cmd)}
                                  right: {(SQ <'^function '>)}
                                )
                              right: <Id.Lit_DRightBracket ']]'>
                              redirects: []
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  then_kw: <Id.KW_Then then>
                  action: [
                    (command.ShAssignment
                      left: <Id.Lit_VarLike 'cmd='>
                      pairs: [
                        (AssignPair
                          left: <Id.Lit_VarLike 'cmd='>
                          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'cmd='> name:cmd)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ <'function old_'> 
                                (BracedVarSub
                                  left: <Id.Left_DollarBrace '${'>
                                  token: <Id.VSub_Name cmd>
                                  var_name: cmd
                                  suffix_op: (suffix_op.Slice begin:{<Id.Lit_Digits 9>})
                                  right: <Id.Arith_RBrace _>
                                )
                              )
                            }
                        )
                      ]
                      redirects: []
                    )
                  ]
                  spids: [216 232]
                )
              ]
              else_kw: <Id.KW_Else else>
              else_action: [
                (command.ShAssignment
                  left: <Id.Lit_VarLike 'cmd='>
                  pairs: [
                    (AssignPair
                      left: <Id.Lit_VarLike 'cmd='>
                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'cmd='> name:cmd)
                      op: assign_op.Equal
                      rhs: {(DQ <old_> (${ Id.VSub_Name cmd))}
                    )
                  ]
                  redirects: []
                )
              ]
              fi_kw: <Id.KW_Fi fi>
              redirects: []
            )
            (command.AndOr
              children: [
                (command.DParen
                  left: <Id.Op_DLeftParen _>
                  child: ($ Id.Lit_ArithVarLike _Dbg_set_debug)
                  right: <Id.Op_DRightParen _>
                  redirects: []
                )
                (command.Simple
                  blame_tok: <echo>
                  more_env: []
                  words: [{<echo>} {(DQ ($ Id.VSub_DollarName cmd))}]
                  redirects: []
                  do_fork: T
                )
              ]
              ops: [<Id.Op_DAmp _>]
            )
            (command.Simple
              blame_tok: <typeset>
              more_env: []
              words: [{<typeset>} {<Id.Lit_VarLike 'save_clear_debug_trap_cmd='> (SQ )}]
              redirects: []
              do_fork: T
            )
            (command.Simple
              blame_tok: <typeset>
              more_env: []
              words: [{<typeset>} {<Id.Lit_VarLike 'restore_trap_cmd='> (SQ )}]
              redirects: []
              do_fork: T
            )
            (command.If
              if_kw: <Id.KW_If if>
              arms: [
                (IfArm
                  keyword: <Id.KW_If if>
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DParen
                              left: <Id.Op_DLeftParen _>
                              child: ($ Id.Lit_ArithVarLike clear_debug_trap)
                              right: <Id.Op_DRightParen _>
                              redirects: []
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  then_kw: <Id.KW_Then then>
                  action: [
                    (command.ShAssignment
                      left: <Id.Lit_VarLike 'save_clear_trap_cmd='>
                      pairs: [
                        (AssignPair
                          left: <Id.Lit_VarLike 'save_clear_trap_cmd='>
                          lhs: 
                            (sh_lhs_expr.Name
                              left: <Id.Lit_VarLike 'save_clear_trap_cmd='>
                              name: save_clear_trap_cmd
                            )
                          op: assign_op.Equal
                          rhs: {(SQ <'local old_handler=$(trap -p DEBUG); trap - DEBUG'>)}
                        )
                      ]
                      redirects: []
                    )
                    (command.ShAssignment
                      left: <Id.Lit_VarLike 'restore_trap_cmd='>
                      pairs: [
                        (AssignPair
                          left: <Id.Lit_VarLike 'restore_trap_cmd='>
                          lhs: 
                            (sh_lhs_expr.Name
                              left: <Id.Lit_VarLike 'restore_trap_cmd='>
                              name: restore_trap_cmd
                            )
                          op: assign_op.Equal
                          rhs: {(SQ <'eval $old_handler'>)}
                        )
                      ]
                      redirects: []
                    )
                  ]
                  spids: [289 300]
                )
              ]
              else_action: []
              fi_kw: <Id.KW_Fi fi>
              redirects: []
            )
            (command.AndOr
              children: [
                (command.Simple
                  blame_tok: <eval>
                  more_env: []
                  words: [{<eval>} {(DQ ($ Id.VSub_DollarName cmd))}]
                  redirects: []
                  do_fork: T
                )
                (BraceGroup
                  left: <Id.Lit_LBrace '{'>
                  children: [
                    (command.Simple
                      blame_tok: <_Dbg_errmsg>
                      more_env: []
                      words: [
                        {<_Dbg_errmsg>}
                        {
                          (DQ <'Error in renaming function '> 
                            (word_part.EscapedLiteral
                              token: <Id.Lit_EscapedChar '\\"'>
                              ch: '"'
                            ) ($ Id.VSub_DollarName fn) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'> ch:'"') <' to '> 
                            (word_part.EscapedLiteral
                              token: <Id.Lit_EscapedChar '\\"'>
                              ch: '"'
                            ) <old_> (${ Id.VSub_Name fn) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'> ch:'"') <.>
                          )
                        }
                      ]
                      redirects: []
                      do_fork: T
                    )
                    (command.ControlFlow
                      keyword: <Id.ControlFlow_Return return>
                      arg_word: {<5>}
                    )
                  ]
                  redirects: []
                  right: <Id.Lit_RBrace '}'>
                )
              ]
              ops: [<Id.Op_DPipe _>]
            )
            (command.ShAssignment
              left: <Id.Lit_VarLike 'cmd='>
              pairs: [
                (AssignPair
                  left: <Id.Lit_VarLike 'cmd='>
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'cmd='> name:cmd)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ (${ Id.VSub_Name fn) <'() {\n'> <'    '> 
                        ($ Id.VSub_DollarName save_clear_trap_cmd) <'\n'> <'    typeset -ri old_set_x=is_traced\n'> <'    set -x\n'> <'    old_'> ($ Id.VSub_DollarName fn) 
                        <' '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'> ch:'"') 
                        (word_part.EscapedLiteral
                          token: <Id.Lit_EscapedChar '\\$'>
                          ch: '$'
                        ) <'@'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'> ch:'"') <'\n'> <'    typeset -ri rc='> 
                        (word_part.EscapedLiteral
                          token: <Id.Lit_EscapedChar '\\$'>
                          ch: '$'
                        ) <'?\n'> <'    (( old_set_x == 0 )) && set +x # still messes up of fn did: set -x\n'> <'    '> 
                        ($ Id.VSub_DollarName restore_trap_cmd) <'\n'> <'    return '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'> ch:'$') <'rc\n'> 
                        <'    }\n'>
                      )
                    }
                )
              ]
              redirects: []
            )
            (command.AndOr
              children: [
                (command.DParen
                  left: <Id.Op_DLeftParen _>
                  child: ($ Id.Lit_ArithVarLike _Dbg_set_debug)
                  right: <Id.Op_DRightParen _>
                  redirects: []
                )
                (command.Simple
                  blame_tok: <echo>
                  more_env: []
                  words: [{<echo>} {(DQ ($ Id.VSub_DollarName cmd))}]
                  redirects: []
                  do_fork: T
                )
              ]
              ops: [<Id.Op_DAmp _>]
            )
            (command.AndOr
              children: [
                (command.Simple
                  blame_tok: <eval>
                  more_env: []
                  words: [{<eval>} {(DQ ($ Id.VSub_DollarName cmd))}]
                  redirects: []
                  do_fork: T
                )
                (command.ControlFlow
                  keyword: <Id.ControlFlow_Return return>
                  arg_word: {<6>}
                )
              ]
              ops: [<Id.Op_DPipe _>]
            )
            (command.Simple
              blame_tok: <_Dbg_msg>
              more_env: []
              words: [
                {<_Dbg_msg>}
                {
                  (DQ (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'> ch:'"') 
                    ($ Id.VSub_DollarName fn) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'> ch:'"') <' renamed '> 
                    (word_part.EscapedLiteral
                      token: <Id.Lit_EscapedChar '\\"'>
                      ch: '"'
                    ) <old_> (${ Id.VSub_Name fn) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'> ch:'"') 
                    <' and traced by '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'> ch:'"') (${ Id.VSub_Name fn) 
                    (word_part.EscapedLiteral
                      token: <Id.Lit_EscapedChar '\\"'>
                      ch: '"'
                    ) <.>
                  )
                }
              ]
              redirects: []
              do_fork: T
            )
            (command.ControlFlow keyword:<Id.ControlFlow_Return return> arg_word:{<0>})
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
  ]
)