Skip to content
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

#[br(dbg)] doesn't work when pad_before directive is also used #188

Closed
crjennette opened this issue Mar 15, 2023 · 1 comment
Closed

#[br(dbg)] doesn't work when pad_before directive is also used #188

crjennette opened this issue Mar 15, 2023 · 1 comment

Comments

@crjennette
Copy link

When the debug attribute #[br(dbg)] is used for a field in the same struct as a #[br(pad_before=N)] attribute, the offset printed to output is incorrect.

When the following is used, the offsets printed would be 0x00, 0x04, and 0x08; but they should be 0x00, 0x08, and 0x0c.

#[derive(Debug)]
#[binrw]
struct Header{
    #[br(dbg)]
    field1: u32,
    #[br(dbg)]
    #[br(pad_before=4)]
    field2: u32,
    #[br(dbg)]
    field3: u32
}
@csnover
Copy link
Collaborator

csnover commented Jun 29, 2023

Thanks for your report, and sorry for the delay. This will be fixed in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants