Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Emit debug info #152

Open
jyn514 opened this issue Dec 13, 2019 · 3 comments
Open

Emit debug info #152

jyn514 opened this issue Dec 13, 2019 · 3 comments
Labels
codegen Involves generating Cranelift IR enhancement New feature or request hard Extra attention is needed

Comments

@jyn514
Copy link
Owner

jyn514 commented Dec 13, 2019

Related to #16, but at the object file level instead of assembly level: We should emit debug info for the binary we emit.

I think https://docs.rs/cranelift-frontend/0.51.0/cranelift_frontend/struct.FunctionBuilder.html?search=#method.set_srcloc is the API we want?

@jyn514 jyn514 mentioned this issue Dec 13, 2019
16 tasks
@jyn514
Copy link
Owner Author

jyn514 commented Dec 15, 2019

This looks helpful: bjorn3/rustc_codegen_cranelift@5873127

@jyn514 jyn514 added codegen Involves generating Cranelift IR enhancement New feature or request hard Extra attention is needed labels Dec 15, 2019
@philipc
Copy link

philipc commented Dec 18, 2019

Currently cranelift only provides minimal debuginfo support:

But for both of these, it is up to the user to then generate the debuginfo. For examples of doing that, rustc_codegen_cranelift can generate .debug_line information from the srcloc as you have seen (as well as incomplete .debug_info support), and bytecodealliance/cranelift#902 can generate .eh_frame information from the frame layout. Both of these use https://github.com/gimli-rs/gimli to do the writing.

Eventually there will probably be something that makes this all easier for users, but for now it's a bit experimental.

@jyn514
Copy link
Owner Author

jyn514 commented Dec 18, 2019

@philipc thanks for the tips! For now, this is fairly low on the todo-list, so I'm fine with waiting a little to see if a better API pops up. If not, I may get to it in a month or so.

Currently, the debug info is mostly so I can debug my own bad codegen, since no one is using my compiler for their own projects yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
codegen Involves generating Cranelift IR enhancement New feature or request hard Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants