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

bitfield members are missing in ._sizes #17

Open
lwerdna opened this issue Mar 30, 2021 · 0 comments
Open

bitfield members are missing in ._sizes #17

lwerdna opened this issue Mar 30, 2021 · 0 comments

Comments

@lwerdna
Copy link

lwerdna commented Mar 30, 2021

Here is a simple struct with bitfields:

struct relocation_info {
    uint32 r_address;
    uint32 r_symbolname:24;
    uint32 r_pcrel:1;
    uint32 r_length:2;
    uint32 r_extern:1;
    uint32 r_type:4;
}

After parsing (result = cparser.relocation_info(data)), only r_address appears in ._sizes. The other fields (r_symbolname, r_pcrel, r_length, r_extern, r_type) are missing:

>>> result._sizes
{'r_address': 4}

This makes it impossible to use dumpstruct() which I assume loops through the OrderedDict ._values and attempts to look each one up in ._sizes:

>>> dumpstruct(result)
Traceback (most recent call last):
...
/cstruct/types/instance.py", line 47, in _size
    return self._sizes[field]
KeyError: 'r_symbolname'
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

1 participant