disabling debugger in production
Vibhu Mohindra
vibhu.mohindra at gmail.com
Thu Jun 30 19:49:24 UTC 2016
I'm bundling up a program for distribution to customers. I don't want it
to ever enter the debugger. I want it to raise Java exceptions instead.
What I've written to achieve this follows. I've observed it working.
However, there are still times when my program enters the debugger. I
can't tell why, and want to prevent it entirely. Does anybody know? Does
anyone on this list distribute ABCL applications to end users, and how
do you disable the debugger?
/* disable the debugger. raise a RuntimeException instead */
static void installDebuggerHook() {
Symbol.DEBUGGER_HOOK
.setSymbolValue(new Function() {
public LispObject execute(LispObject c, LispObject h) {
throw translateCondition(c);}});
}
static RuntimeException translateCondition(LispObject c) {
return new RuntimeException(
c instanceof Condition
? String.format("%s: %s",
c.princToString(),
((Condition) c).getConditionReport())
: c.princToString());
}
My program is really a Lisp library that people will use via a thin Java
layer. I have a hunch that the above takes care of errors that occur in:
interpreter.eval("...")
but not errors that occur in:
someSymbol.execute(...)
Thanks in advance,
Vibhu
More information about the armedbear-devel
mailing list