Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a WebSocket server for debugging. #13204

Merged
merged 1 commit into from Sep 12, 2016
Merged

Conversation

@ejpbruel
Copy link
Contributor

ejpbruel commented Sep 8, 2016

This pull request adds a very simple WebSocket server to Servo, that we intend to use for debugging. It currently only echoes back messages, but eventually we want this server to implement the Chrome Debugging Protocol.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #__ (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because this is a prototype.

This change is Reviewable

@highfive
Copy link

highfive commented Sep 8, 2016

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @emilio (or someone else) soon.

@jdm
Copy link
Member

jdm commented Sep 8, 2016

-S-awaiting-review +S-needs-code-changes


Reviewed 6 of 6 files at r1.
Review status: all files reviewed at latest revision, 4 unresolved discussions.


components/debugger/lib.rs, line 6 [r1] (raw file):

#![crate_name = "debugger"]
#![crate_type = "rlib"]

http://doc.crates.io/manifest.html#building-dynamic-or-static-libraries


components/servo/Cargo.lock, line 475 [r1] (raw file):

]

[[package]]

Run ./mach update-cargo -p servo so cef/Cargo.lock is updated as well.


components/servo/lib.rs, line 129 [r1] (raw file):

                                                                opts.time_profiler_trace_path.clone());
        let mem_profiler_chan = profile_mem::Profiler::create(opts.mem_profiler_period);
        opts.debugger_port.map(|port| {

if let insteawd.


components/util/opts.rs, line 570 [r1] (raw file):

    opts.optflag("f", "hard-fail", "Exit on thread failure instead of displaying about:failure");
    opts.optflag("F", "soft-fail", "Display about:failure on thread failure instead of exiting");
    opts.optflagopt("", "debugger", "Start remote debugger server on port", "2794");

I would prefer jsdebugger, since otherwise this could conflict in a confusing fashion with a forthcoming --debugger [binary] argument for ./mach run.


Comments from Reviewable

@ejpbruel
Copy link
Contributor Author

ejpbruel commented Sep 9, 2016

components/debugger/lib.rs, line 6 [r1](raw file):

#![crate_name = "debugger"]
#![crate_type = "rlib"]
http://doc.crates.io/manifest.html#building-dynamic-or-static-libraries

I am not sure how to interpret this. Are you saying I shouldn't use crate_type here (note that I've done so because the devtools component does)? Please clarify.

components/servo/lib.rs, line 129 [r1](raw file):

                                                            opts.time_profiler_trace_path.clone());
    let mem_profiler_chan = profile_mem::Profiler::create(opts.mem_profiler_period);
    opts.debugger_port.map(|port| {

if let insteawd.

Should we change the surrounding code (i.e. line 132) to use if let as well?

opts.optflag("f", "hard-fail", "Exit on thread failure instead of displaying about:failure");
opts.optflag("F", "soft-fail", "Display about:failure on thread failure instead of exiting");
opts.optflagopt("", "debugger", "Start remote debugger server on port", "2794");
I would prefer jsdebugger, since otherwise this could conflict in a confusing fashion with a forthcoming --debugger [binary] argument for ./mach run.

How about --remote-debugging-port? This is consistent what Chrome uses, and avoids the name clashes you mentioned.

@ejpbruel ejpbruel force-pushed the ejpbruel:debugger branch from 99edd17 to 7df73c5 Sep 9, 2016
@jdm
Copy link
Member

jdm commented Sep 9, 2016

-S-awaiting-review +S-needs-code-changes +S-fails-tidy


Reviewed 3 of 3 files at r2.
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


components/debugger/lib.rs, line 6 [r1] (raw file):

Previously, jdm (Josh Matthews) wrote…

http://doc.crates.io/manifest.html#building-dynamic-or-static-libraries

Since we can do this in the Cargo.toml instead, we should. The devtools code is from a time before it was possible, iirc.

components/util/opts.rs, line 731 [r2] (raw file):

    let debugger_port = opt_match.opt_default("remote-debugging-port", "2794").map(|port| {
        port.parse().unwrap_or_else(|err| args_fail(&format!("Error parsing option: --debugger ({})", err)))

Update the error message, too.


Comments from Reviewable

@jdm jdm assigned jdm and unassigned emilio Sep 9, 2016
@ejpbruel ejpbruel force-pushed the ejpbruel:debugger branch from 7df73c5 to 5b026ca Sep 9, 2016
fitzgen added a commit to servo/highfive that referenced this pull request Sep 9, 2016
Want to watch the new stuff coming in servo/servo#13204

r? @jdm
}

fn run_server(port: u16) {
let server = Server::bind(("127.0.0.1", port)).unwrap();;

This comment has been minimized.

@fitzgen

fitzgen Sep 9, 2016

Member

NIt: ;;

@jdm
Copy link
Member

jdm commented Sep 9, 2016

-S-awaiting-review +S-needs-code-changes


Reviewed 5 of 5 files at r3.
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


Comments from Reviewable

@ejpbruel ejpbruel force-pushed the ejpbruel:debugger branch from 5b026ca to 8856671 Sep 12, 2016
@jdm
Copy link
Member

jdm commented Sep 12, 2016

@bors-servo: r+


Reviewed 4 of 4 files at r4.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@bors-servo
Copy link
Contributor

bors-servo commented Sep 12, 2016

📌 Commit 8856671 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Sep 12, 2016

Testing commit 8856671 with merge f834c89...

bors-servo added a commit that referenced this pull request Sep 12, 2016
Implement a WebSocket server for debugging.

<!-- Please describe your changes on the following line: -->

This pull request adds a very simple WebSocket server to Servo, that we intend to use for debugging. It currently only echoes back messages, but eventually we want this server to implement the Chrome Debugging Protocol.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because this is a prototype.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13204)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 12, 2016

@bors-servo bors-servo merged commit 8856671 into servo:master Sep 12, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.