4 ms·
Durin is a library for reading and writing the Dwarf debugging format
- iou 1y agoI sure hope there’s an anti-debug framework called Durin’s Bane?
- ModernMech 1y agoI hope if you use it in late Ocotober when the moon is out, it opens the CD tray... for those who still have one.
- shawn_w 1y agoBad idea to delve too deep into the binary.
- vlovich123 1y agoHow does this compare with gimli-rs? Last I checked it was the absolute leader in performance. https://github.com/gimli-rs/gimli https://github.com/gimli-rs/gimli
- lambda_foo 1y agoAuthor here, a bit cringe to see your WIP project posted here. My motivation for writing this from scratch is to simultaneously understand DWARF 5 in all its gory details, develop tooling to support my work on the OCaml compiler, and to build a source debugger in OCaml. The performance or lack of isn't a focus right now, I'm sure it doesn't compare to gimli-rs for performance but it does fully support DWARF 5 which gimli-rs doesn't (missing debug_info section support https://github.com/gimli-rs/gimli/pull/807 https://github.com/gimli-rs/gimli/pull/807). Currently I'm working on the read support, and various bits of tooling around understanding Call Frame Information and simulating the DWARF expression evaluation. I'm unhappy with the tooling GDB/LLDB provide for displaying and debugging this information, I've personally spent far too much time staring at CFI expressions and walking memory looking for where it goes wrong. In the OCaml compiler we have few people that understand or work on this area.
- erichdongubler 1y ago> Author here, a bit cringe to see your WIP project posted here. I'm confused; are you referring to GP's link to `gimli`, or your own repo in the OP?
- lambda_foo 1y agoMy own repo in the OP :-)
- deleted 1y ago[deleted]
- wavemode 1y agoSeveral of the examples seem to be empty (e.g. https://github.com/tmcgilchrist/durin/blob/master/example/dwarf_validate.ml https://github.com/tmcgilchrist/durin/blob/master/example/dw...) Also, the link to OPAM documentation leads to a 404
- lambda_foo 1y agoIt is heavily WIP at the moment so I haven't published to opam just yet. You'll need to compile from source if you want to try it out. I'm filling in examples as I need them and publishing code when it isn't too terrible to look at.
- wavemode 1y agoAh, no worries. I'm just now realizing that you weren't even the one who submitted this to HN.
- zidel 1y agoOne interesting thing about the dwarf format is that it is executable and Turing complete, running small programs on a virtual machine to figure out file names, line numbers and exception handling.
- lambda_foo 1y agoIt's really fascinating the different little evaluators that exist in DWARF. I started writing one for the DWARF expression format (https://github.com/tmcgilchrist/durin/pull/7 https://github.com/tmcgilchrist/durin/pull/7) that I'm integrating with a debugger and free-monad/effect handler style code to lookup the missing data to provide for the Requires* callbacks. Then there is the line number evaluation, which I haven't started on. Building a Debugger by Sy Brand (https://nostarch.com/building-a-debugger https://nostarch.com/building-a-debugger) is an awesome book if you want to learn more about this. It covers DWARF 4 and you build a full debugger in C++17 for Linux/x86_64. Can't recommend that book highly enough!
- zidel 1y agoAnd for the misuse angle there is this talk from Shmoocon 2011: https://www.youtube.com/watch?v=nLH7ytOTYto https://www.youtube.com/watch?v=nLH7ytOTYto
- woodruffw 1y agoDWARF is such a neat little format. I have a soft spot for the "line program" table, which is a little state machine that allows DWARF to efficiently encode a line/column correspondence for virtual addresses.
- WalterBright 1y agoBest of luck to you! I spent many hours trying to understand and generate proper Dwarf tables.
- yawaramin 1y agoAre ELF and DWARF names chosen deliberately or was it a coincidence? Lol