Skip to content

Commit

Permalink
Fix cmd on bp hit cons handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ret2libc authored and XVilka committed Feb 24, 2021
1 parent 44ef27e commit d4638fe
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
10 changes: 10 additions & 0 deletions librz/cons/cons.c
Original file line number Diff line number Diff line change
Expand Up @@ -1960,3 +1960,13 @@ RZ_API void rz_cons_clear_buffer(void) {
6);
}
}

/**
* \brief Set whether RzCons should flush content to screen or not
*
* \param flush If true, calls to \p rz_cons_flush and \p rz_cons_visual_flush
* would flush cons content to the screen, otherwise they will not.
*/
RZ_API void rz_cons_set_flush(bool flush) {
CTX(noflush) = !flush;
}
2 changes: 0 additions & 2 deletions librz/core/cmd_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -5138,9 +5138,7 @@ RZ_IPI int rz_cmd_debug(void *data, const char *input) {
case 's': // "dxs"
if (input[2]) {
char *str;
rz_cons_push();
str = rz_core_cmd_str(core, sdb_fmt("gs %s", input + 2));
rz_cons_pop();
rz_core_cmdf(core, "dx %s", str); //`gs %s`", input + 2);
free(str);
} else {
Expand Down
6 changes: 0 additions & 6 deletions librz/core/cmd_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,6 @@ static void cmd_pCd(RzCore *core, const char *input) {
if (user_rows > 0) {
rows = user_rows + 1;
}
rz_cons_push();
RzConsCanvas *c = rz_cons_canvas_new(w, rows);
ut64 osek = core->offset;
c->color = rz_config_get_i(core->config, "scr.color");
Expand All @@ -1116,7 +1115,6 @@ static void cmd_pCd(RzCore *core, const char *input) {
rz_core_block_size(core, obsz);
rz_core_seek(core, osek, true);

rz_cons_pop();
rz_cons_canvas_print(c);
rz_cons_canvas_free(c);
if (asm_minicols) {
Expand Down Expand Up @@ -1183,7 +1181,6 @@ static void cmd_pCD(RzCore *core, const char *input) {
if (user_rows > 0) {
rows = user_rows + 1;
}
rz_cons_push();
RzConsCanvas *c = rz_cons_canvas_new(w, rows);
ut64 osek = core->offset;
c->color = rz_config_get_i(core->config, "scr.color");
Expand All @@ -1210,7 +1207,6 @@ static void cmd_pCD(RzCore *core, const char *input) {
rz_core_block_size(core, obsz);
rz_core_seek(core, osek, true);

rz_cons_pop();
rz_cons_canvas_print(c);
rz_cons_canvas_free(c);
if (asm_minicols) {
Expand Down Expand Up @@ -2796,7 +2792,6 @@ static void disasm_strings(RzCore *core, const char *input, RzAnalysisFunction *
rz_config_set_i(core->config, "scr.html", 0);
rz_config_set_i(core->config, "asm.cmt.right", true);

rz_cons_push();
line = NULL;
s = NULL;
if (!strncmp(input, "dsb", 3)) {
Expand All @@ -2819,7 +2814,6 @@ static void disasm_strings(RzCore *core, const char *input, RzAnalysisFunction *
} else {
line = s = rz_core_cmd_str(core, "pd");
}
rz_cons_pop();

rz_config_set_i(core->config, "scr.html", scr_html);
rz_config_set_i(core->config, "scr.color", use_color);
Expand Down
1 change: 1 addition & 0 deletions librz/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ static void rz_core_debug_breakpoint_hit(RzCore *core, RzBreakpointItem *bpi) {
rz_core_cmd0(core, bpi->data);
}
if (may_output) {
rz_cons_set_flush(true);
rz_cons_flush();
rz_cons_pop();
}
Expand Down
1 change: 1 addition & 0 deletions librz/debug/p/debug_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ static char *__io_reg_profile(RzDebug *dbg) {
rz_cons_pop();
return ret;
}
rz_cons_pop();
return rz_analysis_get_reg_profile(dbg->analysis);
}

Expand Down
1 change: 1 addition & 0 deletions librz/include/rz_cons.h
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ RZ_API int rz_cons_memcat(const char *str, int len);
RZ_API void rz_cons_newline(void);
RZ_API void rz_cons_filter(void);
RZ_API void rz_cons_flush(void);
RZ_API void rz_cons_set_flush(bool flush);
RZ_API void rz_cons_print_fps(int col);
RZ_API void rz_cons_last(void);
RZ_API int rz_cons_less_str(const char *str, const char *exitkeys);
Expand Down

0 comments on commit d4638fe

Please sign in to comment.