-
-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port c
commands to newshell
#1854
Conversation
if (b) { | ||
memset(b, 0xff, core->blocksize); | ||
rz_io_read_at(core->io, addr, b, core->blocksize); | ||
rz_print_hexdiff(core->print, core->offset, core->block, addr, b, core->blocksize, col); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wargio please take a look at these two functions, since you wrote that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you noticed, it seems this whole file is not very tested... You can see the coverage on https://app.codecov.io/gh/rizinorg/rizin/blob/6da244eca72902c3939f1ecc5a1b566c93e4b415/librz/core/cmd/cmd_cmp.c . I think adding a basic test for each command would be great.
* `cv`, `cV` and `cg` haven't been ported yet
* Rename `__core_cmp_bits` to `core_cmp_bits`
* Also, simplify `cd` command handler
Also forgotten
|
Thank you for pointing out. However, I will fix the errors once the porting is complete. |
* Add `rz_cmp.h` and `cmp.c` * Break `cmd_cmp_disasm` into 2 API functions, one for getting the diff, other for printing the diff * Refactor `cmd_cmp.c` to use the new cmd API functions
* Refactor handlers to use the new functions * Add data-data, data-str compare function, and a general print function in the `cmd` API
@DMaroo I think you messed up with the branch because you ended up including some changes done by @thestr4ng3r and if you look at the diff right now there are also changes from him related to DYLD. |
Yes. My bad. Moving commits from this branch to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the remaining tests and we are good to go, IMHO:
[XX] db/cmd/data cmp data
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'b 16
wx 41
e scr.null=1
cx 41 2>/dev/null
e scr.null=0
?! ?e thats fine
e scr.null=1
cx 11 2>/dev/null
e scr.null=0
?! ?e thats wrong
' =
-- stdout
--- expected
+++ actual
@@ --1,3 +-1,4 @@
thats fine
+thats wrong
[XX] db/cmd/bitmask bitmask cmp data
RZ_NOPLUGINS=1 rizin -escr.utf8=0 -escr.color=0 -escr.interactive=0 -N -Qc 'b 16
wx 414243
e scr.null=1
cx 41..43 2>/dev/null
e scr.null=0
?! ?e thats fine
e scr.null=1
cx 41..11 2>/dev/null
e scr.null=0
?! ?e thats wrong
' =
-- stdout
--- expected
+++ actual
@@ --1,3 +-1,4 @@
thats fine
+thats wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just few minor/last nitpicks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
cv
,cV
andcg
haven't been ported yetYour checklist for this pull request
Detailed description
To port:
cv
(implemented incb
)cV
(implemented inca
)cg
(to be removed)Test plan
Add tests for new commands. Test coverage for
c
commands is not very good.Closing issues
Tracking issue: #1342