1 /* 2 Copyright (C) 2004-2005, 2007-2008, 2020 Rocky Bernstein <rocky@gnu.org> 3 4 This file is part of GNU Make (remake variant). 5 6 GNU Make is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 GNU Make is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GNU Make; see the file COPYING. If not, write to 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 Boston, MA 02111-1307, USA. */ 20 21 /** \file trace.h 22 * 23 * \brief Header for routines related to tracing and debugging support. 24 */ 25 26 #ifndef REMAKE_TRACE_H 27 #define REMAKE_TRACE_H 28 29 #include "types.h" 30 #include "filedef.h" 31 32 typedef enum { 33 continue_execution, /**< Get out of debug read loop and continue execution 34 as normal. */ 35 next_execution, /**< Get out of debug read loop and continue execution 36 as but don't enter debugger for the any remaining 37 commands. */ 38 skip_execution, /**< Get out of debug read loop, but skip execution 39 of next command or action. */ 40 debug_readloop, /**< Stay in debugger read loop - used only 41 inside debugger read loop. */ 42 debug_cmd_error /**< Command error but stay in debugger read loop - 43 used only inside debugger read loop. */ 44 } debug_return_t; 45 46 typedef enum 47 { 48 DEBUG_BRKPT_BEFORE_PREREQ = 0, 49 DEBUG_BRKPT_AFTER_PREREQ = 1, 50 DEBUG_BRKPT_AFTER_CMD = 2, 51 DEBUG_GOAL_UPDATED_HIT = 3, 52 DEBUG_READ_HIT = 4, 53 DEBUG_ERROR_HIT = 5, 54 DEBUG_STEP_HIT = 6, 55 DEBUG_STEP_COMMAND = 7, 56 DEBUG_EXPLICIT_CALL = 8, 57 DEBUG_STACK_CHANGING = 99, 58 DEBUG_NOT_GIVEN = 100 59 } debug_enter_reason_t; 60 61 typedef enum { 62 INFO_TARGET_POSITION = 1, 63 INFO_TARGET_NAME = 2, 64 INFO_TARGET_POSITION_AND_NAME = 3, /* 1 & 2 */ 65 INFO_TARGET_TASKS = 4, 66 INFO_TARGET_TASK_COMMENT = 8, 67 INFO_TARGET_TASKS_WITH_COMMENTS = 12, /* 4 & 8 */ 68 } info_target_output_mask_t; 69 70 /*! 71 debugger command interface. 72 */ 73 74 /*! A call "stack". Well, since we'll have to deal with multiple child 75 "jobs" it's not really a stack but a tree. 76 */ 77 78 /*! \brief Node for an item in the target call stack */ 79 typedef struct target_stack_node 80 { 81 file_t *p_target; 82 file_t *p_shared_target; 83 struct target_stack_node *p_parent; 84 } target_stack_node_t; 85 86 /** Pointer to top of current target call stack */ 87 extern target_stack_node_t *p_stack_top; 88 89 /*! Push "p_target" to the call stack. Return the new stack top. 90 if b_debugger is true we might enter the debugger. 91 */ 92 extern target_stack_node_t *trace_push_target (target_stack_node_t *p, 93 file_t *p_target); 94 95 /*! Pop the next target from the call stack.. */ 96 extern void trace_pop_target (target_stack_node_t *p); 97 98 /*! \brief Node for an item in the "include Makefile" stack */ 99 typedef struct floc_stack_node 100 { 101 gmk_floc *p_floc; 102 struct floc_stack_node *p_parent; 103 } floc_stack_node_t; 104 105 /** Pointer to top of current target floc stack */ 106 extern floc_stack_node_t *p_stack_floc_top; 107 108 /*! Push "p_floc" to the floc stack. Return the new stack top. 109 */ 110 extern void trace_push_floc (gmk_floc *p_floc); 111 112 /*! Pop the next floc from the call stack.. */ 113 extern void trace_pop_floc (void); 114 115 /*! Show just a list of targets */ 116 extern void dbg_cmd_info_targets(info_target_output_mask_t output_mask); 117 118 /*! Show just a list of tasks */ 119 extern void dbg_cmd_info_tasks(); 120 121 #endif /*REMAKE_TRACE_H*/ 122