Skip to content

Missing DWARF debug information #15360

@Blacksmoke16

Description

@Blacksmoke16

Bug Report

https://github.com/SimonKagstrom/kcov uses DWARF debug information to power its code coverage reporting. While viewing the reports more closely I notice that it reports certain things as missed even tho they were most definitely hits. For example with the following code:

# test.cr
class Foo
  getter callback : Proc(Int32, Int32)? = nil

  def callback(&@callback : Int32 -> Int32) : Nil
  end
end

foo = Foo.new

foo.callback do |val|
  val * 10
end

pp foo.callback.not_nil!.call 10

Generate the report:

$ crystal build --debug test.cr
$ kcov --include-path=./test.cr ./coverage ./test
100
$ xdg-open coverage/index.html

Results in:

Image

The block body and the calling of the proc are reported as missed, even tho you can clearly see 100 in the console output. Using getter! instead of an explicit not_nil! makes it correctly report that line as a hit.

I think this implies those specific lines are missing debug information?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugA bug in the code. Does not apply to documentation, specs, etc.topic:compiler:debugger

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions