From c9a8bbd7f5308b9d165b0d21ff9b49bcd4fc070e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 6 Aug 2015 22:10:18 -0700 Subject: Suppress debug stepping into auto-loaded library code. * debug.c (debug_set_state, debug_restore_state): New functions. * debug.h (debug_state_t): New type. (debug_set_state, debug_restore_state): Declared, and defined as dummy macros in non-debug-support build. * lisplib.c (opt_dbg_autoload): New global variable. (lisplib_try_load): Disable or enable debugging around library loading based on opt_dbg_autoload option. * lisplib.h (opt_dbg_autoload): Declared. * txr.c (help): List --debug-autoload option. (no_dbg_support): New static function to avoid repeated code. (txr_main): Add debugger option. Change duplicate no debug support error messages into calls to no_dbg_support. * txr.1: Document --debug-autoload --- lisplib.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lisplib.c') diff --git a/lisplib.c b/lisplib.c index 699d076e..8a98a23e 100644 --- a/lisplib.c +++ b/lisplib.c @@ -35,10 +35,12 @@ #include "stream.h" #include "hash.h" #include "gc.h" +#include "debug.h" #include "txr.h" #include "lisplib.h" val dl_table; +int opt_dbg_autoload; void set_dlt_entries(val dlt, val *name, val fun) { @@ -186,5 +188,9 @@ void lisplib_init(void) val lisplib_try_load(val sym) { val fun = gethash(dl_table, sym); - return if3(fun, (funcall(fun), t), nil); + debug_state_t ds; + return if3(fun, (ds = debug_set_state(opt_dbg_autoload ? 0 : -1, + opt_dbg_autoload), + funcall(fun), + debug_restore_state(ds), t), nil); } -- cgit v1.2.3