Cannot parse DWARF sections properly

Hi, and welcome to the Crystal forums!

It seems this is a bug. It would be best to report it here: https://github.com/crystal-lang/crystal/issues

It seems the problem is this line:

opcode_base has a type of UInt8, and if that happens to be 0 then 0_u8 - 1 will underflow. Putting that 1.upto inside if sequence.opcode_base > 0 would make it work.

To see if this indeed fixes you problem, you can add these line to the top of your program:

module Debug
  module DWARF
    struct LineNumbers
      private def read_opcodes(sequence)
        return unless sequence.opcode_base > 0

        1.upto(sequence.opcode_base - 1) do
          sequence.standard_opcode_lengths << @io.read_byte.not_nil!
        end
      end
    end
  end
end

Let me know!