Skip to content

Incorrect column number in stack traces repro #236

@TooTallNate

Description

@TooTallNate

Running minified code, I'm seeing incorrect column number on the generated stack trace, leading to source maps being incorrect traced. Example:

// min.js
if (typeof print === 'undefined') globalThis.print = console.log;
function r(){return e()}function e(){return new Error("bad")}print(r().stack)

In quickjs:

$ ./build/qjs min.js 
    at e (min.js:2:49)
    at r (min.js:2:21)
    at <eval> (min.js:2:49)

Compared to Node.js:

$ node min.js 
Error: bad
    at e (/Users/nrajlich/Code/quickjs-ng/quickjs/min.js:2:45)
    at r (/Users/nrajlich/Code/quickjs-ng/quickjs/min.js:2:21)
    at Object.<anonymous> (/Users/nrajlich/Code/quickjs-ng/quickjs/min.js:2:68)
    # other lines omitted for brevity

Notes:

  • QuickJS and V8 seem to differ in where the start of the error is - V8 starts at new, QuickJS starts at Error. This might be OK, but I figured I'd note the difference.
  • Bigger issue is that the 3rd line of the stack is totally off. It matches the first line of the stack in QuickJS, but should be pointing to column 68 which is where the r() function is invoked.

Not clear to me, but maybe this is related to #232?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions