bugs in stackTrace.c
Godmar Back
kaffe@rufus.w3.org
Wed, 26 Aug 1998 16:25:12 -0600 (MDT)
Hi Stefan,
I don't think it is possible for meth to ever become 1.
It either points to a valid method or is NULL. Look at how
stackTrace.h finds the method. For the translator, findMethodFromPC
won't return 1. For the interpreter, TnextFrame in
systems/unix-jthread/internal.c maps the JNI frames with Method==1 to
NULL.
Can you construct an example where this failure occurs?
I did not understand your NonExistingClassName example.
- Godmar
>
> Hi!
> While I was trying to get Kaffe compile and run on my Amiga I ran accros a little bug
> in the stackTrace code. When a builtin C function adds itself to the stackframes,
> it adds itself with a methodptr = 1. When the printStackFrame tries to print the code,
> it accesses illegal addresses since it tries to access a method block at address 1.
> I guess that this would cause a core dump on Unix, but I havn't been able to confirm this.
> Anyone else?
> An easy way to reproduce it is to run 'Kaffe NonExistingClassName' to make it throw an
> ClassNotExistsException.
> Anyway, applying this patch should fix this problem.
>
> regards,
> Stefan Burstroem
> stefan@omnipresence.com
>
>
> *** kaffe/kaffevm/stackTrace.c Sat Apr 04 23:19:07 1998
> --- source:kaffe-1.0.b1.snap_jit_sb980818/kaffe/kaffevm/stackTrace.c Sat Aug 22 03:37:38 1998
> ***************
> *** 188,193 ****
> --- 188,194 ----
> meth = findMethodFromPC(pc);
> #endif
> if (meth != 0) {
> + if(meth != (void *)1) {
> linepc = 0;
> linenr = -1;
> if (meth->lines != 0) {
> ***************
> *** 208,213 ****
> --- 209,217 ----
> CLASS_CNAME(meth->class),
> meth->name->data,
> linenr);
> + }
> + } else { /* The method is really a compiled C function */
> + sprintf(buf, "\tat (compiled C code)");
> }
> len = strlen(buf);
> str = newArray(TYPE_CLASS(TYPE_Char), len);
>
>
>