-
Notifications
You must be signed in to change notification settings - Fork 46
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
BIR needs to include debug info about variables #935
Comments
Note that scope for narrowed variables will be relevant to #883. |
JVM use localvariable table to store the debug information related to variables. Local variable tables require start label (starting of visibility), end label (termination of visibility), variable name, type etc. Bir contains bir scope and end basic block for each variable. Bir scope will be created for each variable definition. Bir scope will have an incremental integer id and the reference to parent. Bir scopes are generated hierarchically and scope of the variable has been enclosed by parent scope. End bb will be determined by which extent variable is alive. So the start label will be generated based on bir scope id and the end label on end bb.ATM bir does not use any positions when it comes to variable debug information. |
@warunalakshitha A couple of questions
|
Yes. Every local variables have separate BIR Scope. parameters are also added to local variable table. But we are not adding BIR Scope or either startBB, endBB for parameters. Since parameters should have the visibility scopes from the beginning to end of a function, we are using methodStartLabel and methodEndLabel to add parameters to the variable table.
There is no association between BIR scope and basic blocks. Initially we use only start block and end block. But we got a debugger issue since different variable definitions will have same start block but their visibility ranges are different. So BIR scope is introduced. Still we use end basic block to mark the termination point of variable visibility. |
LLVM tutorial https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl09.html |
@jclark for LLVM we will have to use 2 intrinsics 1. For our purposes I think we can use either one llvm documentation says
2.
So the minimum information we need are
|
This Rust issue claims that only using |
I wonder why that issue doesn't mention llvm.dbg.addr. We discussed using a mix of llvm.dbg.addr and llvm.dbg.value, right? |
Yes. There is a small issue with that approach. It seems llvm c api only support |
As far an nBallerina is concerned this is resolved with #1006. Will reopen if any changes are needed for jBallerina in the future |
For registers corresponding to source variables and parameters, we will need to generate debug info which will require additional information in the BIR such as variable scope and probably location of definition.
We need to figure out what is necessary for JVM and DWARF.
The text was updated successfully, but these errors were encountered: