Skip to content
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

Fix #10165 compact cross references #10243

Merged
merged 1 commit into from Jun 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion libr/core/cconfig.c
Expand Up @@ -2425,7 +2425,8 @@ R_API int r_core_config_init(RCore *core) {
n = NODECB ("asm.os", R_SYS_OS, &cb_asmos);
SETDESC (n, "Select operating system (kernel)");
SETOPTIONS (n, "ios", "dos", "darwin", "linux", "freebsd", "openbsd", "netbsd", "windows", NULL);
SETI ("asm.maxrefs", 5, "Maximum number of xrefs to be displayed as list (use columns above)");
SETI ("asm.xrefs.fold", 5, "Maximum number of xrefs to be displayed as list (use columns above)");
SETI ("asm.xrefs.max", 20, "Maximum number of xrefs to be displayed without folding");
SETCB ("asm.invhex", "false", &cb_asm_invhex, "Show invalid instructions as hexadecimal numbers");
SETPREF ("asm.meta", "true", "Display the code/data/format conversions in disasm");
SETPREF ("asm.bytes", "true", "Display the bytes of each instruction");
Expand Down
10 changes: 6 additions & 4 deletions libr/core/disasm.c
Expand Up @@ -240,6 +240,7 @@ typedef struct {
const ut8 *buf;
int len;
int maxrefs;
int foldxrefs;
char *prev_ins;
bool prev_ins_eq;
int prev_ins_count;
Expand Down Expand Up @@ -596,7 +597,8 @@ static RDisasmState * ds_init(RCore *core) {
ds->show_vars = r_config_get_i (core->config, "asm.var");
ds->show_varsum = r_config_get_i (core->config, "asm.var.summary");
ds->show_varaccess = r_config_get_i (core->config, "asm.var.access");
ds->maxrefs = r_config_get_i (core->config, "asm.maxrefs");
ds->maxrefs = r_config_get_i (core->config, "asm.xrefs.max");
ds->foldxrefs = r_config_get_i (core->config, "asm.xrefs.fold");
ds->show_lines = r_config_get_i (core->config, "asm.lines");
ds->linesright = r_config_get_i (core->config, "asm.lines.right");
ds->show_indent = r_config_get_i (core->config, "asm.indent");
Expand Down Expand Up @@ -1147,18 +1149,18 @@ static void ds_show_xrefs(RDisasmState *ds) {
if (!xrefs) {
return;
}
if (ds->maxrefs < 1) {
if (r_list_length (xrefs) > ds->maxrefs) {
ds_pre_xrefs (ds, false);
ds_comment (ds, false, "%s; XREFS(%d)\n",
ds->show_color? ds->pal_comment: "",
r_list_length (xrefs));
r_list_free (xrefs);
return;
}
if (r_list_length (xrefs) > ds->maxrefs) {
} else if (r_list_length (xrefs) > ds->foldxrefs) {
int cols = r_cons_get_size (NULL);
cols -= 15;
cols /= 23;
cols = cols > 5 ? 5 : cols;
ds_pre_xrefs (ds, false);
ds_comment (ds, false, "%s; XREFS: ", ds->show_color? ds->pal_comment: "");
r_list_foreach (xrefs, iter, refi) {
Expand Down