Skip to content

fix(dalvik): recover try-catch exception edges and mark Makefile targets as phony#44

Merged
r0ny123 merged 3 commits into
masterfrom
codex/fix-clawpatch-findings
May 26, 2026
Merged

fix(dalvik): recover try-catch exception edges and mark Makefile targets as phony#44
r0ny123 merged 3 commits into
masterfrom
codex/fix-clawpatch-findings

Conversation

@r0ny123

@r0ny123 r0ny123 commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced exception handling detection for division, modulo, and field access instructions to improve control flow analysis accuracy.
  • Tests

    • Added comprehensive test coverage for exception-throwing opcode metadata validation and exception edge detection in disassembly analysis.
  • Chores

    • Updated build system configuration to properly declare all available build targets.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR enhances Dalvik opcode metadata to mark field-access and integer division operations as capable of throwing exceptions. A post-registration helper updates opcode specs, and two new unit tests verify the metadata reaches the disassembler's exception edge analysis. The Makefile is updated to declare additional build targets as phony.

Changes

Throwable Opcode Metadata and Exception Edge Analysis

Layer / File(s) Summary
Opcode metadata helper infrastructure
src/smda/dalvik/DalvikOpcodeDecoder.py
dataclasses.replace is imported, and a private _mark_can_throw(*mnemonics) helper is added to find opcode specs by mnemonic in the OPCODES registry, update them to can_throw=True, and raise ValueError if any mnemonic is unknown.
Mark field-access and division opcodes as throwable
src/smda/dalvik/DalvikOpcodeDecoder.py
Field-access opcode registration for sget/* and sput/* is updated to set can_throw=True. A post-registration call to _mark_can_throw marks division and modulo opcodes (div/rem for int and long, including /2addr and literal forms) as throwable.
Test throwable opcode metadata
tests/testDalvikDisassembler.py
Imports are refactored to multi-line to include OPCODES. Two tests are added: one verifies decoded instructions and DalvikDisassembler._instructionCanThrow return True for throwable opcodes and False for non-throwing ones; another constructs synthetic code items with field and divide opcodes, runs analysis, and asserts exception handler edges are created in code_refs_from.
Build system configuration
Makefile
The .PHONY target declaration is expanded to include init, package, publish, and development targets (ruff-check, ruff-format, ruff-fix, lint, format, test, test-coverage, clean).

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the two main changes: fixing Dalvik exception edge recovery and marking Makefile targets as phony, matching the commit messages and code alterations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@r0ny123

r0ny123 commented May 25, 2026

Copy link
Copy Markdown
Owner Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces changes to identify throwable Dalvik opcodes, marking static field access and integer division/remainder operations as throwable, and adds corresponding unit tests to verify exception edge generation. A review comment suggests improving the robustness of the _mark_can_throw helper function to correctly handle potential duplicate mnemonics and optimize dictionary iteration.

Comment thread src/smda/dalvik/DalvikOpcodeDecoder.py
@r0ny123 r0ny123 changed the title Codex/fix clawpatch findings fix(dalvik): recover try-catch exception edges and mark Makefile targets as phony May 25, 2026
@r0ny123 r0ny123 merged commit 6208ee7 into master May 26, 2026
45 of 46 checks passed
@r0ny123 r0ny123 deleted the codex/fix-clawpatch-findings branch May 26, 2026 14:10
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.

1 participant