Does recrash covers constructors?

11 views
Skip to first unread message

alex

unread,
Sep 16, 2008, 8:02:03 AM9/16/08
to ReCrash
Hi,
I'm testing the CrashExample of the recrash homepage, I modified it
so that the exception happens in a constructor (I added an internal
class X which constructor calls the abs() that makes the exception).

By analyzing the trace created, I cannot find the invocation to the
X.<init> that is shown in the stackTrace..

Is this a limitation ? Does recrash does not cover constructor
invocation?

Many thanks,

Alex


<edu.mit.csail.pag.recrash.tracer.item.StackTraceItem
serialization="custom">
<unserializable-parents/>
<vector>
<default>
<capacityIncrement>0</capacityIncrement>
<elementCount>2</elementCount>
<elementData>
<edu.mit.csail.pag.recrash.tracer.item.MethodTraceItem>
<serializedArgumentObject>

<edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>
<isCloned>false</isCloned>
<typeName>CrashExample</typeName>
</
edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>

<edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>
<isCloned>false</isCloned>
<typeName>java.lang.String[]</typeName>
<object class="string-array"/>
</
edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>
</serializedArgumentObject>
<methodName>CrashExample.main</methodName>
<nounceNumber>0</nounceNumber>
</edu.mit.csail.pag.recrash.tracer.item.MethodTraceItem>
<edu.mit.csail.pag.recrash.tracer.item.MethodTraceItem>
<serializedArgumentObject>

<edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>
<isCloned>false</isCloned>
<typeName>CrashExample</typeName>
</
edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>

<edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>
<isCloned>false</isCloned>
<typeName>java.lang.Integer</typeName>
<object class="int">0</object>
</
edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>
</serializedArgumentObject>
<methodName>CrashExample.abs</methodName>
<nounceNumber>588</nounceNumber>
</edu.mit.csail.pag.recrash.tracer.item.MethodTraceItem>
<null/>
<null/>
<null/>
<null/>
<null/>
<null/>
<null/>
<null/>
</elementData>
</default>
</vector>
<edu.mit.csail.pag.recrash.tracer.item.StackTraceItem>
<default>
<nounceNumber>589</nounceNumber>
<serializeOneByOne>false</serializeOneByOne>
<crashedException class="java.lang.NullPointerException">
<stackTrace>
<trace>CrashExample.abs(CrashExample.java:25)</trace>
<trace>CrashExample$X.&lt;init&gt;(CrashExample.java:7)</
trace>
<trace>CrashExample.__original_main__(CrashExample.java:41)</
trace>
<trace>CrashExample.main(CrashExample.java)</trace>
</stackTrace>
</crashedException>
</default>
</edu.mit.csail.pag.recrash.tracer.item.StackTraceItem>
</edu.mit.csail.pag.recrash.tracer.item.StackTraceItem>

Sung Kim

unread,
Sep 16, 2008, 9:46:59 AM9/16/08
to rec...@googlegroups.com
Hi Alex,

Currently, ReCrash does not support crashes in a constructor. However, ReCrash would include the method that calls a problematic constructor, which is often located the upper level of the stack. Also, it is not that hard to invoke constructors. We will consider adding the feature in the next release.

Cheers,
- Sung

alex

unread,
Sep 16, 2008, 2:52:28 PM9/16/08
to ReCrash
Hi Sung,

Thanks for the clarification.

I have another issue with exceptions... I have the following code:
public class CrashTest {
public static void main(String[] args) {
try{
f("hello");
} catch(Exception e) {
"reCrash with".equals(e);
}
}
static void f(Object o) { g(o); }
static void g(Object o) { crash_test(o); }
static void crash_test(Object o) { throw new RuntimeException(); }
}

I was expecting to have a test case with the all the elements to
reproduce the crash, i.e. call to f(..) -> g(..) -> crash_test(..)
with the argument "hello". Instead, reCrash only generates the test
for main(String[] args)

In the paper, it is mentioned that there were some issues with
exceptions, is this related to that? or did made something wrong?


public class Recrash_reCrash12514_trace_gz extends TestCase {
public void setUp() throws Exception {
TraceReader.readTrace("/var/tmp/reCrash12514.trace.gz");
}


public void test_CrashTest_main_0() throws Throwable {
TraceReader.setMethodTraceItem(0);
CrashTest thisObject = (CrashTest) TraceReader.readObject(0);

// load arguments
// String[] arg_1 = [Ljava.lang.String;@4f80d6;
String[] arg_1 = (String[])TraceReader.readObject(1);

// Method invocation
thisObject.main(arg_1);
}
}

By looking on the trace, it seems that there is something
incomplete...

Thanks in advance,

Alex

<edu.mit.csail.pag.recrash.tracer.item.StackTraceItem
serialization="custom">
<unserializable-parents/>
<vector>
<default>
<capacityIncrement>0</capacityIncrement>
<elementCount>1</elementCount>
<elementData>
<edu.mit.csail.pag.recrash.tracer.item.MethodTraceItem>
<serializedArgumentObject>

<edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>
<isCloned>false</isCloned>
<typeName>CrashTest</typeName>
</
edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>

<edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>
<isCloned>false</isCloned>
<typeName>java.lang.String[]</typeName>
<object class="string-array"/>
</
edu.mit.csail.pag.recrash.tracer.item.ClonedArgumentObject>
</serializedArgumentObject>
<methodName>CrashTest.main</methodName>
<nounceNumber>0</nounceNumber>
</edu.mit.csail.pag.recrash.tracer.item.MethodTraceItem>
<null/>
<null/>
<null/>
<null/>
<null/>
<null/>
<null/>
<null/>
<null/>
</elementData>
</default>
</vector>
<edu.mit.csail.pag.recrash.tracer.item.StackTraceItem>
<default>
<nounceNumber>1</nounceNumber>
<serializeOneByOne>false</serializeOneByOne>
<crashedException class="java.lang.RuntimeException">
<stackTrace>
<trace>CrashTest.crash_test(CrashTest.java:23)</trace>
<trace>CrashTest.g(CrashTest.java:20)</trace>
<trace>CrashTest.f(CrashTest.java:18)</trace>
<trace>CrashTest.__original_main__(CrashTest.java:9)</trace>
<trace>CrashTest.main(CrashTest.java)</trace>
</stackTrace>
</crashedException>
</default>
</edu.mit.csail.pag.recrash.tracer.item.StackTraceItem>
</edu.mit.csail.pag.recrash.tracer.item.StackTraceItem>



On Sep 16, 3:46 pm, "Sung Kim" <hun...@gmail.com> wrote:
> Hi Alex,
> Currently, ReCrash does not support crashes in a constructor. However,
> ReCrash would include the method that calls a problematic constructor, which
> is often located the upper level of the stack. Also, it is not that hard to
> invoke constructors. We will consider adding the feature in the next
> release.
>
> Cheers,
> - Sung
>

Shay Artzi

unread,
Sep 16, 2008, 2:59:09 PM9/16/08
to rec...@googlegroups.com
Alex-
Since the code is handling the exception in the catch block, it is no
longer propagated outside of main and thus reCrash is unaware of it.
You can either invoke the reCrash custom handler in the catch block, or
you can throw the exception.

Shay

alex

unread,
Sep 16, 2008, 3:22:48 PM9/16/08
to ReCrash


On Sep 16, 8:59 pm, Shay Artzi <ar...@MIT.EDU> wrote:
> Alex-
> Since the code is handling the exception in the catch block, it is no
> longer propagated outside of main and thus reCrash is unaware of it.

Hi Shay,
But isn't exactly the role of "recrash with".equals(e) ? If I
remove it, then recrash does not capture the exception.

> You can either invoke the reCrash custom handler in the catch block, or
> you can throw the exception.
>

How can this be done?

Cheers,

Alex

alex

unread,
Sep 16, 2008, 3:41:16 PM9/16/08
to ReCrash
Hi,
I checked the generated bytecode, and there is no call to
youMayCrash and youAreOK on every method, only on the main...

Cheers,

Alex
Reply all
Reply to author
Forward
0 new messages