remake  4.3+dbg-1.5
finish.h
Go to the documentation of this file.
1 /* Terminate execution. */
2 /*
3 Copyright (C) 2004-2005, 2007-2009, 2011, 2015, 2020 R. Bernstein
4 <rocky@gnu.org>
5 This file is part of GNU Make (remake variant).
6 
7 GNU Make is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11 
12 GNU Make is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GNU Make; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21 static debug_return_t
22 dbg_cmd_finish(char *psz_amount)
23 {
25  unsigned int i_amount=0;
26  unsigned int i=0;
27  if ('\0' != *psz_debugger_args) {
28  if (!get_uint(psz_amount, &i_amount, true))
29  return debug_readloop;
30 
31  if (p_stack_top) {
32  /* We have a target stack */
33 
34  for (i=0 ; p ; p = p->p_parent, i++ ) {
35  if (i_amount == i) break;
36  }
37 
38  }
39  }
40  if (p) {
44  define_variable_in_set("MAKEFLAGS", sizeof("MAKEFLAGS")-1,
45  "", o_debugger, 0, NULL, NULL);
46  return continue_execution;
47  } else {
48  if (i > i_amount)
49  printf("Target level %u not found\n", i_amount);
50  else
51  printf("Level %u is too large; maximum value is %u.\n",
52  i_amount, i-1);
53  }
54 
55  return debug_readloop;
56 }
57 
58 static void
59 dbg_cmd_finish_init(unsigned int c)
60 {
61  short_command[c].func = &dbg_cmd_finish;
62  short_command[c].use = _("finish [AMOUNT]");
63 }
64 
65 
66 /*
67  * Local variables:
68  * eval: (c-set-style "gnu")
69  * indent-tabs-mode: nil
70  * End:
71  */
bool get_uint(const char *psz_arg, unsigned int *pi_result, bool b_warn)
Definition: types.h:59
struct variable * define_variable_in_set(const char *name, size_t length, const char *value, enum variable_origin origin, int recursive, struct variable_set *set, const gmk_floc *flocp)
target_stack_node_t * p_stack
file_t * p_shared_target
Definition: trace.h:82
debug_return_t
Definition: trace.h:32
#define _(msgid)
Definition: make.h:293
Definition: trace.h:40
unsigned int i_debugger_nexting
Node for an item in the target call stack.
Definition: trace.h:79
breakpoint_mask_t tracing
Definition: filedef.h:95
Definition: variable.h:34
Definition: trace.h:33
struct target_stack_node * p_parent
Definition: trace.h:83
target_stack_node_t * p_stack_top
unsigned int i_debugger_stepping