provegard / ncdbg

A debugger for Nashorn that uses Chrome DevTools as frontend
BSD 3-Clause "New" or "Revised" License
31 stars 5 forks source link

Debugging session not stopping on breakpoints #100

Closed benoitcerrina closed 5 years ago

benoitcerrina commented 6 years ago

Hello, recently (maybe a week or two ago) ncdbg stopped working correctly for me. In particular breakpoints don't work. I am using chrome version 69.0.3497.100

benoitcerrina commented 6 years ago

ncdbg.log Attached is a log of the issue happening

provegard commented 6 years ago

Sorry for the delay! I will take a look tomorrow.

provegard commented 6 years ago

Huh, this is weird:

09:23:02.908 [NashornDebugger] DEBUG c.p.ncd.nashorn.ScriptPublisher - Adding script with ID 'nds236', URI 'xplan/xPlanDataAnalytics', hash '0CDE65D79F71A40B7B657627F17A77BF and version ScriptVersion(238,true)'
09:23:29.376 [NashornDebugger] INFO  c.p.ncd.nashorn.NashornDebuggerHost - Setting an unresolved breakpoint with ID ndb3 at line 38 in script with URL lanDataAnalytics

Note xplan/xPlanDataAnalytics vs lanDataAnalytics.

Are you using a particular NCDbg version of the latest master?

provegard commented 6 years ago

I'm unable to reproduce. I have one small discrepancy compared to your log output though - which OS are you using?

provegard commented 6 years ago

Interestingly:

xplan/xP lanDataAnalytics
https://

The stripped part is equal in length to "https://". Perhaps a coincidence though.

benoitcerrina commented 6 years ago

Hello I am using windows 10 I think I am using the latest master unless I made a mistake using git so I will recheck

benoitcerrina commented 6 years ago

I confirm I am using the latest master.

provegard commented 6 years ago

Do you load scripts using the load extension?

provegard commented 6 years ago

Also, what does the source tree in DevTools look like? Can you post a screenshot that shows the script in question?

provegard commented 6 years ago

Ok, I can reproduce by adding a sourceURL comment to my test script. Does your script contain sourceURL?

provegard commented 6 years ago

I found the following fix in DevTools:

https://github.com/ChromeDevTools/devtools-frontend/commit/6fc46fbf18af8001200fb9f60a55c2645eaaddf1

That fix is not in Chrome 69.0.3497.100, however.

I'm a bit reluctant to create a workaround if the fix above gets into Chrome soon anyway.

Can you remove sourceURL (if you have it) in the meantime?

benoitcerrina commented 6 years ago

Hello, if you are talking about a sourceURL comment in the script, there are none so I can't really remove them. Is there something else similar which could cause the problem or some other trace I can provide to help identify it.

provegard commented 6 years ago

That's odd - sourceURL was the only way for me to reproduce. Perhaps the correct way is to prefix all URLs with file:///.

You can try removing the v8only query string parameter from the DevTools URL. It may have side effects though.

benoitcerrina commented 6 years ago

hello removing the v8only query string worked in my first test. I will confirm to you tomorrow if it worked completely.
Thanks for your support

Deepashreehg commented 6 years ago

Hello, the fix works for me in all scenarios. Thank you.

benoitcerrina commented 6 years ago

hello did knowing that removing the v8only parameter help understand what is going on. Still unsure why see the problem and you don't and what could be the difference between our configurations

provegard commented 6 years ago

The v8only parameter enables some NodeJS logic inside the DevTools frontend, among other things the stripping of file:/// which in your case is problematic since the URL doesn't start with that prefix. Not sure why I'm not seeing the same thing unless I add sourceURL to the script.

But I'll do some tests without v8only and if everything seems to work (as @Deepashreehg suggests) then I'll update the log message that shows the DevTools link to open in Chrome.

brainopener commented 6 years ago

@provegard We had the same problem with scripting in Jira (we're working over here) and removing the v8only parameter fixed us up.

provegard commented 6 years ago

@brainopener thanks for letting me know! I will make a release where I remove the v8only parameter (and possibly experimental as well) from the link that is shown in the log. I've had some busy weeks though, so I haven't managed to find time for it.