# -*- shell-script -*- # stepping routines # # Copyright (C) 2010 Rocky Bernstein # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place, Suite 330, Boston, # MA 02111 USA. proc _Dbg_next_skip_common { global _Dbg_inside_skip := $1 global _Dbg_last_next_step_cmd := $_Dbg_cmd global _Dbg_last_next_step_args := $2 _Dbg_not_running && return 3 typeset count=$(2:-1) if [[ $count == [0-9]* ]] { let _Dbg_step_ignore=$(count:-1) } else { _Dbg_errmsg "Argument ($count) should be a number or nothing." global _Dbg_step_ignore := '1' return 1 } # Do we step debug into functions called or not? if (( _Dbg_inside_skip == 0 )) { global _Dbg_old_set_opts := ""$_Dbg_old_set_opts +o functrace"" } else { global _Dbg_old_set_opts := ""$_Dbg_old_set_opts -o functrace"" } _Dbg_write_journal_eval "_Dbg_old_set_opts='$_Dbg_old_set_opts'" _Dbg_write_journal "_Dbg_step_ignore=$_Dbg_step_ignore" # set -x global _Dbg_continue_rc := $_Dbg_inside_skip return 0 } (CommandList children: [ (FuncDef name: _Dbg_next_skip_common body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_inside_skip) op: Equal rhs: {($ VSub_Number "$1")} spids: [66] ) ] spids: [66] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_last_next_step_cmd) op: Equal rhs: {(DQ ($ VSub_Name "$_Dbg_cmd"))} spids: [70] ) ] spids: [70] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_last_next_step_args) op: Equal rhs: {($ VSub_Number "$2")} spids: [76] ) ] spids: [76] ) (AndOr children: [ (C {(_Dbg_not_running)}) (ControlFlow token: arg_word:{(3)}) ] op_id: Op_DAmp ) (C {(typeset)} {(Lit_VarLike "count=") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(1)}) spids: [93 97] ) } ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$count")} right: {(Lit_Other "[") (0-9) (Lit_Other "]") (Lit_Other "*")} ) ) terminator: ) ] action: [ (C {(let)} {(Lit_VarLike "_Dbg_step_ignore=") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(1)}) spids: [125 129] ) } ) ] spids: [-1 119] ) ] else_action: [ (C {(_Dbg_errmsg)} {(DQ ("Argument (") ($ VSub_Name "$count") (") should be a number or nothing."))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_step_ignore) op: Equal rhs: {(1)} spids: [144] ) ] spids: [144] ) (ControlFlow token: arg_word:{(1)}) ] spids: [132 153] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_DEqual left: (ArithVarRef name:_Dbg_inside_skip) right: (ArithWord w:{(Lit_Digits 0)}) ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_old_set_opts) op: Equal rhs: {(DQ ($ VSub_Name "$_Dbg_old_set_opts") (" +o functrace"))} spids: [178] ) ] spids: [178] ) ] spids: [-1 175] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_old_set_opts) op: Equal rhs: {(DQ ($ VSub_Name "$_Dbg_old_set_opts") (" -o functrace"))} spids: [188] ) ] spids: [188] ) ] spids: [185 195] ) (C {(_Dbg_write_journal_eval)} {(DQ ("_Dbg_old_set_opts='") ($ VSub_Name "$_Dbg_old_set_opts") ("'"))} ) (C {(_Dbg_write_journal)} {(DQ ("_Dbg_step_ignore=") ($ VSub_Name "$_Dbg_step_ignore"))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_continue_rc) op: Equal rhs: {($ VSub_Name "$_Dbg_inside_skip")} spids: [220] ) ] spids: [220] ) (ControlFlow token: arg_word:{(0)}) ] spids: [62] ) spids: [58 61] ) ] )