Conversation
@gba-kit/debug-info: add support for DWARF .debug_info
@gba-kit/debug-info: add support for DWARF .debug_info@gba-kit/debug-info: add support for DWARF .debug_info
macabeus
marked this pull request as ready for review
June 29, 2026 00:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds DWARF type information to
@gba-kit/debug-infoand surfaces it in the scripting engine, so scripts and tests can read struct fields by name instead of hand-maintained addresses, offsets, and masks.@gba-kit/debug-infostruct(name)— struct/union layout: members with byte offsets and sizes (descends anonymous unions/structs).structMember(name, path)/variableMember(symbol, path)— resolve a dotted/array field path to its{ offset, size, bitOffset?, bitWidth? }, rooted at a type name or at a global (whose type is read from its own DWARF DIE).resolveVariable("symbol.field")— one call to aResolvedLocation(address from.symtab, layout from DWARF).enumValues(name),hasTypeInfo; exportsTypeIndex,ResolvedLocation,MemberLocation.bitOffset/bitWidth; members whose size can't be determined (incomplete type, flexible array) reportsize: null.symbolToAddressnow also resolves absolute (SHN_ABS)STT_NOTYPEldscript globals (gFoo = 0x...;), while excluding section-relative markers (_end,__bss_start).Scripting (
@gba-kit/gba-emulator,@gba-kit/gba-node)readVariable(path)— read a global orsymbol.fieldby name, sized and bitfield-decoded from the DWARF (the read counterpart towatchSymbol).wait({ memory })andassert({ memory }) —addressnow also accepts asymbol/symbol.fieldpath (read at the field's full width), in addition to a raw numeric address.Tests
Real ELF fixtures from both toolchains (agbcc DWARF-2, devkitARM DWARF-5) assert struct/enum/bitfield layouts, nested + anonymous-union member paths, multi-CU resolution, flexible arrays, and ldscript-symbol in/exclusion.