mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-27 15:10:53 +00:00
Fix last covs and add $e{} in RNumCallback
This commit is contained in:
parent
8ee4c902fb
commit
885f9efeb0
@ -509,8 +509,9 @@ R_API void r_meta_print(RAnal *a, RAnalMetaItem *d, int rad, bool show_full) {
|
||||
pstr = str;
|
||||
} else if (d->type == 't') {
|
||||
// Sanitize (don't escape) Ct comments so we can see "char *", etc.
|
||||
free (str);
|
||||
str = strdup (d->str);
|
||||
r_str_sanitize(str);
|
||||
r_str_sanitize (str);
|
||||
pstr = str;
|
||||
} else if (d->type != 'C') {
|
||||
r_name_filter (str, 0);
|
||||
|
@ -391,10 +391,6 @@ static mcore_t *find_instruction(const ut8* buffer) {
|
||||
op_ptr = &mcore_instructions[i + 1];
|
||||
}
|
||||
}
|
||||
if (!op_ptr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
op->type = op_ptr->type;
|
||||
op->name = op_ptr->name;
|
||||
op->n_args = op_ptr->n_args;
|
||||
|
@ -747,7 +747,7 @@ static bool parse_signature(struct MACH0_(obj_t) *bin, ut64 off) {
|
||||
}
|
||||
break;
|
||||
case 0x10000: // ASN1/DER certificate
|
||||
{
|
||||
if (isVerbose) {
|
||||
ut8 header[8] = {0};
|
||||
r_buf_read_at (bin->b, data + idx.offset, header, sizeof (header));
|
||||
ut32 length = R_MIN (UT16_MAX, r_read_ble32 (header + 4, 1));
|
||||
@ -759,8 +759,7 @@ static bool parse_signature(struct MACH0_(obj_t) *bin, ut64 off) {
|
||||
words += 2;
|
||||
eprintf ("wtf DUMP @%d!%d\n",
|
||||
(int)data + idx.offset + 8, (int)length);
|
||||
eprintf ("openssl pkcs7 -print_certs -text -inform der -in DUMP\n",
|
||||
(int)data + idx.offset + 8, (int)length);
|
||||
eprintf ("openssl pkcs7 -print_certs -text -inform der -in DUMP\n");
|
||||
eprintf ("openssl asn1parse -offset %d -length %d -inform der -in /bin/ls\n",
|
||||
(int)data + idx.offset + 8, (int)length);
|
||||
eprintf ("pFp@%d!%d\n",
|
||||
|
@ -577,25 +577,24 @@ R_API bool r_core_bin_load(RCore *r, const char *filenameuri, ut64 baddr) {
|
||||
r->bin->maxstrbuf = r_config_get_i (r->config, "bin.maxstrbuf");
|
||||
} else if (binfile) {
|
||||
obj = r_bin_get_object (r->bin);
|
||||
va = obj->info ? obj->info->has_va : va;
|
||||
if (obj) {
|
||||
va = obj->info ? obj->info->has_va : va;
|
||||
if (!va) {
|
||||
r_config_set_i (r->config, "io.va", 0);
|
||||
}
|
||||
//workaround to map correctly malloc:// and raw binaries
|
||||
if (r_io_desc_is_dbg (desc) || (!obj->sections || !va)) {
|
||||
r_io_map_new (r->io, desc->fd, desc->flags, 0, laddr, r_io_desc_size (desc));
|
||||
}
|
||||
|
||||
if (!va) {
|
||||
r_config_set_i (r->config, "io.va", 0);
|
||||
}
|
||||
|
||||
//workaround to map correctly malloc:// and raw binaries
|
||||
if (r_io_desc_is_dbg (desc) || (obj && (!obj->sections || !va))) {
|
||||
r_io_map_new (r->io, desc->fd, desc->flags, 0, laddr, r_io_desc_size (desc));
|
||||
}
|
||||
|
||||
RBinInfo *info = obj? obj->info: NULL;
|
||||
if (info) {
|
||||
r_core_bin_set_arch_bits (r, binfile->file,
|
||||
info->arch, info->bits);
|
||||
} else {
|
||||
r_core_bin_set_arch_bits (r, binfile->file,
|
||||
RBinInfo *info = obj->info;
|
||||
if (info) {
|
||||
r_core_bin_set_arch_bits (r, binfile->file, info->arch, info->bits);
|
||||
} else {
|
||||
r_core_bin_set_arch_bits (r, binfile->file,
|
||||
r_config_get (r->config, "asm.arch"),
|
||||
r_config_get_i (r->config, "asm.bits"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -415,34 +415,32 @@ static int cmd_uname(void *data, const char *input) {
|
||||
}
|
||||
|
||||
static int cmd_alias(void *data, const char *input) {
|
||||
int i;
|
||||
char *def, *q, *desc, *buf;
|
||||
RCore *core = (RCore *)data;
|
||||
if (*input == '?') {
|
||||
r_core_cmd_help (core, help_msg_dollar);
|
||||
return 0;
|
||||
}
|
||||
i = strlen (input);
|
||||
buf = malloc (i + 2);
|
||||
int i = strlen (input);
|
||||
char *buf = malloc (i + 2);
|
||||
if (!buf) {
|
||||
return 0;
|
||||
}
|
||||
*buf = '$'; // prefix aliases with a dash
|
||||
memcpy (buf + 1, input, i + 1);
|
||||
q = strchr (buf, ' ');
|
||||
def = strchr (buf, '=');
|
||||
desc = strchr (buf, '?');
|
||||
char *q = strchr (buf, ' ');
|
||||
char *def = strchr (buf, '=');
|
||||
char *desc = strchr (buf, '?');
|
||||
|
||||
/* create alias */
|
||||
if ((def && q && (def < q)) || (def && !q)) {
|
||||
*def++ = 0;
|
||||
size_t len = strlen (def);
|
||||
/* Remove quotes */
|
||||
if ((def[0] == '\'') && (def[len - 1] == '\'')) {
|
||||
if (len > 0 && (def[0] == '\'') && (def[len - 1] == '\'')) {
|
||||
def[len - 1] = 0x00;
|
||||
def++;
|
||||
}
|
||||
if (!q || (q && q>def)) {
|
||||
if (!q || (q && q > def)) {
|
||||
if (*def) {
|
||||
r_cmd_alias_set (core->rcmd, buf, def, 0);
|
||||
} else {
|
||||
@ -491,7 +489,7 @@ static int cmd_alias(void *data, const char *input) {
|
||||
r_core_cmd0 (core, out);
|
||||
free (out);
|
||||
} else {
|
||||
eprintf ("cannot malloc\n");
|
||||
eprintf ("Cannot malloc\n");
|
||||
}
|
||||
} else {
|
||||
r_core_cmd0 (core, v);
|
||||
@ -590,10 +588,8 @@ static int cmd_rap(void *data, const char *input) {
|
||||
if (input[1] == '?') {
|
||||
r_core_cmd_help (core, help_msg_equalh);
|
||||
} else {
|
||||
while (input[1] == ' ') {
|
||||
input++;
|
||||
}
|
||||
r_core_rtr_http (core, getArg (input[1], 'H'), 'H', input + 1);
|
||||
const char *arg = r_str_trim_ro (input + 1);
|
||||
r_core_rtr_http (core, getArg (input[1], 'H'), 'H', arg);
|
||||
}
|
||||
break;
|
||||
case '?': // "=?"
|
||||
|
@ -166,6 +166,7 @@ static const char *help_msg_question[] = {
|
||||
|
||||
static const char *help_msg_question_v[] = {
|
||||
"Usage: ?v [$.]","","",
|
||||
"flag", "", "offset of flag",
|
||||
"$$", "", "here (current virtual seek)",
|
||||
"$$$", "", "current non-temporary virtual seek",
|
||||
"$?", "", "last comparison value",
|
||||
@ -209,6 +210,7 @@ static const char *help_msg_question_v[] = {
|
||||
"$r{reg}", "", "get value of named register",
|
||||
"$k{kv}", "", "get value of an sdb query value",
|
||||
"$s{flag}", "", "get size of flag",
|
||||
"$e{flag}", "", "end of flag (flag->offset + flag->size)",
|
||||
"RNum", "", "$variables usable in math expressions",
|
||||
NULL
|
||||
};
|
||||
|
@ -438,7 +438,7 @@ static ut64 num_callback(RNum *userptr, const char *str, int *ok) {
|
||||
}
|
||||
switch (*str) {
|
||||
case '.':
|
||||
if (core->num->nc.curr_tok=='+') {
|
||||
if (core->num->nc.curr_tok == '+') {
|
||||
ut64 off = core->num->nc.number_value.n;
|
||||
if (!off) {
|
||||
off = core->offset;
|
||||
@ -559,6 +559,7 @@ static ut64 num_callback(RNum *userptr, const char *str, int *ok) {
|
||||
free (bptr);
|
||||
return ret;
|
||||
}
|
||||
// take flag here
|
||||
free (bptr);
|
||||
break;
|
||||
case 'c': // $c console width
|
||||
@ -585,6 +586,19 @@ static ut64 num_callback(RNum *userptr, const char *str, int *ok) {
|
||||
}
|
||||
break;
|
||||
case 'e': // $e
|
||||
if (str[2] == '{') { // $e{flag} flag off + size
|
||||
char *flagName = strdup (str + 3);
|
||||
int flagLength = strlen (flagName);
|
||||
if (flagLength > 0) {
|
||||
flagName[flagLength - 1] = 0;
|
||||
}
|
||||
RFlagItem *flag = r_flag_get (core->flags, flagName);
|
||||
free (flagName);
|
||||
if (flag) {
|
||||
return flag->offset + flag->size;
|
||||
}
|
||||
return UT64_MAX;
|
||||
}
|
||||
return r_anal_op_is_eob (&op);
|
||||
case 'j': // $j jump address
|
||||
return op.jump;
|
||||
@ -621,9 +635,8 @@ static ut64 num_callback(RNum *userptr, const char *str, int *ok) {
|
||||
}
|
||||
if (str[2] == 'M') {
|
||||
return size;
|
||||
} else {
|
||||
return (lower == UT64_MAX)? 0LL: lower;
|
||||
}
|
||||
return (lower == UT64_MAX)? 0LL: lower;
|
||||
}
|
||||
break;
|
||||
case 'v': // $v immediate value
|
||||
@ -747,8 +760,7 @@ static ut64 num_callback(RNum *userptr, const char *str, int *ok) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (ok) {
|
||||
*ok = true;
|
||||
}
|
||||
|
@ -2273,6 +2273,7 @@ static void loadPanelsLayout(RCore* core) {
|
||||
p += strlen (p) + 1;
|
||||
}
|
||||
free (panelsConfig);
|
||||
free (configPath);
|
||||
}
|
||||
|
||||
static void maximizePanelSize(RPanels *panels) {
|
||||
|
Loading…
Reference in New Issue
Block a user