Debugger starts up properly, displaying the first lines, but you can't step through contract code due to TypeError: Cannot read property 'line' of undefined.
Just traverse through code using step-out commands.
"Print instruction" works, however.
Debugger starts up properly, displaying the first lines,
SampleCrowdsale.sol | 0x70ca135e7738724d2876cf4d7615233f003c644a:
9: import './SampleToken.sol';
10:
11: contract SampleCrowdsale is IcoPlatformCrowdsale {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
but ultimately fails with:
TypeError: Cannot read property 'line' of undefined
at Debugger.stepOver (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:324748:64)
at Object.interpreter (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:319292:22)
at ReplManager.interpret (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:201603:18)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:440:10)
at emitOne (events.js:115:13)
at REPLServer.emit (events.js:210:7)
at REPLServer.Interface._onLine (readline.js:282:10)
at REPLServer.Interface._line (readline.js:631:8)
happened to me as well.
Same, can't seem to step into an inherited call
Same here...
Any solution to this ?
Same here
Same. I've noticed it's not a problem with inheritance alone, but rather for contracts in separate files. I can temporarily fix the problem by making one big file with my contract and all it's parent contracts
I have just one contract (aside from the Migrations) and I'm having the issue.
Actually I'm having the same error in the same situation but with a different stack trace (Mac OS):
TypeError: Cannot read property 'line' of undefined
at Object.formatRangeLines (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-debug-utils/index.js:210:1)
at printState (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/debug.js:91:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/debug.js:194:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-debugger/debugger.js:85:1
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
Here's how I fixed it:
/usr/local/lib/node_modules/truffle/build/cli.bundled.jsformatRangeLines: function(source, range, contextBefore)console.log(range); in the file and re-runnning it. In my case it was: { start: { line: 39, column: 0 }, end: undefined }range.end was undefined in my case, so I replaced:if (range.start.line == range.end.line) { by this line: if (range.end && range.start.line == range.end.line) { (null/undefined check of range.end)Can we get this merged into core?
On 2 Feb 2018 23:28, "jstoeffler" notifications@github.com wrote:
Here's how I fixed it:
- Find the bundled cli file, in my case /usr/local/lib/node_modules/
truffle/build/cli.bundled.js- Find the method in which the error occurs, in my case formatRangeLines:
function(source, range, contextBefore)- Log the range object by adding a console.log(range); in the file
and re-runnning it. In my case it was: { start: { line: 39, column: 0
}, end: undefined }- So range.end was undefined in my case, so I replaced:
this line : if (range.start.line == range.end.line) { by this line: if
(range.end && range.start.line == range.end.line) { (null/undefined
check of range.end)—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/trufflesuite/truffle/issues/655#issuecomment-362712777,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AC8oX_e2_nifB8TC_D-j8pzrsI_gW28Zks5tQ33jgaJpZM4QOxLb
.
I've created a PR: https://github.com/trufflesuite/truffle-debug-utils/pull/2
But it doesn't seem to solve OP's issue, which I think happens here : https://github.com/trufflesuite/truffle-debugger/blob/6aea5c57683bd6b68da712356fd6ab3539f1aac7/debugger.js#L351
@nickjm I can confirm your workaround works, I will open an issue regarding the bug.
I can also confirm @nickjm 's workaround works.
I updated my version of Truffle to 4.1.0 and it solved the problem.
In my case, I updated Truffle to 4.1.0 but still have the issue!
Digging into method "formatRangeLines: function(source, range, contextBefore)"
When "console.log(range);" it prints:
{ start: undefined, end: undefined }
Actually, the exception raised when accessing range.start at this block:
var startBeforeIndex = Math.max(
range.start.line - contextBefore, 0
);
The full stacktrace of the error as shown at the Terminal is:
TypeError: Cannot read property 'line' of undefined
at Object.formatRangeLines (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-debug-utils/index.js:201:1)
at printState (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/debug.js:125:1)
at Object.interpreter (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/debug.js:404:1)
at ReplManager.interpret (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/repl.js:119:1)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:539:10)
at emitOne (events.js:96:13)
at REPLServer.emit (events.js:188:7)
at REPLServer.Interface._onLine (readline.js:232:10)
at REPLServer.Interface._line (readline.js:583:8)
at REPLServer.Interface._ttyWrite (readline.js:860:14)
at REPLServer.self._ttyWrite (repl.js:612:7)
at ReadStream.onkeypress (readline.js:119:10)
at emitTwo (events.js:106:13)
at ReadStream.emit (events.js:191:7)
at emitKeys (internal/readline.js:389:14)
at next (native)
at ReadStream.onData (readline.js:970:36)
at emitOne (events.js:96:13)
at ReadStream.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at ReadStream.Readable.push (_stream_readable.js:134:10)
at TTY.onread (net.js:547:20)
Any suggestions?
Thanks,
@Muhammad-Altabba are you debugging across multiple files? If so, check out this issue:
https://github.com/trufflesuite/truffle/issues/826
Yes, thanks.
Thanks for bringing up this issue. I think the root cause here is mostly around the debugger's support for multiple files. This should be going out under the work of trufflesuite/truffle-debugger#39.
Closing this as duplicate. Let me know if problems persist!
Same here.
my truffle version is v 4.1.5.
but still have the issue!
debug(develop:0x070e447c...)> o
redux-saga error: uncaught at session.saga
at session.saga
at controller.saga
at stepOver
TypeError: Cannot read property 'line' of undefined
at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-debugger/dist/debugger.js:610:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:76:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:36:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:90:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:36:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:86:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:36:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:86:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:36:1
at runSelectEffect (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:698:1)
at runEffect (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:435:1)
at next (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:315:1)
at currCb (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:388:1)
at takeCb (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:466:1)
at Object.put (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/channel.js:73:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/channel.js:161:1
at Array.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/channel.js:182:1)
at Object.emit (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/channel.js:26:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/middleware.js:67:1
at dispatch (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux/es/applyMiddleware.js:35:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/utils.js:250:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:489:1
at exec (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/scheduler.js:19:1)
at flush (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/scheduler.js:60:1)
at asap (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/scheduler.js:33:1)
at Array.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/channel.js:185:1)
at Object.emit (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/channel.js:26:1)
at Object.dispatch (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/middleware.js:67:1)
at Session.dispatch (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-debugger/dist/debugger.js:2683:1)
at Session.stepOver (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-debugger/dist/debugger.js:2705:1)
at Object.interpreter (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/debug.js:349:1)
at ReplManager.interpret (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/repl.js:119:1)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
Most helpful comment
Same here.
my truffle version is v 4.1.5.
but still have the issue!