# -*- shell-script -*- # gdb-like "info display" debugger command # # Copyright (C) 2010-2011, 2016 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. _Dbg_help_add_sub info display \ "**info display**" 1 # List display command(s) proc _Dbg_do_info_display { if test $(#_Dbg_disp_exp[@]) != 0 { typeset i=0 _Dbg_msg "Auto-display statements now in effect:" _Dbg_msg "Num Enb Expression " for (( i=0; i < _Dbg_disp_max; i++ )) ; do if [ -n "${_Dbg_disp_exp[$i]}" ] ;then _Dbg_printf '%-3d %3d %s' \ $i ${_Dbg_disp_enable[$i]} "${_Dbg_disp_exp[$i]}" fi done } else { _Dbg_msg "No display expressions have been set." } return 0 } (CommandList children: [ (C {(_Dbg_help_add_sub)} {(info)} {(display)} {(DQ ("**info display**"))} {(1)}) (FuncDef name: _Dbg_do_info_display body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (BracedVarSub token: prefix_op: VSub_Pound bracket_op: (WholeArray op_id:Lit_At) spids: [86 92] ) } {(KW_Bang "!") (Lit_Other "=")} {(0)} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(typeset)} {(Lit_VarLike "i=") (0)}) (C {(_Dbg_msg)} {(DQ ("Auto-display statements now in effect:"))}) (C {(_Dbg_msg)} {(DQ ("Num Enb Expression "))}) (ForExpr init: (BinaryAssign op_id: Arith_Equal left: (LhsName name:i) right: (ArithWord w:{(Lit_Digits 0)}) ) cond: (ArithBinary op_id: Arith_Less left: (ArithVarRef name:i) right: (ArithVarRef name:_Dbg_disp_max) ) update: (UnaryAssign op_id:Node_PostDPlus child:(LhsName name:i)) body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr: (ArithWord w:{($ VSub_Name "$i")}) ) spids: [159 164] ) ) } {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(_Dbg_printf)} {(SQ <"%-3d %3d %s">)} {($ VSub_Name "$i")} { (BracedVarSub token: bracket_op: (ArrayIndex expr: (ArithWord w:{($ VSub_Name "$i")}) ) spids: [183 188] ) } { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr: (ArithWord w:{($ VSub_Name "$i")}) ) spids: [191 196] ) ) } ) ] spids: [-1 170] ) ] spids: [-1 200] ) ] spids: [149 203] ) ) ] spids: [-1 102] ) ] else_action: [(C {(_Dbg_msg)} {(DQ ("No display expressions have been set."))})] spids: [206 216] ) (ControlFlow token: arg_word:{(0)}) ] spids: [79] ) spids: [75 78] ) ] )