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

Add documentation on how to debug Goblint with VS Code #216

Merged
merged 6 commits into from
May 7, 2021
Merged

Conversation

jerhard
Copy link
Member

@jerhard jerhard commented May 6, 2021

Add a Markdown description on how to debug Goblint with VS Code, using the hackwaly.ocamlearlybird extension. Closes #215. Related to #208.

Copy link
Member

@sim642 sim642 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's not mentioned anywhere, I'm guessing earlybird doesn't require a particular OCaml version anymore? Or if it does, then it should be mentioned here.


To build a Goblint executable with debug information, run the following command within the `analyzer` directory.

`make debug`
Copy link
Member

@sim642 sim642 May 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't gotten around to trying earlybird but when I read about it, it required OCaml bytecode compilation. I see this debug target does that:

analyzer/make.sh

Lines 61 to 63 in 11dcafd

;; debug)
ocb -tag debug $TARGET.d.byte &&
cp _build/$TARGET.d.byte goblint.byte

Unlike the normal native build, this one still uses ocamlbuild instead of dune. Although this isn't necessarily about the documentation, I'm wondering if we could easily change this target to also build using dune.


This would be especially useful for speed because ocamlbuild doesn't do parallel building like dune I think, so it takes much longer.

Install the [`hackwaly.ocamlearlybird` extension](https://marketplace.visualstudio.com/items?itemName=hackwaly.ocamlearlybird) in your installation of Visual Studio Code.
To be able to use this extension, you additionally need to install `ocamlearlybird` on the opam switch you use for Goblint. To do this, run the following command in the `analyzer` directory:

`opam install earlybird`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should also be part of make dev?

analyzer/make.sh

Lines 98 to 101 in 11dcafd

;; dev)
echo "Installing opam packages for development..."
opam install utop ocaml-lsp-server ocp-indent ocamlformat ounit2
# ocaml-lsp-server is needed for https://github.com/ocamllabs/vscode-ocaml-platform

]
}
```
Note that the individual strings in `arguments` cannot contain spaces.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess they can, but then such argument would be passed as if it was quoted in the shell to contain a literal space.

@sim642 sim642 added documentation Documentation, comments usability labels May 6, 2021
@sim642 sim642 mentioned this pull request May 6, 2021
18 tasks
@sim642
Copy link
Member

sim642 commented May 7, 2021

I just noticed something slightly annoying now. Having the bytecode build around makes regression testing script ask this every time:

goblintbyte = File.join(Dir.getwd,"goblint.byte")
if File.exists?(goblintbyte) then
puts "Running the byte-code version! Continue? (y/n)"
exit unless $stdin.gets()[0] == 'y'
goblint = goblintbyte

Maybe we should make it an option of the script instead?

@michael-schwarz
Copy link
Member

Maybe we should make it an option of the script instead?

Maybe yes, but I would go with this behavior of asking as the default. If I have both around, it is not clear which one is up-to-date, and as a creature of habit one tends to run make test.

But maybe we could provide flags -b for bytecode and -n for native code?

@jerhard
Copy link
Member Author

jerhard commented May 7, 2021

Since it's not mentioned anywhere, I'm guessing earlybird doesn't require a particular OCaml version anymore? Or if it does, then it should be mentioned here.

The latest version of earlybird does work with OCaml 4.11 and 4.12. As OCaml 4.11.1 is the default switch for the Goblint setup right now, it should not be necessary to specify the OCaml version here.

@sim642
Copy link
Member

sim642 commented May 7, 2021

I added some ./docs on master now, which are also browsable via Read the Docs. You can merge in master and move your stuff at the end of ./docs/developer-guide/debugging.md (while adjusting heading levels appropriately). Or I can take care of this myself after this gets merged.

@jerhard
Copy link
Member Author

jerhard commented May 7, 2021

You can merge in master and move your stuff at the end of ./docs/developer-guide/debugging.md (while adjusting heading levels appropriately).

Done.

@jerhard jerhard merged commit 6477d27 into master May 7, 2021
@jerhard jerhard deleted the docs_debug branch May 7, 2021 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation, comments usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add description on how to debug Goblint with VS Code
3 participants