Skip to content

Commit

Permalink
Minor cleanup in cmd_print
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae authored and radare committed Feb 24, 2022
1 parent 333e991 commit 265ecad
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 183 deletions.
10 changes: 5 additions & 5 deletions libr/core/casm.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ static int is_hit_inrange(RCoreAsmHit *hit, ut64 start_range, ut64 end_range){
R_API RList *r_core_asm_bwdisassemble(RCore *core, ut64 addr, int n, int len) {
RAsmOp op;
// if (n > core->blocksize) n = core->blocksize;
ut64 at;
ut32 idx = 0, hit_count;
int numinstr, asmlen, ii;
const int addrbytes = core->io->addrbytes;
Expand All @@ -494,8 +493,7 @@ R_API RList *r_core_asm_bwdisassemble(RCore *core, ut64 addr, int n, int len) {
if (!hits) {
return NULL;
}

len = R_MIN (len - len % addrbytes, addrbytes * addr);
len = R_MIN (len - (len % addrbytes), addrbytes * addr);
if (len < 1) {
r_list_free (hits);
return NULL;
Expand All @@ -509,7 +507,7 @@ R_API RList *r_core_asm_bwdisassemble(RCore *core, ut64 addr, int n, int len) {
free (buf);
return NULL;
}
if (!r_io_read_at (core->io, addr - len / addrbytes, buf, len)) {
if (!r_io_read_at (core->io, addr - (len / addrbytes), buf, len)) {
r_list_free (hits);
free (buf);
return NULL;
Expand All @@ -536,7 +534,9 @@ R_API RList *r_core_asm_bwdisassemble(RCore *core, ut64 addr, int n, int len) {
break;
}
}
at = addr - idx / addrbytes;

ut64 at = addr - idx / addrbytes;

r_asm_set_pc (core->rasm, at);
for (hit_count = 0; hit_count < n; hit_count++) {
int instrlen = r_asm_disassemble (core->rasm, &op,
Expand Down
Loading

0 comments on commit 265ecad

Please sign in to comment.