From b7bdc308cd6ce4dd4d3dd68c16eec792652f8c39 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 21 Jan 2012 00:59:38 -0800 Subject: Improved debugging. Debug nesting depth counter maintained and used for next/step/finish stepping. * Makefile (OBJS): debug.o moved to OBJS-y or OBJS-. (OBJS-y, OBJS-): New variables. $(PROG): Depends on OBJS-y also. clean: clean $(OBJS-y). depend: include $(OBJS-y) in dependency generation. * configure: Underscores and dashes are interchangeable in configure variables. (yaccname_given, yacc_given): Default value is y, not yes. (debug_support): New config variable. (CONFIG_DEBUG_SUPPORT): New config.h symbol. * debug.c (debug_depth): New global variable. (debug_block_s): New symbol variable. (next_depth): New static variable. (debug): Renamed some commands. Introduced separate next, step and finish. (debug_init): debug_block_s initialized. * debug.h (debug_depth, debug_block_s): Declared. (debug_enter, debug_leave, debug_return): New macros. (debug_check, debug_init): Conditionally defined based on if this is a debug build. * dep.mk: Regenerated. * eval.c (eval): Instrumented with debug_enter, debug_leave, debug_return. * match.c (match_line, v_fun, match_files): Likewise. * txr.c (txr_main): Bail if -d or --debug used in build that lacks debug support. --- txr.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'txr.c') diff --git a/txr.c b/txr.c index 55bf811f..5e18871e 100644 --- a/txr.c +++ b/txr.c @@ -304,7 +304,14 @@ int txr_main(int argc, char **argv) argv++, argc--; continue; } else if (!strcmp(*argv, "--debugger")) { +#if CONFIG_DEBUG_SUPPORT opt_debugger = 1; +#else + format(std_error, + lit("~a: option ~a requires debug support compiled in\n"), + prog_string, string_utf8(*argv), nao); + return EXIT_FAILURE; +#endif argv++, argc--; continue; } @@ -327,13 +334,20 @@ int txr_main(int argc, char **argv) opt_lisp_bindings = 1; break; case 'd': +#if CONFIG_DEBUG_SUPPORT opt_debugger = 1; +#else + format(std_error, + lit("~a: option ~a requires debug support compiled in\n"), + prog_string, chr(*popt), nao); + return EXIT_FAILURE; +#endif break; case 'a': case 'c': case 'D': format(std_error, lit("~a: option -~a does not clump\n"), - prog_string, chr(*popt), nao); + prog_string, chr(*popt), nao); return EXIT_FAILURE; case '-': format(std_error, lit("~a: unrecognized long option: --~a\n"), -- cgit v1.2.3