190075Sobrien/* Debug hooks for GCC. 2169689Skan Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 390075Sobrien 490075SobrienThis program is free software; you can redistribute it and/or modify it 590075Sobrienunder the terms of the GNU General Public License as published by the 690075SobrienFree Software Foundation; either version 2, or (at your option) any 790075Sobrienlater version. 890075Sobrien 990075SobrienThis program is distributed in the hope that it will be useful, 1090075Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1190075SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1290075SobrienGNU General Public License for more details. 1390075Sobrien 1490075SobrienYou should have received a copy of the GNU General Public License 1590075Sobrienalong with this program; if not, write to the Free Software 16169689SkanFoundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 1790075Sobrien 1890075Sobrien#ifndef GCC_DEBUG_H 1990075Sobrien#define GCC_DEBUG_H 2090075Sobrien 2190075Sobrien/* This structure contains hooks for the debug information output 2290075Sobrien functions, accessed through the global instance debug_hooks set in 2390075Sobrien toplev.c according to command line options. */ 2490075Sobrienstruct gcc_debug_hooks 2590075Sobrien{ 26117395Skan /* Initialize debug output. MAIN_FILENAME is the name of the main 2790075Sobrien input file. */ 28132718Skan void (* init) (const char *main_filename); 2990075Sobrien 3090075Sobrien /* Output debug symbols. */ 31132718Skan void (* finish) (const char *main_filename); 3290075Sobrien 3390075Sobrien /* Macro defined on line LINE with name and expansion TEXT. */ 34132718Skan void (* define) (unsigned int line, const char *text); 3590075Sobrien 3690075Sobrien /* MACRO undefined on line LINE. */ 37132718Skan void (* undef) (unsigned int line, const char *macro); 3890075Sobrien 3990075Sobrien /* Record the beginning of a new source file FILE from LINE number 4090075Sobrien in the previous one. */ 41132718Skan void (* start_source_file) (unsigned int line, const char *file); 4290075Sobrien 4390075Sobrien /* Record the resumption of a source file. LINE is the line number 4490075Sobrien in the source file we are returning to. */ 45132718Skan void (* end_source_file) (unsigned int line); 4690075Sobrien 4790075Sobrien /* Record the beginning of block N, counting from 1 and not 4890075Sobrien including the function-scope block, at LINE. */ 49132718Skan void (* begin_block) (unsigned int line, unsigned int n); 5090075Sobrien 5190075Sobrien /* Record the end of a block. Arguments as for begin_block. */ 52132718Skan void (* end_block) (unsigned int line, unsigned int n); 5390075Sobrien 5490075Sobrien /* Returns nonzero if it is appropriate not to emit any debugging 5590075Sobrien information for BLOCK, because it doesn't contain any 5690075Sobrien instructions. This may not be the case for blocks containing 5790075Sobrien nested functions, since we may actually call such a function even 5890075Sobrien though the BLOCK information is messed up. Defaults to true. */ 59132718Skan bool (* ignore_block) (tree); 6090075Sobrien 6190075Sobrien /* Record a source file location at (FILE, LINE). */ 62132718Skan void (* source_line) (unsigned int line, const char *file); 6390075Sobrien 6490075Sobrien /* Called at start of prologue code. LINE is the first line in the 6590075Sobrien function. This has been given the same prototype as source_line, 6690075Sobrien so that the source_line hook can be substituted if appropriate. */ 67132718Skan void (* begin_prologue) (unsigned int line, const char *file); 6890075Sobrien 6990075Sobrien /* Called at end of prologue code. LINE is the first line in the 7090075Sobrien function. */ 71132718Skan void (* end_prologue) (unsigned int line, const char *file); 7290075Sobrien 7390075Sobrien /* Record end of epilogue code. */ 74132718Skan void (* end_epilogue) (unsigned int line, const char *file); 7590075Sobrien 7690075Sobrien /* Called at start of function DECL, before it is declared. */ 77132718Skan void (* begin_function) (tree decl); 7890075Sobrien 7990075Sobrien /* Record end of function. LINE is highest line number in function. */ 80132718Skan void (* end_function) (unsigned int line); 8190075Sobrien 8290075Sobrien /* Debug information for a function DECL. This might include the 8390075Sobrien function name (a symbol), its parameters, and the block that 8490075Sobrien makes up the function's body, and the local variables of the 8590075Sobrien function. */ 86132718Skan void (* function_decl) (tree decl); 8790075Sobrien 8890075Sobrien /* Debug information for a global DECL. Called from toplev.c after 8990075Sobrien compilation proper has finished. */ 90132718Skan void (* global_decl) (tree decl); 9190075Sobrien 92169689Skan /* Debug information for a type DECL. Called from toplev.c after 93169689Skan compilation proper, also from various language front ends to 94169689Skan record built-in types. The second argument is properly a 95169689Skan boolean, which indicates whether or not the type is a "local" 96169689Skan type as determined by the language. (It's not a boolean for 97169689Skan legacy reasons.) */ 98169689Skan void (* type_decl) (tree decl, int local); 99169689Skan 100169689Skan /* Debug information for imported modules and declarations. */ 101169689Skan void (* imported_module_or_decl) (tree decl, tree context); 102169689Skan 10390075Sobrien /* DECL is an inline function, whose body is present, but which is 10490075Sobrien not being output at this point. */ 105132718Skan void (* deferred_inline_function) (tree decl); 10690075Sobrien 10790075Sobrien /* DECL is an inline function which is about to be emitted out of 10890075Sobrien line. The hook is useful to, e.g., emit abstract debug info for 10990075Sobrien the inline before it gets mangled by optimization. */ 110132718Skan void (* outlining_inline_function) (tree decl); 11190075Sobrien 11290075Sobrien /* Called from final_scan_insn for any CODE_LABEL insn whose 11390075Sobrien LABEL_NAME is non-null. */ 114132718Skan void (* label) (rtx); 115132718Skan 116132718Skan /* Called after the start and before the end of writing a PCH file. 117132718Skan The parameter is 0 if after the start, 1 if before the end. */ 118132718Skan void (* handle_pch) (unsigned int); 119169689Skan 120169689Skan /* Called from final_scan_insn for any NOTE_INSN_VAR_LOCATION note. */ 121169689Skan void (* var_location) (rtx); 122169689Skan 123169689Skan /* Called from final_scan_insn if there is a switch between hot and cold 124169689Skan text sections. */ 125169689Skan void (* switch_text_section) (void); 126169689Skan 127169689Skan /* This is 1 if the debug writer wants to see start and end commands for the 128169689Skan main source files, and 0 otherwise. */ 129169689Skan int start_end_main_source_file; 13090075Sobrien}; 13190075Sobrien 132117395Skanextern const struct gcc_debug_hooks *debug_hooks; 13390075Sobrien 13490075Sobrien/* The do-nothing hooks. */ 135132718Skanextern void debug_nothing_void (void); 136132718Skanextern void debug_nothing_charstar (const char *); 137132718Skanextern void debug_nothing_int_charstar (unsigned int, const char *); 138132718Skanextern void debug_nothing_int (unsigned int); 139132718Skanextern void debug_nothing_int_int (unsigned int, unsigned int); 140132718Skanextern void debug_nothing_tree (tree); 141169689Skanextern void debug_nothing_tree_int (tree, int); 142169689Skanextern void debug_nothing_tree_tree (tree, tree); 143132718Skanextern bool debug_true_tree (tree); 144132718Skanextern void debug_nothing_rtx (rtx); 14590075Sobrien 14690075Sobrien/* Hooks for various debug formats. */ 147117395Skanextern const struct gcc_debug_hooks do_nothing_debug_hooks; 148117395Skanextern const struct gcc_debug_hooks dbx_debug_hooks; 149117395Skanextern const struct gcc_debug_hooks sdb_debug_hooks; 150117395Skanextern const struct gcc_debug_hooks xcoff_debug_hooks; 151117395Skanextern const struct gcc_debug_hooks dwarf2_debug_hooks; 152117395Skanextern const struct gcc_debug_hooks vmsdbg_debug_hooks; 15390075Sobrien 15490075Sobrien/* Dwarf2 frame information. */ 15590075Sobrien 156132718Skanextern void dwarf2out_begin_prologue (unsigned int, const char *); 157132718Skanextern void dwarf2out_end_epilogue (unsigned int, const char *); 158132718Skanextern void dwarf2out_frame_init (void); 159132718Skanextern void dwarf2out_frame_finish (void); 16090075Sobrien/* Decide whether we want to emit frame unwind information for the current 16190075Sobrien translation unit. */ 162132718Skanextern int dwarf2out_do_frame (void); 16390075Sobrien 164132718Skanextern void debug_flush_symbol_queue (void); 165132718Skanextern void debug_queue_symbol (tree); 166132718Skanextern void debug_free_queue (void); 167132718Skanextern int debug_nesting; 168132718Skanextern int symbol_queue_index; 169132718Skan 17090075Sobrien#endif /* !GCC_DEBUG_H */ 171