gimli-rs / gimli

A library for reading and writing the DWARF debugging format
https://docs.rs/gimli/
Apache License 2.0
853 stars 108 forks source link

Support DW_LNCT_LLVM_source #431

Closed mitsuhiko closed 5 months ago

mitsuhiko commented 5 years ago

I'm playing around with various ways at the moment to make it easier to address file contents and DWARF 5 is helping with DW_LCNT_MD5 here already. It lets you address a source file by MD5 hash which is pretty helpful but it still requires a separate system to actually resolve the sources.

I came across an LLVM extension recently (DW_LNCT_LLVM_source) which LLVM added to support debugging of generated GPU programs. I feel like this would be also solving my issue quite well. However I'm not sure how gimli thinks about LLVM extensions.

The reason I'm asking is because I wanted to use gimli's write interface for this but currently the logic that emits these DW_LNCT_ attributes is internal to the structs so it requires a patch to gimli to emit new ones at the moment.

philipc commented 5 years ago

If it's useful then we should support it. The only problem I could see is if two producers reuse the same extension values for different purposes. I'm not sure how the consumer is meant to distinguish that case, maybe it needs to be a configuration setting. No need to worry about that until it is needed though.

mitsuhiko commented 5 years ago

Cool. I'm going to experiment with it and send a PR if this goes somewhere.