mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-24 23:06:36 +00:00
Minor cleanups/fixes
This commit is contained in:
parent
524874fd6d
commit
0a65d76eb8
@ -451,12 +451,12 @@ static bool xtr_metadata_match(RBinXtrData *xtr_data, const char *arch, int bits
|
||||
R_IPI RBinFile *r_bin_file_new_from_bytes(RBin *bin, const char *file, const ut8 *bytes, ut64 sz, ut64 file_sz, int rawstr, ut64 baseaddr, ut64 loadaddr, int fd, const char *pluginname, ut64 offset) {
|
||||
r_return_val_if_fail (sz != UT64_MAX, NULL);
|
||||
|
||||
RBinPlugin *plugin = get_plugin (bin, pluginname, bytes, sz);
|
||||
RBinFile *bf = file_create_append (bin, file, bytes, sz, file_sz, rawstr, fd, NULL, true);
|
||||
if (!bf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RBinPlugin *plugin = get_plugin (bin, pluginname, bytes, sz);
|
||||
RBinObject *o = r_bin_object_new (bf, plugin, baseaddr, loadaddr, 0, r_buf_size (bf->buf));
|
||||
if (!o) {
|
||||
r_list_delete_data (bin->binfiles, bf);
|
||||
|
@ -3177,6 +3177,9 @@ static void r_core_cmd_bp(RCore *core, const char *input) {
|
||||
module = strtok (string, " ");
|
||||
delta = (ut64)r_num_math (core->num, strtok (NULL, ""));
|
||||
bpi = r_debug_bp_add (core->dbg, 0, hwbp, false, 0, module, delta);
|
||||
if (!bpi) {
|
||||
eprintf ("Cannot set breakpoint.\n");
|
||||
}
|
||||
free (string);
|
||||
}
|
||||
break;
|
||||
@ -3260,7 +3263,9 @@ static void r_core_cmd_bp(RCore *core, const char *input) {
|
||||
} else {
|
||||
// XXX(jjd): does t his need an address validity check??
|
||||
bpi = r_debug_bp_add (core->dbg, addr, hwbp, false, 0, NULL, 0);
|
||||
if (!bpi) eprintf ("Cannot set breakpoint (%s)\n", input + 2);
|
||||
if (!bpi) {
|
||||
eprintf ("Cannot set breakpoint (%s)\n", input + 2);
|
||||
}
|
||||
}
|
||||
r_bp_enable (core->dbg->bp, r_num_math (core->num, input + 2), true, 0);
|
||||
break;
|
||||
|
@ -1232,7 +1232,6 @@ static int r_core_search_rop(RCore *core, RInterval search_itv, int opt, const c
|
||||
const ut8 subchain = r_config_get_i (core->config, "rop.subchains");
|
||||
const ut8 max_instr = r_config_get_i (core->config, "rop.len");
|
||||
const char *arch = r_config_get (core->config, "asm.arch");
|
||||
ut64 from = search_itv.addr, to = r_itv_end (search_itv);
|
||||
int max_count = r_config_get_i (core->config, "search.maxhits");
|
||||
int i = 0, end = 0, mode = 0, increment = 1, ret, result = true;
|
||||
RList /*<endlist_pair>*/ *end_list = r_list_newf (free);
|
||||
@ -1324,8 +1323,7 @@ static int r_core_search_rop(RCore *core, RInterval search_itv, int opt, const c
|
||||
continue;
|
||||
}
|
||||
RInterval itv = r_itv_intersect (search_itv, map->itv);
|
||||
from = itv.addr;
|
||||
to = r_itv_end (itv);
|
||||
ut64 from = itv.addr, to = r_itv_end (itv);
|
||||
if (r_cons_is_breaked ()) {
|
||||
break;
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ static int r_cmd_is_object_descriptor (const char *name, ut32 name_len) {
|
||||
}
|
||||
}
|
||||
|
||||
for (idx = 0, L_pos = 0; idx < name_len; idx++,p_name++) {
|
||||
for (idx = 0, Semi_pos = 0; idx < name_len; idx++,p_name++) {
|
||||
if (*p_name == ';') {
|
||||
found_Semi = true;
|
||||
Semi_pos = idx;
|
||||
|
@ -595,9 +595,9 @@ static RList *r_debug_native_pids (RDebug *dbg, int pid) {
|
||||
if (!dh) {
|
||||
r_sys_perror ("opendir /proc");
|
||||
r_list_free (list);
|
||||
list = NULL;
|
||||
return NULL;
|
||||
}
|
||||
while (dh && (de = readdir (dh))) {
|
||||
while (de = readdir (dh)) {
|
||||
uid = 0;
|
||||
st = ' ';
|
||||
/* for each existing pid file... */
|
||||
|
@ -2050,6 +2050,9 @@ R_API void r_print_hex_from_bin (RPrint *p, char *bin_str) {
|
||||
int i, j, index;
|
||||
RPrint myp = {.cb_printf = libc_printf};
|
||||
const int len = strlen (bin_str);
|
||||
if (!len) {
|
||||
return;
|
||||
}
|
||||
ut64 n, *buf = malloc (sizeof (ut64) * ((len + 63) / 64));
|
||||
if (buf == NULL) {
|
||||
eprintf ("allocation failed\n");
|
||||
|
@ -2376,7 +2376,7 @@ static void decl_designator(CType *type, unsigned long c,
|
||||
index_last = index;
|
||||
}
|
||||
skip (']');
|
||||
if (!notfirst) {
|
||||
if (!notfirst && cur_index) {
|
||||
*cur_index = index_last;
|
||||
}
|
||||
type = pointed_type (type);
|
||||
@ -2408,7 +2408,7 @@ struct_field:
|
||||
if (!f) {
|
||||
expect ("field");
|
||||
}
|
||||
if (!notfirst) {
|
||||
if (!notfirst && cur_field) {
|
||||
*cur_field = f;
|
||||
}
|
||||
/* XXX: fix this mess by using explicit storage field */
|
||||
@ -2435,7 +2435,7 @@ struct_field:
|
||||
type = pointed_type (type);
|
||||
c += index * type_size (type, &align);
|
||||
} else {
|
||||
f = *cur_field;
|
||||
f = cur_field ? *cur_field : NULL;
|
||||
if (!f) {
|
||||
TCC_ERR ("too many field init");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user