Skip to content

fix(extract_offsets): handle DWARF forward declarations, nested members, and location encodings - #1426

Open
umpireboulianne-design wants to merge 1 commit into
limitlessprojects:mainfrom
umpireboulianne-design:fix/issue-1325
Open

umpireboulianne-design wants to merge 1 commit into
limitlessprojects:mainfrom
umpireboulianne-design:fix/issue-1325

Conversation

@umpireboulianne-design

Copy link
Copy Markdown
Contributor

Fixes #1325

Summary

  • Skip DWARF forward-declaration stubs and reset on null DIEs: Record DW_AT_declaration on DIEs, reset cur = None on Abbrev Number: 0 null DIE headers, and continue scanning in members_of() past forward-declaration or empty stub DW_TAG_structure_type entries so later compilation units with the complete runtime.g / runtime.m definitions are found.
  • Ignore nested struct members: Restrict DW_TAG_member collection inside members_of() to direct children at e["depth"] == base + 1 so inner struct members at deeper nesting levels cannot overwrite outer runtime.g / runtime.m field offsets.
  • Support indirect strings, hex sizes/offsets, DW_OP_plus_uconst locations, and readelf OSError: Strip .debug_str/.debug_line_str indirect/indexed string prefixes in DW_AT_name, parse hexadecimal DW_AT_byte_size and DW_AT_data_member_location values, extract DW_OP_plus_uconst offsets without misparsing N byte block prefixes, and fail closed with exit code 1 when readelf raises OSError.

Testing

  • Added regression tests in tools/test_extract_offsets.py for forward-declaration/empty-stub skipping, nested struct member depth-collision protection, null DIE handling, indirect strings/hex sizes/DW_OP_plus_uconst locations, and readelf OSError handling.

@github-actions github-actions Bot added the bot:stale-base Shepherd: behind main beyond threshold label Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:stale-base Shepherd: behind main beyond threshold

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tools/extract_offsets.py: DWARF forward-declaration stubs, nested struct members, and DW_OP_plus_uconst locations misparse runtime.g/runtime.m offsets

1 participant