Standardizing source maps
75 points by Timothee 17 hours ago | 11 comments

saagarjha 13 hours ago
I wonder if the source map people could learn a thing or two from the debuginfo maintainers and vice versa.
reply
lylejantzi3rd 11 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...

reply
VorpalWay 9 hours 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.

reply
tliltocatl 9 minutes ago
> One of them is even Turing complete.

> figuring out where in memory or registers a given high level variable

Isn't the task itself Turing-hard? Or at least complex enough so that coming up with a non-Turing-complete solution would be impractical?

reply
cadamsdotcom 15 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 :)

reply
sureglymop 13 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.
reply
conorh 6 hours ago
Great article, never realized just how adhoc the source map 'standard' was!
reply
skybrian 5 hours ago
There was a well-specified design doc and Chrome implemented it. It worked. Sometimes that's all you need to get a defacto standard.

This new standards process is making some useful improvements, though.

reply
indolering 6 hours ago
Glad to see this finally getting some much needed love and attention!
reply
fay_ 14 hours ago
[dead]
reply
priowise 13 hours ago
[flagged]
reply
stmw 7 hours ago
They told us that the great benefit of scripting languages was that it was just text, no wait for any compilers or linkers, that it was so much easier to debug and so portable.

They promised us we would be forever happy once we abandoned our antiquated love for compiled and strongly typed languages.

They lied.

reply
fluffybucktsnek 45 minutes ago
"They" who? Never seem anyone argue that, specially with this level of bad faith.

Maybe you should avoid strawmans. Just sayin'.

reply