Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only generate dwarf entries if the line & column looks legitimate #632

Merged

Conversation

poechsel
Copy link
Contributor

Compilation was failing for catala and beluga:

>> Fatal error: Uint64.of_nonnegative_int_exn: -1 is out of range
Fatal error: exception Misc.Fatal_error
Raised at Misc.fatal_errorf.(fun) in file "ocaml/utils/misc.ml", line 22, characters 14-31
Called from Dwarf_high__Dwarf_attribute_helpers.create_decl_column in file "backend/debug/dwarf/dwarf_high/dwarf_attribute_helpers.ml" (inlined), line 127, characters 15-51
Called from Dwarf_ocaml__Dwarf_concrete_instances.for_fundecl in file "backend/debug/dwarf/dwarf_ocaml/dwarf_concrete_instances.ml", line 58, characters 10-42
Called from Dwarf_ocaml__Dwarf.dwarf_for_fundecl in file "backend/debug/dwarf/dwarf_ocaml/dwarf.ml" (inlined), line 48, characters 2-85
Called from Asmgen.emit_fundecl.(fun) in file "backend/asmgen.ml", line 149, characters 10-47

It's likely that these packages are relying on a ppx that emits a location for which Locatin.is_none returns false but whose column is negative.

@poechsel poechsel requested a review from mshinwell as a code owner April 28, 2022 11:03
@lthls
Copy link
Contributor

lthls commented Apr 28, 2022

For context, there are a few other packages affected and the common factor seems to be a dependency on ppx_sedlex.

@mshinwell
Copy link
Collaborator

I'm not sure this is the right fix -- I was thinking we could just not emit the line and column attributes if the line number is nonsensical; and not emit the column number (but still emit the line number, unless it is nonsensical) if the column number is nonsensical.

@poechsel
Copy link
Contributor Author

I'm not sure this is the right fix -- I was thinking we could just not emit the line and column attributes if the line number is nonsensical; and not emit the column number (but still emit the line number, unless it is nonsensical) if the column number is nonsensical.

Why not going through the same code path a if Location.is_none is true? (that is set the line and column to 0)

@mshinwell
Copy link
Collaborator

Hmm, that is a good question. I'm not sure we should set the numbers to zero, it's probably best to leave the attributes out, to show that we genuinely don't know the location.

@mshinwell mshinwell added bug Something isn't working dwarf and debugging labels Apr 29, 2022
@mshinwell mshinwell merged commit 0a7f713 into ocaml-flambda:main Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dwarf and debugging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants