capstone
capstone copied to clipboard
SuperH missing setting detail->sh on disassemble
Work environment
| Questions | Answers |
|---|---|
| OS/arch/bits | Ubuntu x86 64 |
| Architecture | sh |
| Source of Capstone | git clone |
| Version/git commit | (v5.0.1, 1bd2a32f2afc6e08225d7491b82619cf4c8e87d9), (next, 4f964a264ec25eb9d468a5495fbd6142778c3a47) |
Instruction bytes giving faulty results
All instructions with operands have wrong detailed output as detail->sh never gets set.
0x32,0x11,0x92,0x00
Expected results
It should include operands information.
Steps to get the wrong result
With cstool:
cstool/cstool -d sh2a '32119200'
0 32 11 92 00 movu.w @(1024,r1),r2
ID: 100 (movu)
reading from reg: r1
writing to reg: r2
groups_count: 0
Expected output should be:
cstool/cstool -d sh2a '32119200'
0 32 11 92 00 movu.w @(1024,r1),r2
ID: 100 (movu)
reading from reg: r1
writing to reg: r2
groups_count: 0
op_count: 2
operands[0].type: MEM
operands[0].mem.reg: REG = r1
operands[0].mem.disp: 0x400
address mode: Register Indirect with Predecrement
operands[1].type: REG = r2
This bug exists on both v5 and next branches. Will this issue be resolved after the modern testing #2384? This bug makes me feel the SuperH arch is almost not tested at all.
Will this issue be resolved after the modern testing https://github.com/capstone-engine/capstone/pull/2384?
No. I will only copy the existing detail "tests" one to one to the new yaml test files.
This bug makes me feel the SuperH arch is almost not tested at all.
It wasn't really before. The "test" is in tests/test_sh.c. It simply prints the disassembled stuff to stdout. The only thing it ensures are no segfaults on these code paths.
You just discover the reason the testing modernization is so desperately needed.
If you want to fix it in a PR, please add a test in issues.cs or issue.cs files. I will move them to the yaml tests.
I can send a PR but need some more time as I found capstone/suite/cstest/src sadly doesn't have sh_detail.c at all :(
Don't add anything in the old cstest please. Better wait until https://github.com/capstone-engine/capstone/pull/2384 s done. I work every day on it and want to finish it soon. You can support me on https://github.com/capstone-engine/capstone/pull/2384 if you want to. But it is more efficient maybe, if you wait for https://github.com/capstone-engine/capstone/pull/2384 and write tests for it after it is merged.
Thanks. I can wait until #2384 is done