# -*- shell-script -*- # gdb-like "return" (return from fn immediately) debugger command # # Copyright (C) 2010, 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. # Move default values up $1 or one in the stack. _Dbg_help_add return \ '**return** Force an immediate return from a function. The remainder of function will not be executed. See also: --------- **finish**, **quit**, and **run**.' proc _Dbg_do_return { global _Dbg_step_ignore := '1' _Dbg_write_journal "_Dbg_step_ignore=$_Dbg_step_ignore" global IFS := $_Dbg_old_IFS; global _Dbg_last_cmd := ''return'' global _Dbg_inside_skip := '0' global _Dbg_continue_rc := '2' return 0 } (CommandList children: [ (C {(_Dbg_help_add)} {(ControlFlow_Return return)} { (SQ <"**return**\n"> <"\n"> <"Force an immediate return from a function.\n"> <"\n"> <"The remainder of function will not be executed.\n"> <"\n"> <"See also:\n"> <"---------\n"> <"\n"> <"**finish**, **quit**, and **run**."> ) } ) (FuncDef name: _Dbg_do_return body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:_Dbg_step_ignore) op:Equal rhs:{(1)} spids:[90])] spids: [90] ) (C {(_Dbg_write_journal)} {(DQ ("_Dbg_step_ignore=") ($ VSub_Name "$_Dbg_step_ignore"))}) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:IFS) op: Equal rhs: {(DQ ($ VSub_Name "$_Dbg_old_IFS"))} spids: [102] ) ] spids: [102] ) terminator: ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_last_cmd) op: Equal rhs: {(SQ )} spids: [109] ) ] spids: [109] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_inside_skip) op: Equal rhs: {(0)} spids: [115] ) ] spids: [115] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_continue_rc) op: Equal rhs: {(2)} spids: [119] ) ] spids: [119] ) (ControlFlow token: arg_word:{(0)}) ] spids: [87] ) spids: [83 86] ) ] )