Skip to content

Conversation

@cmb69
Copy link
Member

@cmb69 cmb69 commented May 7, 2020

We must not attempt to access arbitrary union members when retrieving
debug info, because that may not be valid. We report unions as empty
instead.

We must not attempt to access arbitrary union members when retrieving
debug info, because that may not be valid.  We report unions as empty
instead.
@laruence
Copy link
Member

laruence commented May 7, 2020

actually, while using FFI, you have thousands ways to shoot your feet, user should avoid such things by themself.

back to this fix, maybe we should give a warning about “you should specify which item in union you want dumping?”

@nikic
Copy link
Member

nikic commented May 7, 2020

back to this fix, maybe we should give a warning about “you should specify which item in union you want dumping?”

The union can be part of a larger structure, in which case there is no way to specify the active member.

I think this fix is okay. An alternative would be to dump all members without dereferencing them (that is, for pointers only print the pointer address). This would be similar to what gdb does...

@dstogov
Copy link
Member

dstogov commented May 7, 2020

The last Nikita's idea looks better, but this solution is also OK.

@laruence
Copy link
Member

laruence commented May 7, 2020

“dump all members without dereferencing them” is better to me too. thanks

@cmb69
Copy link
Member Author

cmb69 commented May 7, 2020

Okay, I'll have a look at that. Thanks!

@cmb69 cmb69 marked this pull request as draft May 7, 2020 14:46
@PeratX
Copy link

PeratX commented May 8, 2020

Thanks for your replies!!!
By the way, in JNA, unions can be specified with a type.

@cmb69
Copy link
Member Author

cmb69 commented May 11, 2020

Closing in favor of PR #5544.

@cmb69 cmb69 closed this May 11, 2020
@cmb69 cmb69 deleted the cmb/79571 branch May 11, 2020 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants