Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

High-level debugger API #1667

Closed
wants to merge 28 commits into from
Closed

Conversation

indutny
Copy link
Member

@indutny indutny commented Sep 7, 2011

This is in-progress pull request. I opened it to get a feedback from you about new API.

Changes:

  • It's using repl instead of raw readline
  • Asynchrounous autocomplete for repl and readline
  • repl() opens async repl that runs in script that is being debugged

@indutny
Copy link
Member Author

indutny commented Sep 7, 2011

I'm going to refactor some parts of written code, feel free to criticize any naming mistakes or anything related to code style.

@ry
Copy link

ry commented Sep 8, 2011

This is looking very nice.
I'd like the commands to be getters so that I can type help instead of help()

@indutny
Copy link
Member Author

indutny commented Sep 8, 2011

There is problem with getters and vm.ScriptContext, that causes segfaults. So I emulated getters by automatically invoking internal functions.

@indutny
Copy link
Member Author

indutny commented Sep 8, 2011

Ok, so I figured out what happens when we use getters in Context.

In this loop https://github.com/joyent/node/blob/master/src/node_script.cc#L348-353 we're getting all properties' values. Calling ->Get() on getter property name while call associated with it function. So when vm.runInContext is executed - all getters in context will be executed too.

@indutny
Copy link
Member Author

indutny commented Sep 8, 2011

One more problem:

Try downloading https://gist.github.com/1202987 and running node debug test.js.
Everything goes very slow and with big latency, when trying to use repl on incoming http request to test.js

@indutny
Copy link
Member Author

indutny commented Sep 8, 2011

Getters/Setters problem fixed in #1673

Started porting to high-level javascript API and repl.
Add async completion and execution interface for repl and readline
Move commands closer to each other, use .debugEval and .controlEval for
controlling repl output (no more incorrect 'debug>' prints).
…akpoint message and do not output explicit debug> on breaks
…r position after repl autocompletion, small refactor in readline
Lift prototype methods not only as accessors, but as properties too.
this.print() supports javascript objects inspection
this.error() implemented, don't throw error at callbacks and commands
Fixed list() invokation, when script is not on a breakpoint
Removed obsolete process.nextTick from `step` commands
@indutny
Copy link
Member Author

indutny commented Sep 10, 2011

Star this bug: http://code.google.com/p/v8/issues/detail?id=1639

Looks like it's the reason of Module._load breaks

@ry
Copy link

ry commented Sep 11, 2011

very cool - thank you.

we'll take incremental updates from here.

  • docs need updating.
  • can you get this running on windows?

@ry ry closed this in 67cc5c9 Sep 11, 2011
@indutny
Copy link
Member Author

indutny commented Sep 11, 2011

Priorities:

  • Try to run it on windows.
  • Add breakpoints management
  • Add docs for debugger, updated readline/repl

@indutny
Copy link
Member Author

indutny commented Sep 11, 2011

Tested debugger on windows - it works as fine as it works on linux.
While testing found repl bug - fix is here (this bug appears only if reqScope failed in _debugger) : indutny@2c0f844

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants