(command.CommandList children: [ (C {<_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".'> ) } ) (command.ShFunction name: _Dbg_do_trace body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DEqual left: {($ Id.VSub_Pound '$#')} right: {<Id.Lit_Digits 0>} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<_Dbg_errmsg>} {(DQ <'trace: missing function name.'>)}) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<2>} ) ] spids: [96 109] ) ] ) (C {<typeset>} {<-r>} {<Id.Lit_VarLike 'fn='> ($ Id.VSub_Number '$1')}) (C {<typeset>} {<-ri>} {<Id.Lit_VarLike 'clear_debug_trap='> (braced_var_sub token: <Id.VSub_Number 2> suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:{<1>}) ) } ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<_Dbg_is_function>} {(DQ ($ Id.VSub_DollarName '$fn'))} {($ Id.VSub_DollarName '$_Dbg_set_debug')} ) (BraceGroup children: [ (C {<_Dbg_errmsg>} { (DQ <'trace: function '> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\"'> ) ($ Id.VSub_DollarName '$fn') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' is not a function.'> ) } ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<3>} ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:cmd) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<typeset>} {<-f>} {<-->} {(DQ ($ Id.VSub_DollarName '$fn'))}) ) } spids: [179] ) ] ) (BraceGroup children: [ (C {<_Dbg_errmsg>} { (DQ <'Can\'t find function definition for definition '> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\"'> ) ($ Id.VSub_DollarName '$fn') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <.> ) } ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<4>} ) ] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: {($ Id.VSub_DollarName '$cmd')} right: {(SQ <'^function '>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:cmd) op: assign_op.Equal rhs: { (DQ <'function old_'> (braced_var_sub token: <Id.VSub_Name cmd> suffix_op: (suffix_op.Slice begin:{<Id.Lit_Digits 9>}) ) ) } spids: [235] ) ] ) ] spids: [216 232] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:cmd) op: assign_op.Equal rhs: {(DQ <old_> (${ Id.VSub_Name cmd))} spids: [249] ) ] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child:<Id.Lit_ArithVarLike _Dbg_set_debug>) (C {<echo>} {(DQ ($ Id.VSub_DollarName '$cmd'))}) ] ) (C {<typeset>} {<Id.Lit_VarLike 'save_clear_debug_trap_cmd='> (SQ )}) (C {<typeset>} {<Id.Lit_VarLike 'restore_trap_cmd='> (SQ )}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child:<Id.Lit_ArithVarLike clear_debug_trap>) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:save_clear_trap_cmd) op: assign_op.Equal rhs: {(SQ <'local old_handler=$(trap -p DEBUG); trap - DEBUG'>)} spids: [303] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:restore_trap_cmd) op: assign_op.Equal rhs: {(SQ <'eval $old_handler'>)} spids: [309] ) ] ) ] spids: [289 300] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<eval>} {(DQ ($ Id.VSub_DollarName '$cmd'))}) (BraceGroup children: [ (C {<_Dbg_errmsg>} { (DQ <'Error in renaming function '> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\"'> ) ($ Id.VSub_DollarName '$fn') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' to '> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\"'> ) <old_> (${ Id.VSub_Name fn) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <.> ) } ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<5>} ) ] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name 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 '\\"'>) (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\$'> ) <'@'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <'\n'> <' typeset -ri rc='> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\$'> ) <'?\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 '\\$'>) <'rc\n'> <' }\n'> ) } spids: [355] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child:<Id.Lit_ArithVarLike _Dbg_set_debug>) (C {<echo>} {(DQ ($ Id.VSub_DollarName '$cmd'))}) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<eval>} {(DQ ($ Id.VSub_DollarName '$cmd'))}) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<6>} ) ] ) (C {<_Dbg_msg>} { (DQ (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ($ Id.VSub_DollarName '$fn') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' renamed '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <old_> (${ Id.VSub_Name fn) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' and traced by '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) (${ Id.VSub_Name fn) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <.> ) } ) (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<0>}) ] ) ) ] )