Skip to content

ArchPcode: Report no program counter for a language that declares none. - #367

Open
zardus wants to merge 1 commit into
masterfrom
feature/fix-angr-state-blank-ip
Open

ArchPcode: Report no program counter for a language that declares none.#367
zardus wants to merge 1 commit into
masterfrom
feature/fix-angr-state-blank-ip

Conversation

@zardus

@zardus zardus commented Aug 11, 2026

Copy link
Copy Markdown
Member

THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS

Dalvik and the DATA sleigh languages declare no program counter and have no register that could serve as one, so ArchPcode pointed ip_offset at 0x80000000, an offset no register occupied. registers["ip"] and register_names[ip_offset] raised KeyError, get_register_by_name("ip") returned None, and translate_register_name returned the decimal offset.

ip_offset is now left unset for those languages. Arch already declares it optional, and of the 187 languages pypcode ships only those 15 change: they lose the invented offset, and no other field of any language moves.

The regression covers both affected families, Dalvik:LE:32:DEX_Nougat and DATA:LE:64:default.

Raised in review of angr/angr#6804, which makes angr tolerate the missing register and carries the end-to-end regression.

Validation: #367 (comment)

@zardus

zardus commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS

Validation record for head 6196611c8426a922581319403f197215f6ca1216 against baseline da171ca0dd8eec1e16dd9c4f04576b2c958e2aea, with angr/angr#6804 at e0cea1f961fe2ccbef3b3afff844be4c6ab323bb against angr baseline 0c293dc0dea6a97efd583b7fe9e56912f0e8e2c1.

  • Regression: python -m pytest tests/test_pcode.py -k program_counterDalvik:LE:32:DEX_Nougat and DATA:LE:64:default report ip_offset None and define neither ip nor pc; x86:LE:64:default still maps both names onto rip
  • Focused (archinfo): python -m pytest tests — 19 passed
  • Focused (angr): python -m pytest -n 3 tests/engines/pcode tests/storage tests/simos tests/state_plugins tests/factory tests/sim tests/test_load_shellcode.py — 384 passed, 4 skipped, 127 subtests passed
  • Lint/type: merge-base pylint and pyright comparison over the changed files — no regressions. arch_pcode.py typecheck badness drops from 0.238 to 0.0; the type-checking import resolves the four pre-existing "pypcode is possibly unbound" errors, which a net line removal would otherwise have turned into a failure
  • Hooks: pre-commit run --all-files — passed, tree unchanged
  • Blast radius: building every one of the 187 languages pypcode 4.0.1.dev0 ships, before and after, leaves exactly 15 differing — 13 Dalvik variants plus DATA:LE:64:default and DATA:BE:64:default — and the only field that moves is ip_offset, 0x80000000 to None. Register lists, sp_offset, bp_offset, ret_offset, lr_offset and initial_sp are identical everywhere
  • Stack pointer: the sibling sp_offset fallback is left alone. No language pypcode ships reaches it, so it is unused rather than wrong
  • Downstream: with Tolerate an architecture that has no program counter. angr#6804, blank_state, entry_state and CFGFast all work on Dalvik:LE:32:DEX_Nougat; state.addr and state.regs.ip raise, which is the truthful answer for an architecture with no program counter
  • Test inputs: check-test-inputs.py — clean

Caveats: the complete local workspace gate was not rerun on this head — a corpus sweep holds the machine — so the local evidence is the focused runs above plus the 187-architecture comparison.

@angr-bot

Copy link
Copy Markdown
Member

Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/archinfo_367

Dalvik and the DATA languages carry no programcounter tag and no register that
could serve as one, so ArchPcode pointed ip_offset at 0x80000000, an offset no
register occupied. Everything that maps that offset or the name back to a
register failed: registers["ip"] and register_names[ip_offset] raised KeyError,
get_register_by_name("ip") returned None, and translate_register_name returned
the decimal offset.

Leave ip_offset unset instead. Arch already declares it optional, and angr
already guards sp_offset the same way. Of the 187 sleigh languages pypcode
4.0.1.dev0 ships, the 15 that declare no program counter lose the invented
offset and nothing else moves; the other 172 are identical field for field.

The type-checking import of pypcode resolves the four "possibly unbound"
diagnostics the module carried, which the CI typecheck scores against the file.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@zardus
zardus force-pushed the feature/fix-angr-state-blank-ip branch from a5f11be to 6196611 Compare August 13, 2026 11:25
@zardus zardus changed the title ArchPcode: Name the program counter of a language that declares none. ArchPcode: Report no program counter for a language that declares none. Aug 13, 2026
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

Successfully merging this pull request may close these issues.

2 participants