Another breakpoint not hit problem
Closed this issue · 1 comments
While breakpoints work fine for files that are parsed before the main script starts I have problems with such files which are loaded at runtime. The situation is I have a testing framework which enumerates files on disk and loads them with require()
to execute them.
Not only does no breakpoint hold there, even the debugger
command doesn't work correctly. It stops but the shown position is somewhere in a file that was loaded normally.
Is this again a filename issue? The test files are loaded by the same mechanism as any other module and there breakpoints work. So it's hard to see the filename problem applying here. The debug log is:
Attached to duktape debugger.
Protocol ID: 2 20100 external unknownIN <- <NFY: 4> <int: 7> <str: DebuggerHandleFile> <str: main.js> <EOM: 0>
Finalized Initialization.
removeAllTargetBreakpoints
OUT -> <REQ: 1> <0x17: LISTBREAK>
Status Notification: PAUSE
IN <- <REP: 2> <EOM: 0>
OUT -> <REQ: 1> <0x13: RESUME>
IN <- <REP: 2> <EOM: 0>
[FE] setBreakPointsRequest
OUT -> <REQ: 1> <0x18: ADDBREAK>
IN <- <REP: 2> <int: 0> <EOM: 0>
[FE] configurationDoneRequest
[FE] threadsRequest
Status Notification: PAUSE
[FE] threadsRequest
[FE] stackTraceRequest
OUT -> <REQ: 1> <0x1c: GETCALLSTACK>
IN <- <REP: 2> <str: main.js> <str: global> <int: 27> <int: 26> <str: eval> <str: > <int: 1> <int: 1> <EOM: 0>
OUT -> <REQ: 1> <0x1e: EVAL>
IN <- <REP: 2> <int: 0> <str: undefined> <EOM: 0>
OUT -> <REQ: 1> <0x1e: EVAL>
IN <- <REP: 2> <int: 1> <str: TypeError: cannot read property 'constructor' of undefined> <EOM: 0>
OUT -> <REQ: 1> <0x1e: EVAL>
IN <- <REP: 2> <int: 0> <str: [object global]> <EOM: 0>
[FE] scopesRequest
OUT -> <REQ: 1> <0x1d: GETLOCALS>
IN <- <REP: 2> <EOM: 0>
OUT -> <REQ: 1> <0x1e: EVAL>
IN <- <REP: 2> <int: 0> <str: undefined> <EOM: 0>
OUT -> <REQ: 1> <0x1e: EVAL>
IN <- <REP: 2> <int: 0> <tval: undefined> <EOM: 0>
[FE] variablesRequest
[FE] setBreakPointsRequest
OUT -> <REQ: 1> <0x18: ADDBREAK>
IN <- <REP: 2> <int: 1> <EOM: 0>
[FE] continueRequest
OUT -> <REQ: 1> <0x13: RESUME>
IN <- <REP: 2> <EOM: 0>
...
[FE] disconnectRequest
What I did was:
- set a breakpoint in the main script
- run
- breakpoint is hit
- add a breakpoint in the file which gets dynamically loaded
- continue
- entire run ended without hitting the second breakpoint
As you can see there is type error in this log, which however has nothing to do with this breakpoint problem. However, I have yet to figure out what the problem here is. The constructor of what is actually missing (and why is it needed)?
I solved this issue. The reason for not recognized breakpoints was again that files name have not matched. In this case files loaded with required()
were specified with an absolute path, which the duktape debugger extension cannot handle. By making these paths relative to the current workdir in the module resolution step solved the issue.
However, this also means you can never debug anything which is not in or below the current workdir. Limits test organization somewhat.