[M3commit] [modula3/cm3] 45fd7b: Fix debug info generation to accept ground ordinal...

GitHub noreply at github.com
Tue Mar 1 04:00:47 CET 2016

  Branch: refs/heads/master
  Home:   https://github.com/modula3/cm3
  Commit: 45fd7b04eaaabb80ae10b721c8da572fe9ca1a74
  Author: Rodney Bates <rodney.m.bates at acm.org>
  Date:   2016-02-29 (Mon, 29 Feb 2016)

  Changed paths:
    M m3-sys/llvm3.6.1/src/M3CG_LLVM.m3

  Log Message:
  Fix debug info generation to accept ground ordinal types.

m3llvm was crashing when generating debug info, by expecting
only a subrange type, whereas any ordinal type is possible.
This limitation was already noted in comments.

Specifically, this happened for the index type of an array
and the base type of a subrange or set type.

This entailed in part, rework of initialization of the builtin
ordinal types, representing them in m3llvm as SubrangeDebug
nodes, rather than BasicDebug nodes, which have no fields to
hold value bounds.

Sadly, llvm, at least 3.6.1, does not handle the Dwarf DW_AT_type
attribute of a Dwarf subrange type, which a Modula-3 debugger
will need.  I suppose this is because C++ subranges have only
one base type.  We have many.  But at least it is stored in
the m3llvm SubtypeDebug node, where it can be found easily
if/when llvm provides a way to pipe it through to the object

Enumeration types as well as builtin ordinal types had to be
accomodated too.

This change also keeps bounds information in TInt form as
late as possible, right up until llvm debug nodes are created.
At that point, we need something like a TInt.ToLongint, to be
sure to get the full range when cross compiling on a 32-bit
machine for a 64-bit machine.

More information about the M3commit mailing list