Skip to content

Support debugging in external debuggers#7

Open
Herbstein wants to merge 2 commits into
Mortal:masterfrom
Herbstein:idea-debug
Open

Support debugging in external debuggers#7
Herbstein wants to merge 2 commits into
Mortal:masterfrom
Herbstein:idea-debug

Conversation

@Herbstein
Copy link
Copy Markdown
Contributor

@Herbstein Herbstein commented Oct 6, 2017

This is a preliminary effort to support debugging in editors that aren't IntelliJ. I don't know if this breaks anything subtlety on the server side of things, but this seems to give the same results as before. With the added benefit of being able to debug in any debugger that supports single-file debugging.

I only edited one file to get feedback on the solution. I can update all tasks if the solution is sufficient.

@Mortal
Copy link
Copy Markdown
Owner

Mortal commented Oct 10, 2017

Does this allow you to debug testAll in IntelliJ? I thought IntelliJ allowed you to give data on stdin?

@Herbstein
Copy link
Copy Markdown
Contributor Author

You're right in this being slightly wrong, which I just realized. If we have to use a scanner, which I think is the only reasonable option, we need to know how fast the input is written to stdin, wait for that amount of time, check if System.in.available() > 0. Continue the evaluation path if the condition is true, else go to the test path. If the program is called with a file piped to stdin I believe the wait timer could be miniscule, or even nonexistent. Testing with a wait of 100ms produces no noticeable delay though.

@Mortal
Copy link
Copy Markdown
Owner

Mortal commented Nov 22, 2017

Does IntelliJ support adding system properties to the VM when debugging? If so, you can add a system property named JUDGE_DEBUG or some such, and we can add if (System.getProperty("JUDGE_DEBUG") != null) testAll(); to the test programs.

I've already started adding if (testcases == 0) testAll(); to the test programs, but this would still require you to enter a 0 at stdin every time the program is debugged.

@Herbstein
Copy link
Copy Markdown
Contributor Author

Herbstein commented Nov 22, 2017 via email

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

Successfully merging this pull request may close these issues.

2 participants