-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add debug info for inlined calls #11177
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
Conversation
In DWARF, there is a flag Should we make the AIR instruction |
Got this to work. Not sure what that syntax error is about? Also should symbols from the parent function be visible in the inlined function and vice-versa? Currently they aren't but it should be easy to change by removing the lexical scopes.
|
I think making symbols from the parent visible would be confusing. Also there might be symbol conflicts right? In your example code it would be perfectly valid to rename |
One data point would be looking at what stage1 does (e.g. what LLVM does) for an inlined function from another file with different things in scope. We can recreate this scenario: test1.zig const test2_foo = @import("test2.zig").foo;
pub fn main() void {
var x: i32 = 42;
test2_foo();
} test2.zig pub inline fn foo() void {
var x: i32 = 1234;
x += 1;
} I'm not sure I have an opinion on this one (yet?). Happy to go with whatever feels best to you @Vexu. |
It seems stage1 and 2 behave the same on this, I think I just got confused by the different behavior when the variable is not in scope:
Seems like we should also add pub fn main() void {
var a: u32 = 0;
{
var b: u32 = a;
if (b != 0) unreachable;
}
if (a != 0) unreachable;
}
|
Add
dbg_inline_{begin,end}
emitted around an inlined call so that inlineddbg_line
instructions will emit debug info pointing to the correct source function.I'm not sure if this works currently... I managed to break my system to a point where I can't build master branch stage2 with a clean cache without an assertion failure.
Closes #11158
Closes #11160