# -*- shell-script -*- # info.sh - info help Routines # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2011 # 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. typeset -r _Dbg_info_cmds='args breakpoints display files functions line program signals source stack variables warranty' proc _Dbg_info_help { if (( $# == 0 )) { typeset -a list _Dbg_section 'List of info subcommands:' for thing in [$_Dbg_info_cmds] { _Dbg_info_help $thing 1 } return 0 } typeset subcmd="$1" typeset label="$2" if [[ -n "${_Dbg_command_help_info[$subcmd]}" ]] { if [[ -z $label ]] { _Dbg_msg_rst $(_Dbg_command_help_info[$subcmd]) return 0 } else { global label := $[builtin printf "info %-12s-- " $subcmd] } } matchstr $subcmd { ar | arg | args { _Dbg_msg \ "info args -- Argument variables (e.g. \$1, \$2, ...) of the current stack frame." return 0 } b | br | bre | brea | 'break' | breakp | breakpo | breakpoints | \ w | wa | wat | watc | 'watch' | watchp | watchpo | watchpoints { _Dbg_msg \ 'info breakpoints -- Status of user-settable breakpoints' return 0 } disp | displ | displa | display { _Dbg_msg \ 'info display -- Show all display expressions' return 0 } fi | file| files | sources { _Dbg_msg \ 'info files -- Source files in the program' return 0 } fu | fun| func | funct | functi | functio | function | functions { _Dbg_msg \ 'info functions -- All function names' return 0 } l | li| lin | line { _Dbg_msg \ 'info line -- list current line number and and file name' return 0 } p | pr | pro | prog | progr | progra | program { _Dbg_msg \ 'info program -- Execution status of the program.' return 0 } h | ha | han | hand | handl | handle | \ si | sig | sign | signa | signal | signals { _Dbg_msg \ 'info signals -- What debugger does when program gets various signals' return 0 } so | sou | sourc | source { _Dbg_msg \ 'info source -- Information about the current source file' return 0 } st | sta | stac | stack { _Dbg_msg \ 'info stack -- Backtrace of the stack' return 0 } tr|tra|trac|trace|tracep | tracepo | tracepoi | tracepoint | tracepoints { _Dbg_msg \ 'info tracepoints -- Status of tracepoints' return 0 } v | va | var | vari | varia | variab | variabl | variable | variables { _Dbg_msg \ 'info variables -- All global and static variable names' return 0 } w | wa | war | warr | warra | warran | warrant | warranty { _Dbg_msg \ 'info warranty -- Various kinds of warranty you do not have' return 0 } * { _Dbg_errmsg \ "Undefined info command: \"$subcmd\". Try \"help info\"." } } } (CommandList children: [ (C {(typeset)} {(-r)} {(Lit_VarLike "_Dbg_info_cmds=") (SQ < "args breakpoints display files functions line program signals source stack variables warranty" > ) } ) (FuncDef name: _Dbg_info_help 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)}) ) ) terminator: ) ] action: [ (C {(typeset)} {(-a)} {(list)}) (C {(_Dbg_section)} {(SQ <"List of info subcommands:">)}) (ForEach iter_name: thing iter_words: [{($ VSub_Name "$_Dbg_info_cmds")}] do_arg_iter: False body: (DoGroup children: [(C {(_Dbg_info_help)} {($ VSub_Name "$thing")} {(1)})] spids: [121 131] ) spids: [116 119] ) (ControlFlow token: arg_word:{(0)}) ] spids: [-1 93] ) ] spids: [-1 139] ) (C {(typeset)} {(Lit_VarLike "subcmd=") (DQ ($ VSub_Number "$1"))}) (C {(typeset)} {(Lit_VarLike "label=") (DQ ($ VSub_Number "$2"))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_n child: { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr: (ArithWord w:{($ VSub_Name "$subcmd")}) ) spids: [167 172] ) ) } ) ) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id:BoolUnary_z child:{($ VSub_Name "$label")}) ) terminator: ) ] action: [ (C {(_Dbg_msg_rst)} { (DQ (BracedVarSub token: bracket_op: (ArrayIndex expr: (ArithWord w:{($ VSub_Name "$subcmd")}) ) spids: [200 205] ) ) } ) (ControlFlow token: arg_word: {(0)} ) ] spids: [-1 194] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:label) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(builtin)} {(printf)} {(DQ ("info %-12s-- "))} {($ VSub_Name "$subcmd")} ) ] ) left_token: spids: [218 228] ) } spids: [217] ) ] spids: [217] ) ] spids: [214 231] ) ] spids: [-1 179] ) ] spids: [-1 234] ) (Case to_match: {($ VSub_Name "$subcmd")} arms: [ (case_arm pat_list: [{(ar)} {(arg)} {(args)}] action: [ (C {(_Dbg_msg)} { (DQ ("info args -- Argument variables (e.g. ") (EscapedLiteralPart token:) ("1, ") (EscapedLiteralPart token:) ("2, ...) of the current stack frame.") ) } ) (ControlFlow token: arg_word:{(0)}) ] spids: [246 256 276 -1] ) (case_arm pat_list: [ {(b)} {(br)} {(bre)} {(brea)} {(SQ )} {(breakp)} {(breakpo)} {(breakpoints)} {(w)} {(wa)} {(wat)} {(watc)} {(SQ )} {(watchp)} {(watchpo)} {(watchpoints)} ] action: [ (C {(_Dbg_msg)} {(SQ <"info breakpoints -- Status of user-settable breakpoints">)}) (ControlFlow token: arg_word:{(0)}) ] spids: [279 347 363 -1] ) (case_arm pat_list: [{(disp)} {(displ)} {(displa)} {(display)}] action: [ (C {(_Dbg_msg)} {(SQ <"info display -- Show all display expressions">)}) (ControlFlow token: arg_word:{(0)}) ] spids: [366 380 396 -1] ) (case_arm pat_list: [{(KW_Fi fi)} {(file)} {(files)} {(sources)}] action: [ (C {(_Dbg_msg)} {(SQ <"info files -- Source files in the program">)}) (ControlFlow token: arg_word:{(0)}) ] spids: [399 412 428 -1] ) (case_arm pat_list: [ {(fu)} {(fun)} {(func)} {(funct)} {(functi)} {(functio)} {(KW_Function function)} {(functions)} ] action: [ (C {(_Dbg_msg)} {(SQ <"info functions -- All function names">)}) (ControlFlow token: arg_word:{(0)}) ] spids: [431 460 476 -1] ) (case_arm pat_list: [{(l)} {(li)} {(lin)} {(line)}] action: [ (C {(_Dbg_msg)} {(SQ <"info line -- list current line number and and file name">)}) (ControlFlow token: arg_word:{(0)}) ] spids: [479 492 508 -1] ) (case_arm pat_list: [{(p)} {(pr)} {(pro)} {(prog)} {(progr)} {(progra)} {(program)}] action: [ (C {(_Dbg_msg)} {(SQ <"info program -- Execution status of the program.">)}) (ControlFlow token: arg_word:{(0)}) ] spids: [511 537 553 -1] ) (case_arm pat_list: [ {(h)} {(ha)} {(han)} {(hand)} {(handl)} {(handle)} {(si)} {(sig)} {(sign)} {(signa)} {(signal)} {(signals)} ] action: [ (C {(_Dbg_msg)} {(SQ <"info signals -- What debugger does when program gets various signals">)} ) (ControlFlow token: arg_word:{(0)}) ] spids: [556 604 620 -1] ) (case_arm pat_list: [{(so)} {(sou)} {(sourc)} {(source)}] action: [ (C {(_Dbg_msg)} {(SQ <"info source -- Information about the current source file">)}) (ControlFlow token: arg_word:{(0)}) ] spids: [623 637 653 -1] ) (case_arm pat_list: [{(st)} {(sta)} {(stac)} {(stack)}] action: [ (C {(_Dbg_msg)} {(SQ <"info stack -- Backtrace of the stack">)}) (ControlFlow token: arg_word:{(0)}) ] spids: [656 670 686 -1] ) (case_arm pat_list: [ {(tr)} {(tra)} {(trac)} {(trace)} {(tracep)} {(tracepo)} {(tracepoi)} {(tracepoint)} {(tracepoints)} ] action: [ (C {(_Dbg_msg)} {(SQ <"info tracepoints -- Status of tracepoints">)}) (ControlFlow token: arg_word:{(0)}) ] spids: [689 715 731 -1] ) (case_arm pat_list: [ {(v)} {(va)} {(var)} {(vari)} {(varia)} {(variab)} {(variabl)} {(variable)} {(variables)} ] action: [ (C {(_Dbg_msg)} {(SQ <"info variables -- All global and static variable names">)}) (ControlFlow token: arg_word:{(0)}) ] spids: [734 768 784 -1] ) (case_arm pat_list: [{(w)} {(wa)} {(war)} {(warr)} {(warra)} {(warran)} {(warrant)} {(warranty)}] action: [ (C {(_Dbg_msg)} {(SQ <"info warranty -- Various kinds of warranty you do not have">)} ) (ControlFlow token: arg_word:{(0)}) ] spids: [787 817 833 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (C {(_Dbg_errmsg)} { (DQ ("Undefined info command: ") (EscapedLiteralPart token: ) ($ VSub_Name "$subcmd") (EscapedLiteralPart token:) (". Try ") (EscapedLiteralPart token: ) ("help info") (EscapedLiteralPart token:) (.) ) } ) ] spids: [836 838 -1 858] ) ] spids: [239 243 858] ) ] spids: [73] ) spids: [69 72] ) ] )