Skip to content
This repository has been archived by the owner on Dec 9, 2017. It is now read-only.

preservation of ReferenceErrors when reading undefined global variables #19

Open
msridhar opened this issue Dec 11, 2013 · 19 comments
Open

Comments

@msridhar
Copy link
Contributor

We should think about preserving the ReferenceError that is thrown when reading an undefined variable. Right now, under Jalangi instrumentation, the error is no longer thrown. See existing unit test tests/unit/reference_error.js. We should also handle such errors thrown by a call to eval, e.g.:

var str = "{x: y}";
var indirect = eval;
indirect(str);

(The above is checked in as tests/unit/eval_undefined_var.js.) Not preserving ReferenceErrors is causing a jQuery unit test to fail when jQuery is Jalangi-instrumented.

@ksen007
Copy link
Contributor

ksen007 commented Dec 11, 2013

I do not have a suitable solution for this problem. Any ideas?

On Dec 11, 2013, at 12:09 PM, Manu Sridharan notifications@github.com wrote:

We should think about preserving the ReferenceError that is thrown when reading an undefined variable. Right now, under Jalangi instrumentation, the error is no longer thrown. See existing unit test tests/unit/reference_error.js. We should also handle such errors thrown by a call to eval, e.g.:

var str = "{x: y}";
var indirect = eval;
indirect(str);
(The above is checked in as tests/unit/eval_undefined_var.js.) Not preserving ReferenceErrors is causing a jQuery unit test to fail when jQuery is Jalangi-instrumented.


Reply to this email directly or view it on GitHub.

@msridhar
Copy link
Contributor Author

Simon and I discussed this. So right now, a read of a variable x gets instrumented to:

J$.I(typeof x === 'undefined' ? x = J$.R(9, 'x', undefined, true) : x = J$.R(9, 'x', x, true))

This code checks if x is non-existent, and if so, avoids actually reading x when invoking J$.R. But, this has the effect of suppressing the ReferenceError. OTOH, if the above conditional expression is removed and replaced with just x = J$.R(9, 'x', x, true), the ReferenceError will be thrown before the readPre callback of the client analysis.

Could we instead instrument as follows:

J$.I(typeof x === 'undefined' ? (J$.RU(9, 'x', undefined, true), x) : x = J$.R(9, 'x', x, true))

J$.RU (for Read-Undeclared) would just invoke readPre from the client analysis, but not read. Then, the actual read of x would cause the ReferenceError. One drawback of this approach is that readPre cannot assume that the read will succeed. But, currently we only have that guarantee because we change program semantics. As an alternative to introducing J$.RU, we could add a final optional parameter to J$.R indicating whether we're reading an undeclared variable or not.

Thoughts?

@msridhar
Copy link
Contributor Author

Correction to the above; it seems that typeof x === 'undefined' does not distinguish between a non-existent variable x and a variable x with the value undefined (sigh). Simon and I fleshed out a new scheme that will actually be able to test if a variable exists or not, but it's a bit complex. The idea is that if you know a variable reference is to either a global variable or it doesn't exist, you can check with the following code:

// s is the variable name
function checkDeclared(s) {
  var glob = (function () { return this; })();
  // this doesn't handle monkey-patching
  return glob.hasOwnProperty(s);
}

So, the scheme from the previous comment could be preserved, replacing typeof x === undefined with checkDeclared('x'). (We would need to elide the check entirely for references to local variables.) For the browser, checkDeclared could be attached to J$, but for node I think we'd need to inject checkDeclared into each script file, due to the funky module scope stuff.

This is getting rather complex. The whole purpose of this scheme is to preserve the readPre callback for reads of non-existent vars. Is this really such important functionality? If not, we can just go with x = J$.R(9, 'x', x, true) and be done with it.

@ksen007
Copy link
Contributor

ksen007 commented Dec 11, 2013

A variable may be initialized in record phase, but may not be initialized in the replay phase (e.g. window object). Does this take care of this?

Koushik

On Dec 11, 2013, at 1:21 PM, Manu Sridharan notifications@github.com wrote:

So right now, a read of a variable x gets instrumented to:

J$.I(typeof x === 'undefined' ? x = J$.R(9, 'x', undefined, true) : x = J$.R(9, 'x', x, true))
This code checks if x is non-existent, and if so, avoids actually reading x when invoking J$.R. But, this has the effect of suppressing the ReferenceError. OTOH, if the above conditional expression is removed and replaced with just x = J$.R(9, 'x', x, true), the ReferenceError will be thrown before the readPre callback of the client analysis.

Could we instead instrument as follows:

J$.I(typeof x === 'undefined' ? (J$.RU(9, 'x', undefined, true), x) : x = J$.R(9, 'x', x, true))
J$.RU (for Read-Undeclared) would just invoke readPre from the client analysis, but not read. Then, the actual read of x would cause the ReferenceError. One drawback of this approach is that readPre cannot assume that the read will succeed. But, currently we only have that guarantee because we change program semantics. As an alternative to introducing J$.RU, we could add a final optional parameter to J$.R indicating whether we're reading an undeclared variable or not.

Thoughts?


Reply to this email directly or view it on GitHub.

@msridhar
Copy link
Contributor Author

Ah, good point. We could take care of this by (1) throwing the ReferenceError ourselves in J$.R, rather than via a reference in the instrumented code, and (2) during replay, only throw a ReferenceError if there's no appropriate trace entry containing the value. Does that make sense?

@JacksonGL
Copy link
Contributor

Hi,

An alternative solution, not sure if it will solve the problem completely:

One way to distinguish undeclared variable from undefined variable is using
try catch,

try{x;}catch(e){J$.Ru('x');} J$.R( ... )

// read undefined
J$.Ru = function () {
//insert call back function here
xyz12312312; // read some variable name that is unlikely to be defined.
}

But since read x operation maybe used as an expression, and try-catch
cannot be used as an element of expression, how about use try-catch with
eval?

(eval('try{x}catch(e){J$.Ru();}'), J$.I(typeof x === 'undefined' ?
(J$.RU(9, 'x', undefined, true), x) : x = J$.R(9, 'x', x, true)))

// read undefined
J$.Ru = function () {
//insert call back function here
xyz12312312; // read some variable name that is unlikely to be defined.
here will throw an reference error
}

I have implemented it in the frontend, works well so far.

Best,
Liang

On Wed, Dec 11, 2013 at 2:23 PM, Manu Sridharan notifications@github.comwrote:

Ah, good point. We could take care of this by (1) throwing the
ReferenceError ourselves in J$.R, rather than in the instrumentation, and
(2) during replay, only throw a ReferenceError if there's no appropriate
trace entry containing the value. Does that make sense?


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-30370541
.

Liang Gong
Graduate Student of EECS
University of California, Berkeley

@JacksonGL
Copy link
Contributor

Sorry, after instrumentation it should look like this:
(eval('try{x}catch(e){J$.Ru();}'), J$.I(typeof x === 'undefined' ? x =
J$.R(6641, 'x', undefined, true) : x = J$.R(6641, 'x', x, true)))

On Wed, Dec 11, 2013 at 2:56 PM, Liang Gong jacksongl1988@gmail.com wrote:

Hi,

An alternative solution, not sure if it will solve the problem completely:

One way to distinguish undeclared variable from undefined variable is
using try catch,

try{x;}catch(e){J$.Ru('x');} J$.R( ... )

// read undefined
J$.Ru = function () {
//insert call back function here
xyz12312312; // read some variable name that is unlikely to be defined.
}

But since read x operation maybe used as an expression, and try-catch
cannot be used as an element of expression, how about use try-catch with
eval?

(eval('try{x}catch(e){J$.Ru();}'), J$.I(typeof x === 'undefined' ? (J$.RU(9, 'x', undefined, true), x) : x = J$.R(9, 'x', x, true)))

// read undefined
J$.Ru = function () {
//insert call back function here
xyz12312312; // read some variable name that is unlikely to be
defined. here will throw an reference error
}

I have implemented it in the frontend, works well so far.

Best,
Liang

On Wed, Dec 11, 2013 at 2:23 PM, Manu Sridharan notifications@github.comwrote:

Ah, good point. We could take care of this by (1) throwing the
ReferenceError ourselves in J$.R, rather than in the instrumentation,
and (2) during replay, only throw a ReferenceError if there's no
appropriate trace entry containing the value. Does that make sense?


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-30370541
.

Liang Gong
Graduate Student of EECS
University of California, Berkeley

Liang Gong
Graduate Student of EECS
University of California, Berkeley

@msridhar
Copy link
Contributor Author

@JacksonGL that would probably work fine to test for undeclared variables. However, I'd be a bit concerned that inserting eval calls everywhere could lead to greater overhead, as it could confuse the JS runtime and prevent optimizations. We can try and see what happens.

Have you implemented a complete fix to this issue, including Koushik's case with variables declared during record but not replay?

@JacksonGL
Copy link
Contributor

So far I tried on some websites using Firefox browser. I did not try for
record and replay yet. As I am only focusing on the frontend now.

Here is the code in case someone is interested in trying that for record
and replay:

function wrapReadWithUndefinedCheck(node, name) {
var ret;

    if (name !== 'location') {
        ret = replaceInExpr(
            //"(eval('try{" + name + "}catch(e){J$.Ru();}'),(" + name +

"=" + RP + "3))",
"(eval('try{" + name + "}catch(e){J$.Ru();}'),(" +
logIFunName + "(typeof (" + name + ") === 'undefined'? (" + name + "=" + RP

  • "2) : (" + name + "=" + RP + "3))))",
    createIdentifierAst(name),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst("undefined"), false, true),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst(name), true, true)
    );
    } else {
    ret = replaceInExpr(
    //"(try {" + name + ";}catch(e) {" +
    logReadUndeclaredFunName + "("+getIid()+","+name+");},(" + RP + "3))",
    "(eval('try{" + name + "}catch(e){J$.Ru();}')," + "(" +
    logIFunName + "(typeof (" + name + ") === 'undefined'? (" + RP + "2) : (" +
    RP + "3))))",
    createIdentifierAst(name),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst("undefined"), false, true),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst(name), true, true)
    );
    }
    transferLoc(ret, node);
    return ret;
    }

also need to add the following code into analysis.js

function Ru() {
x123123123;
}

and this at the end of the file:
sandbox.Ru = Ru; // read undeclared

Best,
Liang

On Wed, Dec 11, 2013 at 3:03 PM, Manu Sridharan notifications@github.comwrote:

@JacksonGL https://github.com/JacksonGL that would probably work fine
to test for undeclared variables. However, I'd be a bit concerned that
inserting eval calls everywhere could lead to greater overhead, as it
could confuse the JS runtime and prevent optimizations. We can try and see
what happens.

Have you implemented a complete fix to this issue, including Koushik's
case with variables declared during record but not replay?


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-30373792
.

Liang Gong
Graduate Student of EECS
University of California, Berkeley

@JacksonGL
Copy link
Contributor

Hi, I just found another issue. Need to check if the variable is used with
the 'typeof' operator.
If the code before transformation is like: if(typeof x === 'undefined')
{...}
The above solutions cannot handle that.

Best,
Liang Gong

On Wed, Dec 11, 2013 at 3:16 PM, Liang Gong jacksongl1988@gmail.com wrote:

So far I tried on some websites using Firefox browser. I did not try for
record and replay yet. As I am only focusing on the frontend now.

Here is the code in case someone is interested in trying that for record
and replay:

function wrapReadWithUndefinedCheck(node, name) {
var ret;

    if (name !== 'location') {
        ret = replaceInExpr(
            //"(eval('try{" + name + "}catch(e){J$.Ru();}'),(" + name
  • "=" + RP + "3))",
    "(eval('try{" + name + "}catch(e){J$.Ru();}'),(" +
    logIFunName + "(typeof (" + name + ") === 'undefined'? (" + name + "=" + RP
  • "2) : (" + name + "=" + RP + "3))))",
    createIdentifierAst(name),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst("undefined"), false, true),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst(name), true, true)
    );
    } else {
    ret = replaceInExpr(
    //"(try {" + name + ";}catch(e) {" +
    logReadUndeclaredFunName + "("+getIid()+","+name+");},(" + RP + "3))",
    "(eval('try{" + name + "}catch(e){J$.Ru();}')," + "(" +
    logIFunName + "(typeof (" + name + ") === 'undefined'? (" + RP + "2) : (" +
    RP + "3))))",
    createIdentifierAst(name),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst("undefined"), false, true),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst(name), true, true)
    );
    }
    transferLoc(ret, node);
    return ret;
    }

also need to add the following code into analysis.js

function Ru() {
x123123123;
}

and this at the end of the file:
sandbox.Ru = Ru; // read undeclared

Best,
Liang

On Wed, Dec 11, 2013 at 3:03 PM, Manu Sridharan notifications@github.comwrote:

@JacksonGL https://github.com/JacksonGL that would probably work fine
to test for undeclared variables. However, I'd be a bit concerned that
inserting eval calls everywhere could lead to greater overhead, as it
could confuse the JS runtime and prevent optimizations. We can try and see
what happens.

Have you implemented a complete fix to this issue, including Koushik's
case with variables declared during record but not replay?


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-30373792
.

Liang Gong
Graduate Student of EECS
University of California, Berkeley

Liang Gong
Graduate Student of EECS
University of California, Berkeley

@ksen007
Copy link
Contributor

ksen007 commented Dec 12, 2013

Yes, you need to remember this case as well.

On Dec 11, 2013, at 4:13 PM, Liang Gong notifications@github.com wrote:

Hi, I just found another issue. Need to check if the variable is used with
the 'typeof' operator.
If the code before transformation is like: if(typeof x === 'undefined')
{...}
The above solutions cannot handle that.

Best,
Liang Gong

On Wed, Dec 11, 2013 at 3:16 PM, Liang Gong jacksongl1988@gmail.com wrote:

So far I tried on some websites using Firefox browser. I did not try for
record and replay yet. As I am only focusing on the frontend now.

Here is the code in case someone is interested in trying that for record
and replay:

function wrapReadWithUndefinedCheck(node, name) {
var ret;

if (name !== 'location') {
ret = replaceInExpr(
//"(eval('try{" + name + "}catch(e){J$.Ru();}'),(" + name

  • "=" + RP + "3))",
    "(eval('try{" + name + "}catch(e){J$.Ru();}'),(" +
    logIFunName + "(typeof (" + name + ") === 'undefined'? (" + name + "=" + RP
  • "2) : (" + name + "=" + RP + "3))))",
    createIdentifierAst(name),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst("undefined"), false, true),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst(name), true, true)
    );
    } else {
    ret = replaceInExpr(
    //"(try {" + name + ";}catch(e) {" +
    logReadUndeclaredFunName + "("+getIid()+","+name+");},(" + RP + "3))",
    "(eval('try{" + name + "}catch(e){J$.Ru();}')," + "(" +
    logIFunName + "(typeof (" + name + ") === 'undefined'? (" + RP + "2) : (" +
    RP + "3))))",
    createIdentifierAst(name),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst("undefined"), false, true),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst(name), true, true)
    );
    }
    transferLoc(ret, node);
    return ret;
    }

also need to add the following code into analysis.js

function Ru() {
x123123123;
}

and this at the end of the file:
sandbox.Ru = Ru; // read undeclared

Best,
Liang

On Wed, Dec 11, 2013 at 3:03 PM, Manu Sridharan notifications@github.comwrote:

@JacksonGL https://github.com/JacksonGL that would probably work fine
to test for undeclared variables. However, I'd be a bit concerned that
inserting eval calls everywhere could lead to greater overhead, as it
could confuse the JS runtime and prevent optimizations. We can try and see
what happens.

Have you implemented a complete fix to this issue, including Koushik's
case with variables declared during record but not replay?


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-30373792
.

Liang Gong
Graduate Student of EECS
University of California, Berkeley

Liang Gong
Graduate Student of EECS
University of California, Berkeley

Reply to this email directly or view it on GitHub.

@JacksonGL
Copy link
Contributor

Fix the "typeof x" issue (at least for frontend),
need to add a field into x's ast node pointing to its parent node "typeof".
So that it distinguishes x reading in 'typeof x' from other x reading.

There are six changes in the esnstrument.js file attached. Changes are
marked with the comment: // #19 fix

var z = xxx;
var y = typeof x;

will be transformed into:

var z = J$.W(9, 'z', (eval('try{xxx}catch(e){J$.Ru("xxx");}'), J$.I(typeof
xxx === 'undefined' ? xxx = J$.R(5, 'xxx', undefined) : xxx = J$.R(5,
'xxx', xxx))), z);
var y = J$.W(17, 'y', J$.U(6, 'typeof', J$.I(typeof x === 'undefined' ? x =
J$.R(13, 'x', undefined) : x = J$.R(13, 'x', x))), y);

Best,
Liang

On Wed, Dec 11, 2013 at 4:24 PM, ksen007 notifications@github.com wrote:

Yes, you need to remember this case as well.

On Dec 11, 2013, at 4:13 PM, Liang Gong notifications@github.com wrote:

Hi, I just found another issue. Need to check if the variable is used
with
the 'typeof' operator.
If the code before transformation is like: if(typeof x === 'undefined')
{...}
The above solutions cannot handle that.

Best,
Liang Gong

On Wed, Dec 11, 2013 at 3:16 PM, Liang Gong jacksongl1988@gmail.com
wrote:

So far I tried on some websites using Firefox browser. I did not try
for
record and replay yet. As I am only focusing on the frontend now.

Here is the code in case someone is interested in trying that for
record
and replay:

function wrapReadWithUndefinedCheck(node, name) {
var ret;

if (name !== 'location') {
ret = replaceInExpr(
//"(eval('try{" + name + "}catch(e){J$.Ru();}'),(" + name

  • "=" + RP + "3))",
    "(eval('try{" + name + "}catch(e){J$.Ru();}'),(" +
    logIFunName + "(typeof (" + name + ") === 'undefined'? (" + name + "="
  • RP
  • "2) : (" + name + "=" + RP + "3))))",
    createIdentifierAst(name),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst("undefined"), false, true),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst(name), true, true)
    );
    } else {
    ret = replaceInExpr(
    //"(try {" + name + ";}catch(e) {" +
    logReadUndeclaredFunName + "("+getIid()+","+name+");},(" + RP + "3))",
    "(eval('try{" + name + "}catch(e){J$.Ru();}')," + "(" +
    logIFunName + "(typeof (" + name + ") === 'undefined'? (" + RP + "2) :
    (" +
    RP + "3))))",
    createIdentifierAst(name),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst("undefined"), false, true),
    wrapRead(node, createLiteralAst(name),
    createIdentifierAst(name), true, true)
    );
    }
    transferLoc(ret, node);
    return ret;
    }

also need to add the following code into analysis.js

function Ru() {
x123123123;
}

and this at the end of the file:
sandbox.Ru = Ru; // read undeclared

Best,
Liang

On Wed, Dec 11, 2013 at 3:03 PM, Manu Sridharan <
notifications@github.com>wrote:

@JacksonGL https://github.com/JacksonGL that would probably work
fine
to test for undeclared variables. However, I'd be a bit concerned
that
inserting eval calls everywhere could lead to greater overhead, as it
could confuse the JS runtime and prevent optimizations. We can try
and see
what happens.

Have you implemented a complete fix to this issue, including
Koushik's
case with variables declared during record but not replay?


Reply to this email directly or view it on GitHub<
https://github.com/SRA-SiliconValley/jalangi/issues/19#issuecomment-30373792>

.

Liang Gong
Graduate Student of EECS
University of California, Berkeley

Liang Gong
Graduate Student of EECS
University of California, Berkeley

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-30378865
.

Liang Gong
Graduate Student of EECS
University of California, Berkeley

@msridhar
Copy link
Contributor Author

@JacksonGL I don't think Github preserves attachments to emails regarding issues. The best thing for showing us your changes would be for you to (1) fork Jalangi, (2) create a branch with your changes in the fork, and (3) open a pull request for the branch.

@JacksonGL
Copy link
Contributor

Thanks for the suggestion. I forked the project and commit my changes which
can be viewed here:

https://github.com/JacksonGL/jalangi/commit/c14a9e99c53341680d743ec90953bbc281e98e0a

All python scripts/sym.py tests passed.

Best,
Liang Gong

On Wed, Dec 11, 2013 at 8:26 PM, Manu Sridharan notifications@github.comwrote:

@JacksonGL https://github.com/JacksonGL I don't think Github preserves
attachments to emails regarding issues. The best thing for showing us your
changes would be for you to (1) fork Jalangi, (2) create a branch with your
changes in the fork, and (3) open a pull request for the branch.


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-30388606
.

Liang Gong
Graduate Student of EECS
University of California, Berkeley

@msridhar
Copy link
Contributor Author

I added a couple of comments to the commit. We need to run on all tests, including some browser tests, before merging back.

@JacksonGL
Copy link
Contributor

New update is herehttps://github.com/JacksonGL/jalangi/commit/7ed5eb94d56d348cc973ec3c38eb46ffdf5f24ccto
address the comments. All sym tests passed. But not sure if using eval
with causing other subtle bugs.

Best,
Liang

On Thu, Dec 12, 2013 at 9:17 AM, Manu Sridharan notifications@github.comwrote:

I added a couple of comments to the commit.


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-30442099
.

Liang Gong
Graduate Student of EECS
University of California, Berkeley

@JacksonGL
Copy link
Contributor

an alternative solution for #19:
instead of using eval, use function expression + call expression:
((function(){try{var_name;}catch(e){J$.Ru('xxx');}})())

var z = xxx;
var y = typeof x;
var z1 = typeof (x + y)

will be transformed into:

var z = J$.W(9, 'z', (function () {try {xxx;} catch (e) {J$.Ru('xxx');}}(),
J$.I(typeof xxx === 'undefined' ? xxx = J$.R(5, 'xxx', undefined, true) :
xxx = J$.R(5, 'xxx', xxx, true))), z);

var y = J$.W(17, 'y', J$.U(6, 'typeof', J$.I(typeof x === 'undefined' ? x =
J$.R(13, 'x', undefined, true) : x = J$.R(13, 'x', x, true))), y);

var z1 = J$.W(29, 'z1', J$.U(14, 'typeof', J$.B(10, '+', (function () {try
{x;} catch (e) {J$.Ru('x');}}(), J$.I(typeof x === 'undefined' ? x =
J$.R(21, 'x', undefined, true) : x = J$.R(21, 'x', x, true))), J$.R(25,
'y', y, false))), z1);

Changes are herehttps://github.com/JacksonGL/jalangi/commit/5112b65f1fcf843fe6949cc6bbeb7b9214ac10fe.
But fails one test: (not sure why)

tests/unit/monkeypatch failed
Instrumenting
/home/jacksongl/JacksonGL_Ubuntu_Workspace/research/jalangi/github_myversion/jalangi/tests/unit/monkeypatch.js
...
fizz

/home/jacksongl/JacksonGL_Ubuntu_Workspace/research/jalangi/github_myversion/jalangi/src/js/analysis.js:699
throw tmp;
^
Error: Path deviation at record = [undefined] iid = 21 index = 6
at checkPath
(/home/jacksongl/JacksonGL_Ubuntu_Workspace/research/jalangi/github_myversion/jalangi/src/js/analysis.js:1254:27)
at RecordReplayEngine.RR_Fe
(/home/jacksongl/JacksonGL_Ubuntu_Workspace/research/jalangi/github_myversion/jalangi/src/js/analysis.js:1414:29)
at Object.Fe
(/home/jacksongl/JacksonGL_Ubuntu_Workspace/research/jalangi/github_myversion/jalangi/src/js/analysis.js:628:26)
at ConcolicValue.
(/home/jacksongl/JacksonGL_Ubuntu_Workspace/research/jalangi/github_myversion/jalangi/tests/unit/monkeypatch_jalangi_.js:24:36)
at objectToString (util.js:461:36)
at isArray (util.js:437:37)
at formatValue (util.js:249:7)
at inspect (util.js:140:10)
at Console.exports.format (util.js:27:20)
at Console.log (console.js:53:34)
---- Instrumenting

/home/jacksongl/JacksonGL_Ubuntu_Workspace/research/jalangi/github_myversion/jalangi/tests/unit/monkeypatch

---- Recording execution of

/home/jacksongl/JacksonGL_Ubuntu_Workspace/research/jalangi/github_myversion/jalangi/tests/unit/monkeypatch

---- Replaying

/home/jacksongl/JacksonGL_Ubuntu_Workspace/research/jalangi/github_myversion/jalangi/tests/unit/monkeypatch

None

Best,
Liang

On Thu, Dec 12, 2013 at 4:39 PM, Liang Gong jacksongl1988@gmail.com wrote:

New update is herehttps://github.com/JacksonGL/jalangi/commit/7ed5eb94d56d348cc973ec3c38eb46ffdf5f24ccto address the comments. All sym tests passed. But not sure if using eval
with causing other subtle bugs.

Best,
Liang

On Thu, Dec 12, 2013 at 9:17 AM, Manu Sridharan notifications@github.comwrote:

I added a couple of comments to the commit.


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-30442099
.

Liang Gong
Graduate Student of EECS
University of California, Berkeley

Liang Gong
Graduate Student of EECS
University of California, Berkeley

@msridhar
Copy link
Contributor Author

msridhar commented Jan 3, 2014

@JacksonGL re: the test failure, do you invoke toString() on any objects directly in your new code? The test is checking what happens if the client program overwrites Object.prototype.toString(). If you need to invoke toString(), you need to stash away a pointer to it and use that pointer to invoke it.

@JacksonGL
Copy link
Contributor

It seems that there is no explicit call of toString. I re-factored the
previous change, it passes the monkey-patch but fails two tests in
octanev.py: raytrace.js and gbemu.js
The problem is the newly added function expression checking undeclared
variable is instrumented in visitorRRPost. And that is not what we wanted.
I tried to avoid instrumenting that expression but not sure if everything
is considered.

Best,
Liang

On Fri, Jan 3, 2014 at 1:34 PM, Manu Sridharan notifications@github.comwrote:

@JacksonGL https://github.com/JacksonGL re: the test failure, do you
invoke toString() on any objects directly in your new code? The test is
checking what happens if the client program overwrites
Object.prototype.toString(). If you need to invoke toString(), you need to
stash away a pointer to it and use that pointer to invoke it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-31555537
.

Liang Gong
Graduate Student of EECS
University of California, Berkeley

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants