Re: [DynInst_API:] Broken exception handling in main()


Date: Mon, 24 Sep 2012 20:21:13 -0500
From: Andrew Bernat <bernat@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] Broken exception handling in main()
On Sep 24, 2012, at 8:06 PM, Josh Stone <jistone@xxxxxxxxxx> wrote:

My test mutator is processMain, which just tries to start a process and
instrument the main function, adding a printf call to mark the occasion.
The mutatee "throw" is just a main function that throws and catches its
own exception before returning.

When running by itself, the mutatee does just fine, exiting quietly.
When running instrumented, I get this:

 $ ./processMain ./throw
 main!
 terminate called after throwing an instance of 'std::runtime_error'
   what():  foo

So it does get the instrumentation's printf, but then the exception gets
thrown and not caught, forcing an bad exit and that terminate message
from libstdc++.

Any ideas?

Yes. In short, we can mangle exception handling due to our code insertion technique. I have some research code to handle this (as well as nastier binaries) that I'll test out here. I can test a fix pretty quickly, and have some ideas for a more elegant technique. 

Drew




[← Prev in Thread] Current Thread [Next in Thread→]