zilch-lang/nstar

Debugging information and code generation

Opened this issue · 0 comments

As a compiler backend, it is necessary to support source-level debugging, meaning that the compiler will emit various information when compiling from the source language to N⋆.
However, there is currently no way to take these into account.

There are a few ways we could handle this:

  1. allow a specific construct in N⋆ that would take, for example, DWARF debugging information and emit them back inside the generated object
  2. take the DWARF information separately, with a way to map each to a specific instruction (in order to know where to link the DWARF instruction to
  3. probably another way?

We may also want to emit debugging information for N⋆ itself1 (again, for example, in the form of DWARF structutres). ]However, we need to know if it is possible to have multiple DWARF information for a single line (to, e.g., link a Zilch line and a N⋆ line to a group of instructions).

Footnotes

  1. In most assembly languages, instruction are mapped 1:1 to machine code, so this isn't needed at all. In N⋆'s case, some instructions are compiled down to 4, or even 5 low-level instructions (take a look at the unsigned multiplication on X64).