mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 19:47:31 +00:00
Shorten local var and type name ##types
This commit is contained in:
parent
3423b1f563
commit
dafbf2df35
@ -5,9 +5,6 @@
|
||||
#include <r_list.h>
|
||||
#include <r_core.h>
|
||||
|
||||
#define VARPREFIX "local"
|
||||
#define ARGPREFIX "arg"
|
||||
|
||||
#define USE_SDB_CACHE 0
|
||||
#define SDB_KEY_BB "bb.0x%"PFMT64x ".0x%"PFMT64x
|
||||
// XXX must be configurable by the user
|
||||
|
@ -564,8 +564,6 @@ static void var_add_structure_fields_to_list(RAnal *a, RAnalVar *av, const char
|
||||
}
|
||||
}
|
||||
|
||||
#define VARPREFIX "local"
|
||||
#define ARGPREFIX "arg"
|
||||
|
||||
//Variable recovery functions
|
||||
static char *get_varname(RAnal *a, RAnalFunction *fcn, char type, const char *pfx, int idx) {
|
||||
|
@ -57,8 +57,8 @@ static void var_rename(RAnal *anal, RAnalVar *v, const char *name, ut64 addr) {
|
||||
if (!*name || !strcmp (name , "...")) {
|
||||
return;
|
||||
}
|
||||
bool is_default = (!strncmp (v->name, "local_", 6)
|
||||
|| !strncmp (v->name, "arg_", 4))? true: false;
|
||||
bool is_default = (r_str_startswith (v->name, VARPREFIX)
|
||||
|| r_str_startswith (v->name, ARGPREFIX))? true: false;
|
||||
if (*name == '*') {
|
||||
name++;
|
||||
}
|
||||
@ -86,7 +86,13 @@ static void var_retype(RAnal *anal, RAnalVar *var, const char *vname, char *type
|
||||
// default or void type
|
||||
return;
|
||||
}
|
||||
const char *tmp = strstr (var->type, "int");
|
||||
const char *expand = var->type;
|
||||
if (!strcmp(var->type, "uint32_t")) {
|
||||
expand = "unsigned int";
|
||||
} else if (!strcmp(var->type, "uint64_t")) {
|
||||
expand = "unsigned long long";
|
||||
}
|
||||
const char *tmp = strstr (expand, "int");
|
||||
bool is_default = tmp? true: false;
|
||||
if (!is_default && strncmp (var->type, "void", 4)) {
|
||||
// return since type is already propgated
|
||||
@ -120,6 +126,13 @@ static void var_retype(RAnal *anal, RAnalVar *var, const char *vname, char *type
|
||||
r_strbuf_append (sb, " *");
|
||||
}
|
||||
}
|
||||
|
||||
char* tmp1 = r_strbuf_get (sb);
|
||||
if (r_str_startswith(tmp1, "unsigned long long")) {
|
||||
r_strbuf_set (sb, "uint64_t");
|
||||
} else if (r_str_startswith(tmp1, "unsigned")) {
|
||||
r_strbuf_set (sb, "uint32_t");
|
||||
}
|
||||
r_anal_var_retype (anal, addr, 1, var->delta, var->kind, r_strbuf_get (sb), var->size, var->isarg, var->name);
|
||||
r_strbuf_free (sb);
|
||||
}
|
||||
|
@ -752,6 +752,9 @@ typedef struct r_anal_var_access_t {
|
||||
#define R_ANAL_VAR_KIND_BPV 'b'
|
||||
#define R_ANAL_VAR_KIND_SPV 's'
|
||||
|
||||
#define VARPREFIX "var"
|
||||
#define ARGPREFIX "arg"
|
||||
|
||||
// generic for args and locals
|
||||
typedef struct r_anal_var_t {
|
||||
char *name; /* name of the variable */
|
||||
|
Loading…
Reference in New Issue
Block a user