From 0e69bfd54152cd95fb261f2efa163c7cb4fcc7ae Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 16 Feb 2016 03:24:47 +0100 Subject: [PATCH] Add default noreturn functions, adjust xrefs and fix regression in type --- libr/core/cmd_meta.c | 4 +--- libr/core/core.c | 12 ++++++++++++ libr/core/disasm.c | 5 ++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/libr/core/cmd_meta.c b/libr/core/cmd_meta.c index 73913b23df..9d444e1ad4 100644 --- a/libr/core/cmd_meta.c +++ b/libr/core/cmd_meta.c @@ -449,9 +449,7 @@ static int cmd_meta_hsdmf (RCore *core, const char *input) { char *rep = strchr (input + 2, '['); if (!rep) rep = strchr (input + 2, ' '); if (rep) { - rep++; - repeat = r_num_get (core->num, rep); - *rep = 0; + repeat = r_num_get (core->num, rep+1); } } int repcnt = 0; diff --git a/libr/core/core.c b/libr/core/core.c index f4fce6338e..6d86cea624 100644 --- a/libr/core/core.c +++ b/libr/core/core.c @@ -1197,6 +1197,18 @@ R_API int r_core_init(RCore *core) { core->assembler->num = core->num; r_asm_set_user_ptr (core->assembler, core); core->anal = r_anal_new (); + + /* default noreturn functions */ + /* osx */ + r_anal_noreturn_add (core->anal, "sym.imp.__assert_rtn", UT64_MAX); + r_anal_noreturn_add (core->anal, "sym.imp.exit", UT64_MAX); + r_anal_noreturn_add (core->anal, "sym.imp._exit", UT64_MAX); + r_anal_noreturn_add (core->anal, "sym.imp.__stack_chk_fail", UT64_MAX); + /* linux */ + r_anal_noreturn_add (core->anal, "sym.__assert_fail", UT64_MAX); + r_anal_noreturn_add (core->anal, "sym.abort", UT64_MAX); + r_anal_noreturn_add (core->anal, "sym.exit", UT64_MAX); + core->anal->meta_spaces.cb_printf = r_cons_printf; core->anal->cb.on_fcn_new = on_fcn_new; core->anal->cb.on_fcn_delete = on_fcn_delete; diff --git a/libr/core/disasm.c b/libr/core/disasm.c index c623433bc4..9f919bb997 100644 --- a/libr/core/disasm.c +++ b/libr/core/disasm.c @@ -640,6 +640,9 @@ static void handle_show_xrefs (RCore *core, RDisasmState *ds) { xrefs = r_anal_xref_get (core->anal, ds->at); if (!xrefs) return; if (r_list_length (xrefs) > ds->maxrefs) { + int cols = r_cons_get_size (NULL); + cols -= 15; + cols /= 23; RAnalFunction *f = r_anal_get_fcn_in (core->anal, ds->at, R_ANAL_FCN_TYPE_NULL); beginline (core, ds, f); @@ -648,7 +651,7 @@ static void handle_show_xrefs (RCore *core, RDisasmState *ds) { r_list_foreach (xrefs, iter, refi) { r_cons_printf ("%s 0x%08"PFMT64x" ", r_anal_xrefs_type_tostring (refi->type), refi->addr); - if (count == 2) { + if (count == cols) { if (iter->n) { r_cons_newline (); beginline (core, ds, f);