Skip to content

Show Cd data in binary for ahi b, as for instructions ##disasm - #27400

Open
Thanatos9404 wants to merge 1 commit into
radareorg:masterfrom
Thanatos9404:cd-immbase-ids
Open

Thanatos9404 wants to merge 1 commit into
radareorg:masterfrom
Thanatos9404:cd-immbase-ids

Conversation

@Thanatos9404

Copy link
Copy Markdown
Contributor
  • Mark this if you consider it ready to merge
  • I've added tests (optional)
  • I wrote some lines in the book (optional)

Description

The follow-ups from #27348.

ahi b sets base 2, which instructions show in binary, but Cd data took only 1 as binary (from when ahi b set 1), so ahi b on a data item printed hex. Data now takes 2 as binary, in pd and in pdj's opcode and disasm, with the same .hex fallback rules as before.

Compatibility choice: 1, which ahi s sets now, stays binary for data, so ahi 1 keeps printing what it printed before. The string form instructions use for ahi s ('CBA') has no data equivalent today, and changing ahi 1 would break existing projects. The new test pins ahi 1 and ahi s to binary, so changing it later is an explicit decision.

Also reuses buf for the value-order bytes, dropping msb and the case scope. A side effect worth knowing: e asm.imm.base=2 now shows Cd data in binary too, as it does for instruction immediates.

Testing

  • New test in test/db/cmd/metadata: ahi b, its pdj opcode, ahi 2, ahi 1 and ahi s on a dword. It fails on master.
  • db/cmd/metadata (232), db/cmd/cmd_pdj, db/cmd/cmd_ahi and db/cmd/cmd_pd pass. sys/lint.py --all only reports the existing for (int in libr/bin/p/bin_dyldcache.c:1299.

ahi b sets base 2, which is binary for instructions, but Cd data took
only 1 as binary, from when ahi b set 1, so it showed ahi b as hex.
Data now takes 2 as binary too. 1, which ahi s sets now, stays binary
for data. Reuse buf for the value-order bytes instead of a second
buffer.
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