retis-org / retis

Tracing packets in the Linux networking stack & friends
https://retis.readthedocs.io/en/stable/
100 stars 14 forks source link

Remove ``#[repr(packed)]` on EventSections? #146

Closed amorenoz closed 1 year ago

amorenoz commented 1 year ago

I tried to make Event implement Debug to easily add debugging information in retis and found out that:

error: `Debug` can't be derived on this `#[repr(packed)]` struct that does not derive `Copy` 

and String does not implement Copy.

That and the fact that in order to avoid misaligned accesses, sometimes EventSection fields have to be copied first (which probably makes writing getters complicated), makes me think we should avoid using EventSections to parse bpf directly (using packed and Plain). Creating an issue to try to do some macro magic to generate the packed version and avoid boilerplate explosion.

amorenoz commented 1 year ago

I think this is fixed after #159 and #133

atenart commented 1 year ago

You're right, let's close this.