mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-27 00:05:10 +00:00
Fix last 3 mails of covs and some warnings
This commit is contained in:
parent
7b55621abd
commit
b5c678ff6d
@ -48,7 +48,7 @@ hexagon_dis_inst(
|
||||
if (!hexagon_dis_opcode(instrBuffer, insn, address, opcode, &errmsg)) {
|
||||
/* Some kind of error! */
|
||||
if (errmsg) {
|
||||
(*info->fprintf_func) (info->stream, errmsg);
|
||||
(*info->fprintf_func) (info->stream, "%s", errmsg);
|
||||
strcpy(instrBuffer, "");
|
||||
}
|
||||
}
|
||||
|
@ -295,14 +295,17 @@ static void get_ivar_list_t(mach0_ut p, RBinFile *arch, RBinClass *klass) {
|
||||
if (r != 0) {
|
||||
struct MACH0_(obj_t) *bin = (struct MACH0_(obj_t) *) arch->o->bin_obj;
|
||||
int is_crypted = bin->has_crypto;
|
||||
if (r + left < r) return;
|
||||
if (r > arch->size || r + left > arch->size) return;
|
||||
|
||||
if (r + left < r) {
|
||||
goto error;
|
||||
}
|
||||
if (r > arch->size || r + left > arch->size) {
|
||||
goto error;
|
||||
}
|
||||
if (is_crypted == 1) {
|
||||
type = strdup ("some_encrypted_data");
|
||||
left = strlen (name) + 1;
|
||||
// left = strlen (name) + 1;
|
||||
} else {
|
||||
type = malloc (left);
|
||||
type = calloc (1, left);
|
||||
r_buf_read_at (arch->buf, r, (ut8 *)type, left);
|
||||
}
|
||||
field->type = strdup (type);
|
||||
@ -316,8 +319,7 @@ static void get_ivar_list_t(mach0_ut p, RBinFile *arch, RBinClass *klass) {
|
||||
return;
|
||||
|
||||
error:
|
||||
R_FREE (field);
|
||||
return;
|
||||
r_bin_field_free (field);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1420,9 +1420,10 @@ static int cmd_debug_map(RCore *core, const char *input) {
|
||||
if (input[1]=='*') {
|
||||
mode = "-r ";
|
||||
}
|
||||
ptr = strdup (r_str_trim_head ((char*)input + 2));
|
||||
ptr = strdup (r_str_chop_ro (input + 2));
|
||||
if (!ptr || !*ptr) {
|
||||
r_core_cmd (core, "dmm", 0);
|
||||
free (ptr);
|
||||
break;
|
||||
}
|
||||
i = r_str_word_set0 (ptr);
|
||||
@ -2435,27 +2436,29 @@ static void backtrace_vars(RCore *core, RList *frames) {
|
||||
ut64 b = f->bp ? f->bp : dbp;
|
||||
r_reg_setv (r, bp, s);
|
||||
r_reg_setv (r, sp, b);
|
||||
char flagdesc[1024], flagdesc2[1024];
|
||||
RFlagItem *fi = r_flag_get_at (core->flags, f->addr, true);
|
||||
flagdesc[0] = flagdesc2[0] = 0;
|
||||
if (f) {
|
||||
if (fi->offset != f->addr) {
|
||||
int delta = (int)(f->addr - fi->offset);
|
||||
if (delta > 0) {
|
||||
snprintf (flagdesc, sizeof (flagdesc),
|
||||
"%s+%d", fi->name, delta);
|
||||
} else if (delta < 0) {
|
||||
snprintf (flagdesc, sizeof (flagdesc),
|
||||
"%s%d", fi->name, delta);
|
||||
} else {
|
||||
snprintf (flagdesc, sizeof (flagdesc),
|
||||
"%s", fi->name);
|
||||
}
|
||||
} else {
|
||||
snprintf (flagdesc, sizeof (flagdesc),
|
||||
"%s", fi->name);
|
||||
}
|
||||
//////////
|
||||
char flagdesc[1024], flagdesc2[1024];
|
||||
RFlagItem *fi = r_flag_get_at (core->flags, f->addr, true);
|
||||
flagdesc[0] = flagdesc2[0] = 0;
|
||||
if (fi) {
|
||||
if (fi->offset != f->addr) {
|
||||
int delta = (int)(f->addr - fi->offset);
|
||||
if (delta > 0) {
|
||||
snprintf (flagdesc, sizeof (flagdesc),
|
||||
"%s+%d", fi->name, delta);
|
||||
} else if (delta < 0) {
|
||||
snprintf (flagdesc, sizeof (flagdesc),
|
||||
"%s%d", fi->name, delta);
|
||||
} else {
|
||||
snprintf (flagdesc, sizeof (flagdesc),
|
||||
"%s", fi->name);
|
||||
}
|
||||
} else {
|
||||
snprintf (flagdesc, sizeof (flagdesc),
|
||||
"%s", fi->name);
|
||||
}
|
||||
}
|
||||
//////////
|
||||
RAnalFunction *fcn = r_anal_get_fcn_in (core->anal, f->addr, 0);
|
||||
// char *str = r_str_newf ("[frame %d]", n);
|
||||
r_cons_printf ("%d 0x%08"PFMT64x" sp: 0x%08"PFMT64x" %-5d"
|
||||
@ -2921,6 +2924,7 @@ static void r_core_cmd_bp(RCore *core, const char *input) {
|
||||
case 'w': // "dbw"
|
||||
input++; // skip 'w'
|
||||
watch = true;
|
||||
// passthru
|
||||
case ' ': // "db"
|
||||
for (p = input + 2; *p == ' '; p++);
|
||||
if (*p == '-') {
|
||||
@ -3202,17 +3206,16 @@ static void debug_trace_calls(RCore *core, const char *input) {
|
||||
return;
|
||||
}
|
||||
if (*input == ' ') {
|
||||
ut64 first_n;
|
||||
input = r_str_trim_head (input);
|
||||
first_n = r_num_math (core->num, input);
|
||||
input = r_str_chop_ro (input);
|
||||
ut64 first_n = r_num_math (core->num, input);
|
||||
input = strchr (input, ' ');
|
||||
if (input) {
|
||||
input = r_str_trim_head (input);
|
||||
input = r_str_chop_ro (input);
|
||||
from = first_n;
|
||||
to = r_num_math (core->num, input);
|
||||
input = strchr (input, ' ');
|
||||
if (input) {
|
||||
input = r_str_trim_head (input);
|
||||
input = r_str_chop_ro (input);
|
||||
final_addr = r_num_math (core->num, input);
|
||||
}
|
||||
} else {
|
||||
|
@ -759,7 +759,7 @@ static int cmd_info(void *data, const char *input) {
|
||||
break;
|
||||
}
|
||||
input++;
|
||||
if ((*input == 'j' || *input == 'q') && !input[1]) {
|
||||
if ((*input == 'j' || *input == 'q') && (input[0] && !input[1])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -234,9 +234,11 @@ static void GH(jemalloc_print_narenas)(RCore *core, const char *input) {
|
||||
}
|
||||
if (narenas == 0) {
|
||||
eprintf ("No arenas allocated.\n");
|
||||
free (stats);
|
||||
return;
|
||||
}
|
||||
if (narenas == GHT_MAX) {
|
||||
free (stats);
|
||||
eprintf ("Cannot find narenas_total\n");
|
||||
return;
|
||||
}
|
||||
@ -320,6 +322,8 @@ static void GH(jemalloc_get_bins)(RCore *core, const char *input) {
|
||||
}
|
||||
if (!GH(r_resolve_jemalloc)(core, "je_arena_bin_info", &bin_info)) {
|
||||
eprintf ("Error resolving je_arena_bin_info\n");
|
||||
free (ar);
|
||||
free (b);
|
||||
return;
|
||||
}
|
||||
if (GH(r_resolve_jemalloc)(core, "je_arenas", &arenas)) {
|
||||
@ -328,6 +332,8 @@ static void GH(jemalloc_get_bins)(RCore *core, const char *input) {
|
||||
for (;;) {
|
||||
r_core_read_at (core, arenas + i * sizeof (GHT), (ut8 *)&arena, sizeof (GHT));
|
||||
if (!arena) {
|
||||
free (ar);
|
||||
free (b);
|
||||
break;
|
||||
}
|
||||
PRINTF_YA (" arenas[%d]: ", i++);
|
||||
|
@ -87,7 +87,6 @@ static RDebugReasonType r_debug_windbg_wait(RDebug *dbg, int pid) {
|
||||
reason = R_DEBUG_REASON_INT;
|
||||
break;
|
||||
}
|
||||
free (pkt);
|
||||
}
|
||||
free (pkt);
|
||||
return reason;
|
||||
|
@ -25,9 +25,6 @@ static bool __plugin_open(RIO *io, const char *file, bool many) {
|
||||
}
|
||||
|
||||
static RIODesc *__open(RIO *io, const char *file, int rw, int mode) {
|
||||
void *io_ctx;
|
||||
WindCtx *ctx;
|
||||
|
||||
if (!__plugin_open (io, file, 0)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -37,20 +34,18 @@ static RIODesc *__open(RIO *io, const char *file, int rw, int mode) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
io_ctx = iob_open (file + 9);
|
||||
void *io_ctx = iob_open (file + 9);
|
||||
if (!io_ctx) {
|
||||
eprintf ("Could not open the pipe\n");
|
||||
return NULL;
|
||||
}
|
||||
eprintf ("Opened pipe %s with fd %p\n", file+9, io_ctx);
|
||||
|
||||
ctx = windbg_ctx_new (io_ctx);
|
||||
eprintf ("Opened pipe %s with fd %p\n", file + 9, io_ctx);
|
||||
|
||||
WindCtx *ctx = windbg_ctx_new (io_ctx);
|
||||
if (!ctx) {
|
||||
eprintf ("Failed to initialize windbg context\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return r_io_desc_new (&r_io_plugin_windbg, -1, file, true, mode, ctx);
|
||||
}
|
||||
|
||||
@ -58,7 +53,6 @@ static int __write(RIO *io, RIODesc *fd, const ut8 *buf, int count) {
|
||||
if (!fd) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (windbg_get_target (fd->data)) {
|
||||
ut64 va;
|
||||
if (!windbg_va_to_pa (fd->data, io->off, &va)) {
|
||||
@ -66,7 +60,6 @@ static int __write(RIO *io, RIODesc *fd, const ut8 *buf, int count) {
|
||||
}
|
||||
return windbg_write_at_phys (fd->data, buf, va, count);
|
||||
}
|
||||
|
||||
return windbg_write_at (fd->data, buf, io->off, count);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user