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

Recommended debugging techniques #25

Closed
czechboy0 opened this issue Feb 10, 2016 · 6 comments
Closed

Recommended debugging techniques #25

czechboy0 opened this issue Feb 10, 2016 · 6 comments

Comments

@czechboy0
Copy link

I was wondering how you approach debugging Curassow (with lldb), since it forks off worker processes at the beginning and lldb doesn't support automatic following of forks.

I found a very tedious way:

  • run your server in terminal window 1
  • in another window launch lldb for your binary
  • run attach WORKER_PID, which is visible when the server starts
  • continue as usual in the lldb instance, allowing to inspect the incoming requests in the debugger

This will obviously get untenable as a codebase grows, so I'm wondering what your thoughts on this are.

@kylef
Copy link
Member

kylef commented Feb 10, 2016

I try to limit debugging via Curassow, I'd usually try and write a test that has the same behaviour and attach lldb to the test runner.

As for problems in your application, you can just hit the Nest callback directly, I was planning to write some convenience testing functions to make that easier.

@czechboy0
Copy link
Author

If you could just add two lines on how one can do that in the readme I'd consider that enough for what I was going for here :)

@kylef
Copy link
Member

kylef commented Feb 10, 2016

You can use make run-tests to build the test runner, which can be run with ./run-tests. So to attach that to lldb:

$ make run-tests
$ lldb ./run-tests
< add all your breakpoints etc here>
(lldb) r
Process 50884 launched: './run-tests' (x86_64)
-> HTTPParser
  -> can parse a HTTP request body
  -> reads the message body when Content-Length is present
  -> throws an error when the client uses bad HTTP syntax
  -> throws an error when the client uses a bad HTTP version
  -> throws an error when the client disconnects before sending an HTTP request
  -> throws an error when the client disconnects before sending the entire message body

6 passes and 0 failures
Process 50884 exited with status = 0 (0x00000000) 

@czechboy0
Copy link
Author

Yeah that's pretty much what I'm doing, thanks!

@kylef
Copy link
Member

kylef commented Feb 12, 2016

Are you trying to debug an issue with Curassow specifically or your application? If there is a bug with Curassow please open an issue and I can take a look. If it's with your application, I'd suggest removing Curassow from the mix completely and testing your application directly [example].

@czechboy0
Copy link
Author

No bug in Currasow, I was just debugging my server running on it. Ok thanks

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

No branches or pull requests

2 participants