update documentation to indicate that we break code that does stack inspection
Look at this fun code from here:
exports.getFileName = function getFileName (calling_file) {
var origPST = Error.prepareStackTrace
, origSTL = Error.stackTraceLimit
, dummy = {}
, fileName
Error.stackTraceLimit = 10
Error.prepareStackTrace = function (e, st) {
for (var i=0, l=st.length; i<l; i++) {
fileName = st[i].getFileName()
if (fileName !== __filename) {
if (calling_file) {
if (fileName !== calling_file) {
return
}
} else {
return
}
}
}
}
// run the 'prepareStackTrace' function above
Error.captureStackTrace(dummy)
dummy.stack
// cleanup
Error.prepareStackTrace = origPST
Error.stackTraceLimit = origSTL
return fileName
}
It's inspecting the stack trace from an exception to figure out the filename for the caller module. Since Jalangi2 doesn't preserve call stacks, this code breaks.
This is probably a fundamental issue, but posting in case there happens to be some kind of solution.
There is not much we can do here unless we change the design significantly. Thanks for posting the sample program.
On Thu, Sep 17, 2015 at 5:27 PM, Manu Sridharan [email protected] wrote:
Look at this fun code from here https://github.com/TooTallNate/node-bindings/blob/e404152ee27f8478ccbc7122ee051246e8e5ec02/bindings.js#L102 :
exports.getFileName = function getFileName (calling_file) { var origPST = Error.prepareStackTrace , origSTL = Error.stackTraceLimit , dummy = {} , fileName
Error.stackTraceLimit = 10
Error.prepareStackTrace = function (e, st) { for (var i=0, l=st.length; i<l; i++) { fileName = st[i].getFileName() if (fileName !== __filename) { if (calling_file) { if (fileName !== calling_file) { return } } else { return } } } }
// run the 'prepareStackTrace' function above Error.captureStackTrace(dummy) dummy.stack
// cleanup Error.prepareStackTrace = origPST Error.stackTraceLimit = origSTL
return fileName }
It's inspecting the stack trace from an exception to figure out the filename for the caller module. Since Jalangi2 doesn't preserve call stacks, this code breaks.
This is probably a fundamental issue, but posting in case there happens to be some kind of solution.
— Reply to this email directly or view it on GitHub https://github.com/Samsung/jalangi2/issues/68.
Ok, I renamed the issue to indicate that we should update the documentation to note this problem. I'll leave it open until we do so.