This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Debugging in Kawa
- From: Per Bothner <per at bothner dot com>
- To: Sven Hartrumpf <Sven dot Hartrumpf at FernUni-Hagen dot de>
- Cc: kawa at sources dot redhat dot com
- Date: Fri, 06 Jun 2003 10:54:56 -0700
- Subject: Re: Debugging in Kawa
- References: <20030606.115010.74726663.Sven.Hartrumpf@FernUni-Hagen.de>
Sven Hartrumpf wrote:
How can I get more information about where the error
occurred when I run a program from Kawa's REPL?
...
Invalid parameter, was: null
java.lang.ClassCastException
at atInteractiveLevel.lambda7(Unknown Source)
at atInteractiveLevel.apply1(Unknown Source)
I'm not sure if the appended patch will help, but there's
a good chance it will. The problem was that inlining
optimizations were losing line number information; this
patch restores it, in at least some cases.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
Index: InlineCalls.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/InlineCalls.java,v
retrieving revision 1.13
diff -u -r1.13 InlineCalls.java
--- InlineCalls.java 17 May 2003 16:54:38 -0000 1.13
+++ InlineCalls.java 6 Jun 2003 17:45:58 -0000
@@ -20,8 +20,9 @@
}
/** Possibly convert a Symbol method call to invokeStatic or make. */
- Expression rewriteToInvocation(Symbol sym, Expression[] args)
+ Expression rewriteToInvocation(Symbol sym, ApplyExp aexp)
{
+ Expression[] args = aexp.args;
String uri = sym.getNamespaceURI();
if (uri == null || ! uri.startsWith("class:"))
return null;
@@ -51,7 +52,9 @@
if (! isNew)
xargs[1] = new QuoteExp(methodName);
args = xargs;
- return invProc.inline(new ApplyExp(new ReferenceExp(invDecl), args), this);
+ ApplyExp nexp = new ApplyExp(new ReferenceExp(invDecl), args);
+ nexp.setLine(aexp);
+ return invProc.inline(nexp, this);
}
protected Expression walkApplyExp(ApplyExp exp)
@@ -76,7 +79,7 @@
else if (rexp.getSymbol() instanceof Symbol)
{
Expression inv
- = rewriteToInvocation((Symbol) rexp.getSymbol(), exp.args);
+ = rewriteToInvocation((Symbol) rexp.getSymbol(), exp);
if (inv != null)
return inv;
}
@@ -102,12 +105,17 @@
comp.getInterpreter());
if (mproc != null)
{
+ ApplyExp nexp;
if (mproc.getStaticFlag())
- return new ApplyExp(mproc, exp.args);
- Expression[] margs = new Expression[1 + nargs];
- System.arraycopy(exp.getArgs(), 0, margs, 1, nargs);
- margs[0] = new ReferenceExp(decl.base);
- return new ApplyExp(mproc, margs);
+ nexp = new ApplyExp(mproc, exp.args);
+ else
+ {
+ Expression[] margs = new Expression[1 + nargs];
+ System.arraycopy(exp.getArgs(), 0, margs, 1, nargs);
+ margs[0] = new ReferenceExp(decl.base);
+ nexp = new ApplyExp(mproc, margs);
+ }
+ return nexp.setLine(exp);
}
}
}