-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
runtime/HACKING.adoc: tips on debugging the runtime #11058
Conversation
12bca36
to
4bb52fd
Compare
You can view the rendered output at https://github.com/gasche/ocaml/blob/runtime-HACKING.adoc/runtime/HACKING.adoc Current table of contents:
|
I'm not sure how it would fit in your PR (nice work, by the way), but when I just need a backtrace I re-run the program with |
I used to do this until this night, but in fact on my machine Note: I am not planning to fill the sections marked TODO in the context of this specific PR, because I don't have the knowledge to do so myseelf. I think it's fine to leave TODO around here. |
This is very nice! |
The classic Unix way to inspect a core dump is
Substitute You can print a backtrace ( I don't see the point of the systemd stuff, except perhaps for post-mortem debugging of services that run in the background and are launched directly by systemd. |
I'm not sure either, but this is what my (recent Fedora) system does by default, so I had to learn about it anyway. In particular, you can't guess the path of the core file without using this If we want to also offer "classic Unix" instructions in HACKING.adoc (I guess that's a good idea if some commonly-used distribution doesn't use the systemd stuff), I would prefer if someone wrote it, as I cannot test those instructions on my own system. I guess it would also be nice to document the workflow on that proprietary operating system with good hardware. @Engil contributing instructions for (I'm using the AsciiDoc format for consistency with the root HACKING.adoc, because it shows a table of contents by default. For new documentation files, people should feel free to use Markdown if they are more familiar with it.) Then again, I would propose to get this PR merged quickly, and have further additions be done by direct pushes to |
There are two pages in the Multicore OCaml wiki which is relevant to debugging:
The "run until failure" hacks in the first link have been useful to debug hard to non-deterministic crashes in the runtime. In particular, once we've managed to capture a failing trace in |
Would anyone be willing to approve this? I don't have the time right now to integrate some of the nice suggestions that have been made so far, and I think (unless someone of course objects to the current content) it could still be useful to have this in the hands of contributors. |
structures, etc. Mostly implemented in C, with some rare bits of | ||
assembly code in architecture-specific files. The "includes" | ||
corresponding to the `.c` files are in the link:runtime/caml[] | ||
subdirectory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this paragraph, it would be nice in the future to extend it to include other oddities (like the domain state generation and other generated things in the runtime code).
I am willing to approve this but I'm not sure what to take away from the conversation about the old unix way vs weird modern Linux distribution way of doing things. On the other hand what is currently written seems already pretty sensible and I agree that having the document sit in this PR is not likely to help refining it further. I will take another look and approve it, maybe we should move some of the highlighted points here ( |
Sounds very reasonable. They could also be added as TODOs inside the document directly. (If you like this idea and you volunteer, I'll give you write access to my repo so that you can push a commit doing just that.) |
Any volunteers for an approval? (Every time I remember this PR, I go back to it, realize that I could help by indeed adding more TODOs to the document, and then I switch to something else and I forget about it. I would rather let us collectively forget about it after it is merged somewhere long-term.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks! This is very useful.
4bb52fd
to
a92bdfb
Compare
a92bdfb
to
7982ff9
Compare
Thanks! I rebased, and this should be good to get if/when the CI agrees. |
I realized during the night that I don't know how to print a backtrace after observing a test program crash after an assertion failure. (I'm no C programmer; I was always too lazy to find that out, and would just run
valgrind ./test
to get a trace. But thenvalgrind
is unusably slow on parallel-heavy tests.) I searched for it on the web, and here is a PR to try to save other runtime beginners the same embarrassing search.