sidorares / crconsole

Remote JavaScript console for Chrome/Webkit
MIT License
262 stars 23 forks source link

Pause on debugger #15

Closed felippenardi closed 8 years ago

felippenardi commented 8 years ago

Does it provide a way to Pause execution on debugger; statements?

sidorares commented 8 years ago

I believe js would stop on debugger ( because remote debugger is attached ), need to check this

What would you like to see on break? node-like debugger ( debugger/repl modes, c/s/n commands to step in/out )?

sidorares commented 8 years ago

@felippenardi just checked - no, it does not stop script ( because Debugger.enable() was not called ) but it's easy to add

felippenardi commented 8 years ago

That would be fantastic because this way we can stop the process in the middle of a function and have acecss to everything within its context.

Right now I can only rely on console.log to see what is not in the global context—but is not enough because it doesn't allow interaction.

Do you think it is reasonable to have debuggers enabled by default on crconsole?

sidorares commented 8 years ago

this is almost done. I'll make debugger on by default but you can turn on/of with .debug on / .debug off repl commands if you no longer need to break on all debugger statements. I'll push later today

felippenardi commented 8 years ago

@sidorares I'm getting invalid REPL command:

localhost> .debug on
Invalid REPL keyword
localhost> .debugger on
Invalid REPL keyword
localhost>
felippenardi commented 8 years ago

Oh! Sorry, now that I read it again I understand you are explaining what you are going to do—not what is available already :)

Thanks for working on this, I'm really excited about it.

sidorares commented 8 years ago

hi @felippenardi - this is in master (not in npm yet). Note that repl is still evaluating scripts in page context, not in the current frame context, I'll add that later ( + also walking stack trace up ). Right know you can see source code around break and step in/over/out + continue (use .s / .n / .c repl commands for this )

See the screencast: out

felippenardi commented 8 years ago

@sidorares That is fantastic! Thanks for working on it, Andrey!

Displaying the source code around break is really useful. I'm very interested in being able to have repl evaluating scripts in current frame context.

Please let me know when you are working on this :)

sidorares commented 8 years ago

if you are iTerm2 user ( or other terminal with graphics support ) try .screen command, its pretty cool :) - it shows you screenshot of the page inside terminal

sidorares commented 8 years ago

btw pushed to npm as crconsole@1.2

felippenardi commented 8 years ago

@sidorares Whoa! Let me check that :D

How can I get this version from NPM? I'm running npm update -g crconsole and when I check the version of the cli, it says 0.0.1. And when checking the npm website, the lastest version is 1.1.1

sidorares commented 8 years ago

oops, looks like I forgot to publish, just pushed tag to github. Pushed to npm now - try npm view crconsole to see published versions

not sure how you update globally installed command line utilities ( with package.json / bin key ). I prefer to install everything locally

sidorares commented 8 years ago

@felippenardi .bt .up .down commands added. If you stopped at breakpoint repl command is evaluated on current frame instead of page context now, and you can change frame with .up / .down command ( also .up 10 to go more than one frame at once )

felippenardi commented 8 years ago

@sidorares That is incredible! You just made a dream come true, I've been looking for a tool that would do all this for 2 years! Love it :smile:

sidorares commented 8 years ago

@felippenardi - feel free to fill more feature requests :)