00001 /* Debug hooks for GCC. 00002 Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 00003 00004 This program is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU General Public License as published by the 00006 Free Software Foundation; either version 2, or (at your option) any 00007 later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 00017 00018 #ifndef GCC_DEBUG_H 00019 #define GCC_DEBUG_H 00020 00021 /* This structure contains hooks for the debug information output 00022 functions, accessed through the global instance debug_hooks set in 00023 toplev.c according to command line options. */ 00024 struct gcc_debug_hooks 00025 { 00026 /* Initialize debug output. MAIN_FILENAME is the name of the main 00027 input file. */ 00028 void (* init) (const char *main_filename); 00029 00030 /* Output debug symbols. */ 00031 void (* finish) (const char *main_filename); 00032 00033 /* Macro defined on line LINE with name and expansion TEXT. */ 00034 void (* define) (unsigned int line, const char *text); 00035 00036 /* MACRO undefined on line LINE. */ 00037 void (* undef) (unsigned int line, const char *macro); 00038 00039 /* Record the beginning of a new source file FILE from LINE number 00040 in the previous one. */ 00041 void (* start_source_file) (unsigned int line, const char *file); 00042 00043 /* Record the resumption of a source file. LINE is the line number 00044 in the source file we are returning to. */ 00045 void (* end_source_file) (unsigned int line); 00046 00047 /* Record the beginning of block N, counting from 1 and not 00048 including the function-scope block, at LINE. */ 00049 void (* begin_block) (unsigned int line, unsigned int n); 00050 00051 /* Record the end of a block. Arguments as for begin_block. */ 00052 void (* end_block) (unsigned int line, unsigned int n); 00053 00054 /* Returns nonzero if it is appropriate not to emit any debugging 00055 information for BLOCK, because it doesn't contain any 00056 instructions. This may not be the case for blocks containing 00057 nested functions, since we may actually call such a function even 00058 though the BLOCK information is messed up. Defaults to true. */ 00059 bool (* ignore_block) (tree); 00060 00061 /* Record a source file location at (FILE, LINE). */ 00062 void (* source_line) (unsigned int line, const char *file); 00063 00064 /* Called at start of prologue code. LINE is the first line in the 00065 function. This has been given the same prototype as source_line, 00066 so that the source_line hook can be substituted if appropriate. */ 00067 void (* begin_prologue) (unsigned int line, const char *file); 00068 00069 /* Called at end of prologue code. LINE is the first line in the 00070 function. */ 00071 void (* end_prologue) (unsigned int line, const char *file); 00072 00073 /* Record end of epilogue code. */ 00074 void (* end_epilogue) (unsigned int line, const char *file); 00075 00076 /* Called at start of function DECL, before it is declared. */ 00077 void (* begin_function) (tree decl); 00078 00079 /* Record end of function. LINE is highest line number in function. */ 00080 void (* end_function) (unsigned int line); 00081 00082 /* Debug information for a function DECL. This might include the 00083 function name (a symbol), its parameters, and the block that 00084 makes up the function's body, and the local variables of the 00085 function. */ 00086 void (* function_decl) (tree decl); 00087 00088 /* Debug information for a global DECL. Called from toplev.c after 00089 compilation proper has finished. */ 00090 void (* global_decl) (tree decl); 00091 00092 /* Debug information for a type DECL. Called from toplev.c after 00093 compilation proper, also from various language front ends to 00094 record built-in types. The second argument is properly a 00095 boolean, which indicates whether or not the type is a "local" 00096 type as determined by the language. (It's not a boolean for 00097 legacy reasons.) */ 00098 void (* type_decl) (tree decl, int local); 00099 00100 /* Debug information for imported modules and declarations. */ 00101 void (* imported_module_or_decl) (tree decl, tree context); 00102 00103 /* DECL is an inline function, whose body is present, but which is 00104 not being output at this point. */ 00105 void (* deferred_inline_function) (tree decl); 00106 00107 /* DECL is an inline function which is about to be emitted out of 00108 line. The hook is useful to, e.g., emit abstract debug info for 00109 the inline before it gets mangled by optimization. */ 00110 void (* outlining_inline_function) (tree decl); 00111 00112 /* Called from final_scan_insn for any CODE_LABEL insn whose 00113 LABEL_NAME is non-null. */ 00114 void (* label) (rtx); 00115 00116 /* Called after the start and before the end of writing a PCH file. 00117 The parameter is 0 if after the start, 1 if before the end. */ 00118 void (* handle_pch) (unsigned int); 00119 00120 /* Called from final_scan_insn for any NOTE_INSN_VAR_LOCATION note. */ 00121 void (* var_location) (rtx); 00122 00123 /* Called from final_scan_insn if there is a switch between hot and cold 00124 text sections. */ 00125 void (* switch_text_section) (void); 00126 00127 /* This is 1 if the debug writer wants to see start and end commands for the 00128 main source files, and 0 otherwise. */ 00129 int start_end_main_source_file; 00130 }; 00131 00132 extern const struct gcc_debug_hooks *debug_hooks; 00133 00134 /* The do-nothing hooks. */ 00135 extern void debug_nothing_void (void); 00136 extern void debug_nothing_charstar (const char *); 00137 extern void debug_nothing_int_charstar (unsigned int, const char *); 00138 extern void debug_nothing_int (unsigned int); 00139 extern void debug_nothing_int_int (unsigned int, unsigned int); 00140 extern void debug_nothing_tree (tree); 00141 extern void debug_nothing_tree_int (tree, int); 00142 extern void debug_nothing_tree_tree (tree, tree); 00143 extern bool debug_true_tree (tree); 00144 extern void debug_nothing_rtx (rtx); 00145 00146 /* Hooks for various debug formats. */ 00147 extern const struct gcc_debug_hooks do_nothing_debug_hooks; 00148 extern const struct gcc_debug_hooks dbx_debug_hooks; 00149 extern const struct gcc_debug_hooks sdb_debug_hooks; 00150 extern const struct gcc_debug_hooks xcoff_debug_hooks; 00151 extern const struct gcc_debug_hooks dwarf2_debug_hooks; 00152 extern const struct gcc_debug_hooks vmsdbg_debug_hooks; 00153 00154 /* Dwarf2 frame information. */ 00155 00156 extern void dwarf2out_begin_prologue (unsigned int, const char *); 00157 extern void dwarf2out_end_epilogue (unsigned int, const char *); 00158 extern void dwarf2out_frame_init (void); 00159 extern void dwarf2out_frame_finish (void); 00160 /* Decide whether we want to emit frame unwind information for the current 00161 translation unit. */ 00162 extern int dwarf2out_do_frame (void); 00163 00164 extern void debug_flush_symbol_queue (void); 00165 extern void debug_queue_symbol (tree); 00166 extern void debug_free_queue (void); 00167 extern int debug_nesting; 00168 extern int symbol_queue_index; 00169 00170 #endif /* !GCC_DEBUG_H */
1.5.6