1 /* 2 * Copyright 2015 Steven Watanabe 3 * Distributed under the Boost Software License, Version 1.0. 4 * (See accompanying file LICENSE_1_0.txt or copy at 5 * http://www.boost.org/LICENSE_1_0.txt) 6 */ 7 8 #ifndef DEBUGGER_SW20150314_H 9 #define DEBUGGER_SW20150314_H 10 11 #include "config.h" 12 #include <setjmp.h> 13 #include "object.h" 14 #include "frames.h" 15 16 #ifdef JAM_DEBUGGER 17 18 void debug_on_instruction( FRAME * frame, OBJECT * file, int line ); 19 void debug_on_enter_function( FRAME * frame, OBJECT * name, OBJECT * file, int line ); 20 void debug_on_exit_function( OBJECT * name ); 21 int debugger( void ); 22 23 struct debug_child_data_t 24 { 25 int argc; 26 const char * * argv; 27 jmp_buf jmp; 28 }; 29 30 extern struct debug_child_data_t debug_child_data; 31 extern LIST * debug_print_result; 32 extern const char debugger_opt[]; 33 extern int debug_interface; 34 35 #define DEBUG_INTERFACE_CONSOLE 1 36 #define DEBUG_INTERFACE_MI 2 37 #define DEBUG_INTERFACE_CHILD 3 38 39 #define debug_is_debugging() ( debug_interface != 0 ) 40 #define debug_on_enter_function( frame, name, file, line ) \ 41 ( debug_is_debugging()? \ 42 debug_on_enter_function( frame, name, file, line ) : \ 43 (void)0 ) 44 #define debug_on_exit_function( name ) \ 45 ( debug_is_debugging()? \ 46 debug_on_exit_function( name ) : \ 47 (void)0 ) 48 49 #if NT 50 51 void debug_init_handles( const char * in, const char * out ); 52 53 #endif 54 55 #else 56 57 #define debug_on_instruction( frame, file, line ) ( ( void )0 ) 58 #define debug_on_enter_function( frame, name, file, line ) ( ( void )0 ) 59 #define debug_on_exit_function( name ) ( ( void )0 ) 60 #define debug_is_debugging() ( 0 ) 61 62 #endif 63 64 #endif 65