-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
debug info missing from Tracy #13315
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
Comments
Downstream issue filed: wolfpld/tracy#482 |
Even worse so, this almost immediately crashes on macOS while some debug info is there. |
This appears to be an issue with stage2 compiler. I've hooked up the same very bindings in https://github.com/kubkon/zld/tree/tracy-integration and tracy crashes with the same segfault as reported here when |
I hit possibly the same crash in tigerbeetle with zig 0.9.1. As a workaround, I found that the alloc api seems to work fine: ___tracy_emit_zone_begin_alloc(___tracy_alloc_srcloc(
src.line,
src.file.ptr,
src.file.len,
src.fn_name.ptr,
src.fn_name.len,
), 1); |
I have been experiencing this issue with all zig projects since switching to stage2. @Techatrix found that if you don't use |
TLDR: tracy assumes the source location is static and it can read it at anytime, but we are passing a pointer to the stack I have done a bit of investigation and found out that the source location must survive (the tracy manual even spells this out in section 3.4 Marking Zones in the important box at the end of the section), so it cannot be on the stack, this is why According to the dissasembly, if you do If you try to force it to be comptime known: const location = comptime ___tracy_source_location_data{
.name = null,
.function = src.fn_name.ptr,
.file = src.file.ptr,
.line = src.line,
.color = 0,
}; An error message stating that
@andrewrk is it intended that |
No it's not intended. This is a regression. |
|
You can even work around this without calling pub inline fn trace(comptime src: std.builtin.SourceLocation) Ctx {
if (!enable) return .{};
const statics = struct {
var call: ___tracy_source_location_data = .{
.name = null,
.function = undefined,
.file = undefined,
.line = undefined,
.color = 0,
};
};
statics.call.function = src.fn_name.ptr;
statics.call.file = src.file.ptr;
statics.call.line = src.line;
if (enable_callstack)
return ___tracy_emit_zone_begin_callstack(&statics.call, callstack_depth, 1)
else
return ___tracy_emit_zone_begin(&statics.call, 1);
} Since the function is inline, a static variable is created for each callsite. Also, if |
Just posting this context from Andrew on Discord:
This treatment should also be given to the column, since incremental compilation could break in the same way there on code not formatted with |
Regressed in 89cef9f. |
When the code is written this way, you get a compile error if the pointer given to Tracy does not have a static lifetime. This would have caught the regression in #13315.
Reverts 89cef9f. Closes ziglang#13315
When the code is written this way, you get a compile error if the pointer given to Tracy does not have a static lifetime. This would have caught the regression in ziglang#13315.
Reverts 89cef9f. Closes ziglang#13315
Zig Version:
0.10.0-dev.4583+875e98a57
To reproduce:
Next run tracy, press the connect button. Finally:
The text was updated successfully, but these errors were encountered: