Skip to content

Commit

Permalink
Implement Vd1! to toggle all bits from the selected byte ##visual
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Nov 12, 2024
1 parent 2028e53 commit 2d5ff60
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libr/core/canal.c
Original file line number Diff line number Diff line change
Expand Up @@ -4728,7 +4728,7 @@ R_API int r_core_anal_search_xrefs(RCore *core, ut64 from, ut64 to, PJ *pj, int
uninit = true;
at += bsz;
if (!r_io_is_valid_offset (core->io, at, 0)) {
R_LOG_ERROR ("invalid memory");
R_LOG_ERROR ("invalid memory at 0x%08"PFMT64x, at);
break;
}
continue;
Expand Down
12 changes: 10 additions & 2 deletions libr/core/vmenus.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ R_API bool r_core_visual_esil(RCore *core, const char *input) {
r_cons_clear00 ();
r_cons_printf (
"VdE?: Visual Esil Debugger Help (aev):\n\n"
" q - quit the bit editor\n"
" q - quit the esil debugger\n"
" h/r - reset / go back (reinitialize esil state)\n"
" s - esil step in\n"
" S - esil step over\n"
Expand All @@ -435,6 +435,7 @@ R_API bool r_core_visual_esil(RCore *core, const char *input) {
" j/k - next/prev instruction\n"
" n/p - go next/prev instruction\n"
" = - enter cmd.vprompt command\n"
" ! - toggle all bits\n"
" : - enter command\n");
r_cons_flush ();
r_cons_any_key (NULL);
Expand Down Expand Up @@ -666,6 +667,12 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
free (op_hex);
}
return false;
case '!':
{
const int nbyte = x / 8;
*(buf + nbyte) = ~*(buf + nbyte);
}
break;
case 'H':
{
const int y = R_MAX (x - 8, 0);
Expand Down Expand Up @@ -705,7 +712,7 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
}
break;
case '>':
buf[x/8] = rotate_nibble (buf [(x / 8)], -1);
buf[x / 8] = rotate_nibble (buf [(x / 8)], -1);
break;
case '<':
buf[x / 8] = rotate_nibble (buf [(x / 8)], 1);
Expand Down Expand Up @@ -770,6 +777,7 @@ R_API bool r_core_visual_bit_editor(RCore *core) {
" </> - rotate left/right byte value\n"
" i - insert numeric value of byte\n"
" = - set cmd.vprompt command\n"
" ! - toggle all the bits\n"
" : - run r2 command\n");
r_cons_flush ();
r_cons_any_key (NULL);
Expand Down
2 changes: 1 addition & 1 deletion libr/magic/funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void __magic_file_badread(RMagic *ms) {
__magic_file_error (ms, errno, "error reading");
}

int __magic_file_buffer(RMagic *ms, int fd, const char *inname, const void *buf, size_t nb) {
R_IPI int __magic_file_buffer(RMagic *ms, int fd, const char *inname, const void *buf, size_t nb) {
int mime, m = 0;
if (!ms) {
return -1;
Expand Down

0 comments on commit 2d5ff60

Please sign in to comment.