Standardizing source maps

Posted by Timothee 9 hours ago

Counter56Comment5OpenOriginal

Comments

Comment by saagarjha 4 hours ago

I wonder if the source map people could learn a thing or two from the debuginfo maintainers and vice versa.

Comment by lylejantzi3rd 2 hours ago

Probably. The RADDBG folks recently created their own debug format (RDI) to replace PDB and DWARF. Could be worth a gander.

https://github.com/EpicGamesExt/raddebugger?tab=readme-ov-fi...

Comment by VorpalWay 54 minutes ago

While I have never worked with PDB, I have worked directly with DWARF. It is an insane format. It embeds (at least) three different byte code formats that need to be interpreted. One of them is even Turing complete.

First up is mapping from address to file, line and column. This one is basically a custom data compression scheme in the form a custom byte code. Strange but not too bad.

Second is “DWARF expressions", which is Turing complete and used for many things, such as figuring out where in memory or registers a given high level variable can br found at at any point of the program execution. It is baroque to say the least.

Then there is EH frames, which is used for unwinding (on exceptions in C++ or panics in Rust for example). This is used to specify how to find the base of the current stack frame given the current instruction pointer. This is needed if you don't use frame pointers. In itself it isn't Turing complete, but it can call out to Dwarf Expressions as subroutines, so it actually is TC. Except from what I have read, no compiler actually makes use of that capability, thankfully.

Surprisingly, the DWARF specification itself is actually reasonably readable and well written.

Comment by cadamsdotcom 7 hours ago

Very cool to see so much work going on to make the web platform even more awesome - and in the open!

Stuff like this makes me believe open wins over closed in the end :)

Comment by sureglymop 5 hours ago

This is a great endeavour. Recently I have been thinking about how to add syntax and metaprogramming extensions to programming languages without forking the compiler/interpreter. Source maps are needed there in order to have good editor support through e.g. an LSP server proxy. In researching it I was a bit let down I couldn't find too much research and specifications for the topic.

Comment by fay_ 6 hours ago

[dead]

Comment by priowise 5 hours ago

[flagged]