summaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-28 21:54:42 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-28 21:54:42 -0800
commit8c64c2e9bcfa3d5ffd0094265dd13fc39d7003df (patch)
tree4eb896c79c2769f7689133ea2c6507bc9de73e5f /debug.c
parentc71cdf1461646ecaf56969d18bcc629039d7148d (diff)
downloadtxr-8c64c2e9bcfa3d5ffd0094265dd13fc39d7003df.tar.gz
txr-8c64c2e9bcfa3d5ffd0094265dd13fc39d7003df.tar.bz2
txr-8c64c2e9bcfa3d5ffd0094265dd13fc39d7003df.zip
* debug.c (help, debug): New g command for tweaking log level.
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c21
1 files changed, 16 insertions, 5 deletions
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);