summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--debug.c21
2 files changed, 20 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e65b7c9..34cdd1ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2012-02-28 Kaz Kylheku <kaz@kylheku.com>
+ * debug.c (help, debug): New g command for tweaking log level.
+
+2012-02-28 Kaz Kylheku <kaz@kylheku.com>
+
* debug.c: Missing d command implemented.
Condense the output to 8 times the screen width, for more context.
Condense the output in vertical mode (when the entire input line
diff --git a/debug.c b/debug.c
index 808e60af..05e56d7e 100644
--- a/debug.c
+++ b/debug.c
@@ -41,6 +41,7 @@
#include "unwind.h"
#include "stream.h"
#include "parser.h"
+#include "txr.h"
int opt_debugger;
int debug_depth;
@@ -60,7 +61,7 @@ static void help(val stream)
"v - show variable binding environment s - show current form\n"
"b - set breakpoint by line number i - show current data\n"
"d - delete breakpoint w - backtrace\n"
- "l - list breakpoints\n"),
+ "l - list breakpoints g - set loglevel\n"),
stream);
}
@@ -170,16 +171,26 @@ val debug(val form, val bindings, val data, val line, val pos, val base)
print_form = t;
} else if (equal(command, lit("i"))) {
print_data = t;
- } else if (equal(command, lit("b")) || equal(command, lit("d"))) {
+ } else if (equal(command, lit("b")) || equal(command, lit("d")) ||
+ equal(command, lit("g")))
+ {
if (!rest(input)) {
format(std_debug, lit("~s needs argument\n"), command, nao);
continue;
} else {
- long n = wcstol(c_str(second(input)), NULL, 10);
+ val n = int_str(second(input), num(10));
+
+ if (!n) {
+ format(std_debug, lit("~s needs numeric argument\n"), command, nao);
+ continue;
+ }
+
if (equal(command, lit("b")))
- push(num(n), &breakpoints);
+ push(n, &breakpoints);
+ else if (equal(command, lit("d")))
+ breakpoints = remql(n, breakpoints);
else
- breakpoints = remql(num(n), breakpoints);
+ opt_loglevel = c_num(n);
}
} else if (equal(command, lit("l"))) {
format(std_debug, lit("breakpoints: ~s\n"), breakpoints, nao);