#How to access tuple members in lldb?
1 messages · Page 1 of 1 (latest)
chatGPT suggested p tup["4"] which also fails 😉
then I clarified that it was a Zig Tuple and it suggested p tup._4 which also failed....
what about tup.0?
As background, in case you didn't know yet, tuples are structs with field names that are implicitly numbered 0... so in Zig you can access them with tup.@"0", tup.@"1" (although now you can use tup[0] as well.
But I haven't found a way in lldb to print struct fields with names that aren't valid identifiers yet...
Haha same
It does let you do p tup though, works fine
You can do some nonsense to manually find the offsets of each field like p *(int*)(&(tup) + 2), but that's not particularly convenient. Also, in what I just tested, the fields were reordered anyway, making it even less convenient
what about fr v tup."4"