1 /*
2 Copyright (C) 2011, 2015, 2020 R. Bernstein <rocky@gnu.org>
3 This file is part of GNU Make (remake variant).
4
5 GNU Make is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 GNU Make is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNU Make; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
19 /* Continue running program. */
20 static debug_return_t
dbg_cmd_continue(char * psz_args)21 dbg_cmd_continue (char *psz_args)
22 {
23 if (psz_args && *psz_args) {
24 char *psz_target = get_word(&psz_args);
25 file_t *p_target = NULL;
26 brkpt_mask_t i_brkpt_mask;
27
28 /** FIXME: DRY with code in break.h **/
29 if (p_stack && p_stack->p_target) {
30 char *psz_expanded_target =
31 variable_expand_set(psz_target, p_stack->p_target->variables);
32 if (*psz_expanded_target) {
33 p_target = lookup_file(psz_expanded_target);
34 }
35 } else
36 p_target = lookup_file(psz_target);
37
38 if (!p_target) {
39 printf("Can't find target %s; breakpoint not set.\n", psz_target);
40 return debug_cmd_error;
41 }
42
43 /* FIXME: Combine with code in continue. */
44 psz_args = get_word(&psz_args);
45 if (!(psz_args && *psz_args))
46 i_brkpt_mask = BRK_ALL;
47 else {
48 char *psz_break_type;
49 i_brkpt_mask = get_brkpt_option(psz_args);
50 while ((psz_break_type = get_word(&psz_args))) {
51 if (!(psz_break_type && *psz_break_type)) break;
52 i_brkpt_mask |= get_brkpt_option(psz_break_type) ;
53 }
54 }
55
56 if (!add_breakpoint(p_target, i_brkpt_mask|BRK_TEMP))
57 return debug_cmd_error;
58 } else {
59 db_level = 0;
60 }
61
62 i_debugger_stepping = 0;
63 i_debugger_nexting = 0;
64 define_variable_in_set("MAKEFLAGS", sizeof("MAKEFLAGS")-1,
65 "", o_debugger, 0, NULL, NULL);
66 return continue_execution;
67 };
68
69 static void
dbg_cmd_continue_init(unsigned int c)70 dbg_cmd_continue_init(unsigned int c)
71 {
72 short_command[c].func = &dbg_cmd_continue;
73 short_command[c].use = _("continue [TARGET [all|run|prereq|end]*]");
74 }
75
76 /*
77 * Local variables:
78 * eval: (c-set-style "gnu")
79 * indent-tabs-mode: nil
80 * End:
81 */
82