Comments (4)
Can you make a pr doing the changes to make both commands return the same structure? I agree on the change but will be easier for you to do it because you know whats different. Ill review it and see if that change affects any plugin or tool later and update the tests
thanks!
from radare2.
This issue is either going to be a hack or a bit of a rewrite. I worked on it a bit yesterday.
The current behavior is that 'pdj' command calls r_core_print_disasm_json
, and the 'pduoj' command calls r_core_print_disasm
. The two functions handle json very differently. r_core_print_disasm_json
fills out the pj structure fully using keywords for each part of the assembly instruction, r_core_print_disasm
just grabs the console line and puts it in pj as a 'text' element.
I was changing disasm.c and cmd_print.inc.c so that all of the 'j' subcommands call r_core_print_disasm_json
instead of r_core_print_disasm
and removed the json
arg to r_core_print_disasm
.
This seemed to be working until I found that r_core_print_disasm_json
doesn't use the ds_
functionality... it's calling r_asm_op_
functions directly rather than the ds_
wrapper functions. ds_disassemble
has a much more advanced way to handle disassembled instruction edge cases that r_core_print_disasm_json
doesn't have and it seems silly to duplicate it all.
So I see 2 paths forward:
- Update
r_core_print_disasm_json
so that it uses theds_
functions. - Go back to passing in
json
intor_core_print_disasm
and add the fullpj_
functionality to build the full json structure that you have inr_core_print_disasm_json
Make sense?
Do you have a preference for a path forward? I think option 2 is a little more elegant imho. Along with a separate function for adding a new instruction to pj
to make it a bit cleaner.
Man, this project is huge. Kudos to you for keeping it up solo for so long. Could use some tech debt cleanup though.
from radare2.
One restriction is that we can't change public structure or function signatures, so having this in mind, both approaches look good, as one solves the problem quickier, so it may work for you sooner, but a proper rewrite/refactoring/cleanup is always welcome, everthing in r2land is prompt to be changed for the good.
So my vote goes for the 2nd approach.
If you need to break APIs you can use the R2_USE_NEW_ABI ifdef, and this code will be swapped before r2-6.0.0 is out (during the 5.9.9 development time)
from radare2.
Ping
from radare2.
Related Issues (20)
- program execution is stopped with SIGBUS on FreeBSD HOT 1
- Avoid or filter duplicated function signature entries
- axF is very slow
- afvs does not indicate non-initial struct members when the stack is adjusted
- b64 crash
- cmd_cmp does not honor endian
- sixref asan
- "afbij" otput wrog json format HOT 2
- Build system picks an arbitrary `cc` for `arch-arm64` which breaks compilation HOT 1
- Wrong value of triple on PowerPC: `PowerMacintosh-unknown-darwin` instead of `powerpc-apple-darwin` HOT 4
- Improve iS help message HOT 2
- Segmentation fault when running an invalid command
- :: hangs in a deadlock
- /ad/ search is incomplete HOT 6
- `{` logs array missing commas HOT 3
- `{` WARN printed and missing from JSON `pdg @ sym.main` HOT 1
- Do not show local variable details in afi
- SFENCE.VMA instruction not decoded correctly in RISC-V HOT 1
- Add a command to check timestamp of plugins to reload them
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from radare2.