Coder Social home page Coder Social logo

Comments (3)

ksen007 avatar ksen007 commented on July 22, 2024

This is not a bug, but an expected behavior of Jalangi. We treat Array.push() as a native function in Jalangi. The method is called during recording, but is skipped during replay. Replay recreates the array x as it's elements are accessed. For example, the following code will give the correct output.

var x = new Array()
function f() {
x.push({p: "foo"});
console.log(x[0]);
console.log(x);
}
f()

If you do not want to skip the push method of Array during replay, you can modify the function getSymbolicFunctionToInvokeAndLog in analysis.js. However, you need to be really careful when you modify the function. You should never call push on a ConcolicValue.

from jalangi.

simonhj avatar simonhj commented on July 22, 2024

I see. Thanks for the clarification.

from jalangi.

msridhar avatar msridhar commented on July 22, 2024

I slightly disagree with the characterization here. This is not a bug, but it's because we do not model the fact that console.log converts its argument to a string. The following example will work:

var x = new Array()
function f() {
    x.push({p: "foo"})
    console.log(String(x))
}
f()

It works by recording the return value of native function String, not by re-constituting the array. While console is not part of any standard specification, at some point we may want to model its behavior more accurately to avoid confusion; I'll open a separate issue.

from jalangi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.