(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".'> ) } ) (FuncDef name: _Dbg_do_trace body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_DEqual left: (ArithWord w:{($ VSub_Pound '$#')}) right: (ArithWord w:{(Lit_Digits 0)}) ) spids: [98 105] ) terminator: <Op_Semi ';'> ) ] action: [ (C {(_Dbg_errmsg)} {(DQ ('trace: missing function name.'))}) (ControlFlow token:<ControlFlow_Return return> arg_word:{(2)}) ] spids: [16777215 109] ) ] spids: [16777215 124] ) (Assignment keyword: Assign_Typeset flags: [-r] pairs: [ (assign_pair lhs: (LhsName name:fn spids:[131]) op: Equal rhs: {($ VSub_Number '$1')} spids: [131] ) ] spids: [127] ) (Assignment keyword: Assign_Typeset flags: [-ri] pairs: [ (assign_pair lhs: (LhsName name:clear_debug_trap spids:[139]) op: Equal rhs: { (BracedVarSub token: <VSub_Number 2> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(1)}) spids: [140 144] ) } spids: [139] ) ] spids: [135] ) (AndOr ops: [Op_DPipe] children: [ (C {(_Dbg_is_function)} {(DQ ($ VSub_Name '$fn'))} {($ VSub_Name '$_Dbg_set_debug')}) (BraceGroup children: [ (C {(_Dbg_errmsg)} { (DQ ('trace: function ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$fn') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' is not a function.') ) } ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(3)}) ] spids: [157] ) ] ) (AndOr ops: [Op_DPipe] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd spids:[179]) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(Assign_Typeset typeset)} {(-f)} {(--)} {(DQ ($ VSub_Name '$fn'))}) ] ) left_token: <Left_CommandSub '$('> spids: [180 190] ) } spids: [179] ) ] spids: [179] ) (BraceGroup children: [ (C {(_Dbg_errmsg)} { (DQ ("Can't find function definition for definition ") (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$fn') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (.) ) } ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(4)}) ] spids: [194] ) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_EqualTilde left: {($ VSub_Name '$cmd')} right: {(SQ <'^function '>)} ) ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd spids:[235]) op: Equal rhs: { (DQ ('function old_') (BracedVarSub token: <VSub_Name cmd> suffix_op: (Slice begin:(ArithWord w:{(Lit_Digits 9)})) spids: [238 242] ) ) } spids: [235] ) ] spids: [235] ) ] spids: [16777215 232] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd spids:[249]) op: Equal rhs: {(DQ (old_) (${ VSub_Name cmd))} spids: [249] ) ] spids: [249] ) ] spids: [246 258] ) (AndOr ops: [Op_DAmp] children: [ (DParen child: (ArithVarRef token:<Lit_ArithVarLike _Dbg_set_debug>) spids: [261 264] ) (C {(echo)} {(DQ ($ VSub_Name '$cmd'))}) ] ) (Assignment keyword: Assign_Typeset pairs: [ (assign_pair lhs: (LhsName name:save_clear_debug_trap_cmd spids:[277]) op: Equal rhs: {(SQ )} spids: [277] ) ] spids: [275] ) (Assignment keyword: Assign_Typeset pairs: [ (assign_pair lhs: (LhsName name:restore_trap_cmd spids:[284]) op: Equal rhs: {(SQ )} spids: [284] ) ] spids: [282] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child: (ArithVarRef token:<Lit_ArithVarLike clear_debug_trap>) spids: [291 296] ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:save_clear_trap_cmd spids:[303]) op: Equal rhs: {(SQ <'local old_handler=$(trap -p DEBUG); trap - DEBUG'>)} spids: [303] ) ] spids: [303] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:restore_trap_cmd spids:[309]) op: Equal rhs: {(SQ <'eval $old_handler'>)} spids: [309] ) ] spids: [309] ) ] spids: [16777215 300] ) ] spids: [16777215 315] ) (AndOr ops: [Op_DPipe] children: [ (C {(eval)} {(DQ ($ VSub_Name '$cmd'))}) (BraceGroup children: [ (C {(_Dbg_errmsg)} { (DQ ('Error in renaming function ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$fn') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' to ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (old_) (${ VSub_Name fn) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (.) ) } ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(5)}) ] spids: [326] ) ] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd spids:[355]) op: Equal rhs: { (DQ (${ VSub_Name fn) ('() {\n') (' ') ($ VSub_Name '$save_clear_trap_cmd') ('\n') (' typeset -ri old_set_x=is_traced\n') (' set -x\n') (' old_') ($ VSub_Name '$fn') (' ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) ('@') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('\n') (' typeset -ri rc=') (EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) ('?\n') ( ' (( old_set_x == 0 )) && set +x # still messes up of fn did: set -x\n' ) (' ') ($ VSub_Name '$restore_trap_cmd') ('\n') (' return ') (EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) ('rc\n') (' }\n') ) } spids: [355] ) ] spids: [355] ) (AndOr ops: [Op_DAmp] children: [ (DParen child: (ArithVarRef token:<Lit_ArithVarLike _Dbg_set_debug>) spids: [388 391] ) (C {(echo)} {(DQ ($ VSub_Name '$cmd'))}) ] ) (AndOr ops: [Op_DPipe] children: [ (C {(eval)} {(DQ ($ VSub_Name '$cmd'))}) (ControlFlow token:<ControlFlow_Return return> arg_word:{(6)}) ] ) (C {(_Dbg_msg)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$fn') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' renamed ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (old_) (${ VSub_Name fn) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' and traced by ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (${ VSub_Name fn) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (.) ) } ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(0)}) ] spids: [93] ) spids: [89 92] ) ] )