mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-26 17:15:38 +00:00
Put archinfo.{minopsz,maxopsz,align} in the output of i ##bin
* Does not requires rbin to work, its tied to RAnal which is global
This commit is contained in:
parent
c0383784d4
commit
f7252d11be
@ -803,8 +803,6 @@ static int bin_info(RCore *r, PJ *pj, int mode, ut64 laddr) {
|
||||
return false;
|
||||
}
|
||||
RBinObject *obj = bf->o;
|
||||
const char *compiled = NULL;
|
||||
bool havecode;
|
||||
|
||||
if (!info || !obj) {
|
||||
if (IS_MODE_JSON (mode)) {
|
||||
@ -814,8 +812,8 @@ static int bin_info(RCore *r, PJ *pj, int mode, ut64 laddr) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
havecode = is_executable (obj) | (obj->entries != NULL);
|
||||
compiled = get_compile_time (bf->sdb);
|
||||
bool havecode = is_executable (obj) | (obj->entries != NULL);
|
||||
const char *compiled = get_compile_time (bf->sdb);
|
||||
|
||||
if (IS_MODE_SET (mode)) {
|
||||
r_config_set (r->config, "file.type", info->rclass);
|
||||
@ -843,10 +841,6 @@ static int bin_info(RCore *r, PJ *pj, int mode, ut64 laddr) {
|
||||
r_config_set (r->config, "asm.bits", str);
|
||||
r_config_set (r->config, "asm.dwarf",
|
||||
(R_BIN_DBG_STRIPPED & info->dbg_info) ? "false" : "true");
|
||||
v = r_anal_archinfo (r->anal, R_ANAL_ARCHINFO_ALIGN);
|
||||
if (v != -1) {
|
||||
r_config_set_i (r->config, "asm.pcalign", v);
|
||||
}
|
||||
}
|
||||
r_core_anal_type_init (r);
|
||||
r_core_anal_cc_init (r);
|
||||
@ -861,18 +855,6 @@ static int bin_info(RCore *r, PJ *pj, int mode, ut64 laddr) {
|
||||
r_cons_printf ("bits %d\n", info->bits);
|
||||
r_cons_printf ("os %s\n", info->os);
|
||||
r_cons_printf ("endian %s\n", info->big_endian? "big": "little");
|
||||
v = r_anal_archinfo (r->anal, R_ANAL_ARCHINFO_MIN_OP_SIZE);
|
||||
if (v != -1) {
|
||||
r_cons_printf ("minopsz %d\n", v);
|
||||
}
|
||||
v = r_anal_archinfo (r->anal, R_ANAL_ARCHINFO_MAX_OP_SIZE);
|
||||
if (v != -1) {
|
||||
r_cons_printf ("maxopsz %d\n", v);
|
||||
}
|
||||
v = r_anal_archinfo (r->anal, R_ANAL_ARCHINFO_ALIGN);
|
||||
if (v != -1) {
|
||||
r_cons_printf ("pcalign %d\n", v);
|
||||
}
|
||||
} else if (IS_MODE_RAD (mode)) {
|
||||
if (info->type && !strcmp (info->type, "fs")) {
|
||||
r_cons_printf ("e file.type=fs\n");
|
||||
@ -884,6 +866,8 @@ static int bin_info(RCore *r, PJ *pj, int mode, ut64 laddr) {
|
||||
r_str_bool (info->big_endian),
|
||||
info->bits,
|
||||
r_str_bool (R_BIN_DBG_STRIPPED &info->dbg_info));
|
||||
int v = r_anal_archinfo (r->anal, R_ANAL_ARCHINFO_ALIGN);
|
||||
r_cons_printf ("e asm.pcalign=%d\n", (v > 0)? v: 0);
|
||||
if (info->lang && *info->lang) {
|
||||
r_cons_printf ("e bin.lang=%s\n", info->lang);
|
||||
}
|
||||
@ -903,10 +887,6 @@ static int bin_info(RCore *r, PJ *pj, int mode, ut64 laddr) {
|
||||
if (info->default_cc) {
|
||||
r_cons_printf ("e anal.cc=%s", info->default_cc);
|
||||
}
|
||||
v = r_anal_archinfo (r->anal, R_ANAL_ARCHINFO_ALIGN);
|
||||
if (v != -1) {
|
||||
r_cons_printf ("e asm.pcalign=%d\n", v);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// XXX: if type is 'fs' show something different?
|
||||
@ -955,24 +935,12 @@ static int bin_info(RCore *r, PJ *pj, int mode, ut64 laddr) {
|
||||
pair_bool (pj, "linenum", R_BIN_DBG_LINENUMS & info->dbg_info);
|
||||
pair_bool (pj, "lsyms", R_BIN_DBG_SYMS & info->dbg_info);
|
||||
pair_str (pj, "machine", info->machine);
|
||||
v = r_anal_archinfo (r->anal, R_ANAL_ARCHINFO_MAX_OP_SIZE);
|
||||
if (v != -1) {
|
||||
pair_int (pj, "maxopsz", v);
|
||||
}
|
||||
v = r_anal_archinfo (r->anal, R_ANAL_ARCHINFO_MIN_OP_SIZE);
|
||||
if (v != -1) {
|
||||
pair_int (pj, "minopsz", v);
|
||||
}
|
||||
pair_bool (pj, "nx", info->has_nx);
|
||||
pair_str (pj, "os", info->os);
|
||||
if (info->rclass && !strcmp (info->rclass, "pe")) {
|
||||
pair_bool (pj, "overlay", info->pe_overlay);
|
||||
}
|
||||
pair_str (pj, "cc", info->default_cc);
|
||||
v = r_anal_archinfo (r->anal, R_ANAL_ARCHINFO_ALIGN);
|
||||
if (v != -1) {
|
||||
pair_int (pj, "pcalign", v);
|
||||
}
|
||||
pair_bool (pj, "pic", info->has_pi);
|
||||
pair_bool (pj, "relocs", R_BIN_DBG_RELOCS & info->dbg_info);
|
||||
Sdb *sdb_info = sdb_ns (obj->kv, "info", false);
|
||||
@ -986,7 +954,7 @@ static int bin_info(RCore *r, PJ *pj, int mode, ut64 laddr) {
|
||||
//this should be moved if added to mach0 (or others)
|
||||
pair_bool (pj, "signed", info->signature);
|
||||
}
|
||||
pair_bool (pj, "sanitiz", info->has_sanitizers);
|
||||
pair_bool (pj, "sanitize", info->has_sanitizers);
|
||||
pair_bool (pj, "static", r_bin_is_static (r->bin));
|
||||
if (info->rclass && !strcmp (info->rclass, "mdmp")) {
|
||||
v = sdb_num_get (bf->sdb, "mdmp.streams", 0);
|
||||
|
@ -5534,6 +5534,7 @@ R_API char *r_core_cmd_str(RCore *core, const char *cmd) {
|
||||
r_cons_singleton ()->noflush = false;
|
||||
r_cons_flush ();
|
||||
}
|
||||
r_cons_pop ();
|
||||
return NULL;
|
||||
}
|
||||
if (--core->in_cmdstr == 0) {
|
||||
|
@ -252,6 +252,18 @@ static void r_core_file_info(RCore *core, PJ *pj, int mode) {
|
||||
pj_ks (pj, "referer", desc->referer);
|
||||
}
|
||||
}
|
||||
int v = r_anal_archinfo (core->anal, R_ANAL_ARCHINFO_MIN_OP_SIZE);
|
||||
if (v > 0) {
|
||||
pj_ki (pj, "minopsz", v);
|
||||
}
|
||||
v = r_anal_archinfo (core->anal, R_ANAL_ARCHINFO_MAX_OP_SIZE);
|
||||
if (v > 0) {
|
||||
pj_ki (pj, "maxopsz", v);
|
||||
}
|
||||
v = r_anal_archinfo (core->anal, R_ANAL_ARCHINFO_ALIGN);
|
||||
if (v > 0) {
|
||||
pj_ki (pj, "pcalign", v);
|
||||
}
|
||||
pj_ki (pj, "block", core->blocksize);
|
||||
if (binfile) {
|
||||
if (binfile->curxtr) {
|
||||
@ -282,6 +294,18 @@ static void r_core_file_info(RCore *core, PJ *pj, int mode) {
|
||||
pair ("humansz", humansz);
|
||||
}
|
||||
}
|
||||
int v = r_anal_archinfo (core->anal, R_ANAL_ARCHINFO_MIN_OP_SIZE);
|
||||
if (v > 0) {
|
||||
pair ("minopsz", sdb_fmt ("%d", v));
|
||||
}
|
||||
v = r_anal_archinfo (core->anal, R_ANAL_ARCHINFO_MAX_OP_SIZE);
|
||||
if (v > 0) {
|
||||
pair ("maxopsz", sdb_fmt ("%d", v));
|
||||
}
|
||||
v = r_anal_archinfo (core->anal, R_ANAL_ARCHINFO_ALIGN);
|
||||
if (v > 0) {
|
||||
pair ("pcalign", sdb_fmt ("%d", v));
|
||||
}
|
||||
if (desc) {
|
||||
pair ("mode", r_str_rwx_i (desc->perm & R_PERM_RWX));
|
||||
}
|
||||
@ -467,7 +491,7 @@ static int cmd_info(void *data, const char *input) {
|
||||
if (!strncmp (input, "zzz", 3)) {
|
||||
is_izzzj = true;
|
||||
}
|
||||
if (!strncmp(input, "dpi", 3)) {
|
||||
if (!strncmp (input, "dpi", 3)) {
|
||||
is_idpij = true;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,9 @@ fd 3
|
||||
file bins/s390/zos/prueba/prueba
|
||||
size 0x11000
|
||||
humansz 68K
|
||||
minopsz 2
|
||||
maxopsz 6
|
||||
pcalign 2
|
||||
mode r-x
|
||||
format off
|
||||
iorw false
|
||||
@ -27,14 +30,11 @@ laddr 0x0
|
||||
linenum false
|
||||
lsyms false
|
||||
machine s360
|
||||
maxopsz 6
|
||||
minopsz 2
|
||||
nx false
|
||||
os Z/OS
|
||||
pcalign 2
|
||||
pic false
|
||||
relocs false
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static true
|
||||
stripped false
|
||||
va false
|
||||
|
@ -213,6 +213,8 @@ fd 3
|
||||
file malloc://1025
|
||||
size 0x401
|
||||
humansz 1.0K
|
||||
minopsz 1
|
||||
maxopsz 16
|
||||
mode rwx
|
||||
format any
|
||||
iorw true
|
||||
@ -227,13 +229,10 @@ havecode false
|
||||
laddr 0x0
|
||||
linenum false
|
||||
lsyms false
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx false
|
||||
pcalign 0
|
||||
pic false
|
||||
relocs false
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static true
|
||||
stripped false
|
||||
va false
|
||||
@ -289,6 +288,8 @@ fd 3
|
||||
file malloc://1024
|
||||
size 0x400
|
||||
humansz 1K
|
||||
minopsz 1
|
||||
maxopsz 16
|
||||
mode rwx
|
||||
format any
|
||||
iorw true
|
||||
@ -307,13 +308,10 @@ havecode false
|
||||
laddr 0x0
|
||||
linenum false
|
||||
lsyms false
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx false
|
||||
pcalign 0
|
||||
pic false
|
||||
relocs false
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static true
|
||||
stripped false
|
||||
va false
|
||||
@ -331,6 +329,8 @@ EXPECT=<<EOF
|
||||
fd 3
|
||||
size 0x1323
|
||||
humansz 4.8K
|
||||
minopsz 1
|
||||
maxopsz 16
|
||||
mode r-x
|
||||
format elf
|
||||
iorw false
|
||||
@ -352,16 +352,13 @@ lang c
|
||||
linenum true
|
||||
lsyms true
|
||||
machine Intel 80386
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx true
|
||||
os linux
|
||||
pcalign 0
|
||||
pic false
|
||||
relocs true
|
||||
relro no
|
||||
rpath NONE
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static false
|
||||
stripped false
|
||||
subsys linux
|
||||
@ -446,7 +443,7 @@ nx false
|
||||
os any
|
||||
pic false
|
||||
relocs false
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static false
|
||||
stripped false
|
||||
subsys any
|
||||
@ -1238,9 +1235,6 @@ arch arm
|
||||
bits 16
|
||||
os linux
|
||||
endian little
|
||||
minopsz 2
|
||||
maxopsz 4
|
||||
pcalign 2
|
||||
EOF
|
||||
RUN
|
||||
|
||||
@ -1252,9 +1246,6 @@ arch arm
|
||||
bits 16
|
||||
os linux
|
||||
endian little
|
||||
minopsz 2
|
||||
maxopsz 4
|
||||
pcalign 2
|
||||
__cxa_finalize
|
||||
__cxa_atexit
|
||||
malloc
|
||||
@ -1560,16 +1551,13 @@ lang c
|
||||
linenum true
|
||||
lsyms true
|
||||
machine Intel 80386
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx true
|
||||
os linux
|
||||
pcalign 0
|
||||
pic false
|
||||
relocs true
|
||||
relro no
|
||||
rpath NONE
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static false
|
||||
stripped false
|
||||
subsys linux
|
||||
@ -1602,17 +1590,14 @@ EXPECT=<<EOF
|
||||
"linenum": true,
|
||||
"lsyms": true,
|
||||
"machine": "Intel 80386",
|
||||
"maxopsz": 16,
|
||||
"minopsz": 1,
|
||||
"nx": true,
|
||||
"os": "linux",
|
||||
"cc": "",
|
||||
"pcalign": 0,
|
||||
"pic": false,
|
||||
"relocs": true,
|
||||
"relro": "no",
|
||||
"rpath": "NONE",
|
||||
"sanitiz": false,
|
||||
"sanitize": false,
|
||||
"static": false,
|
||||
"stripped": false,
|
||||
"subsys": "linux",
|
||||
@ -3077,6 +3062,8 @@ EXPECT=<<EOF
|
||||
fd 3
|
||||
size 0x1a36
|
||||
humansz 6.6K
|
||||
minopsz 1
|
||||
maxopsz 16
|
||||
mode r-x
|
||||
format elf64
|
||||
iorw false
|
||||
@ -3099,16 +3086,13 @@ lang c
|
||||
linenum true
|
||||
lsyms true
|
||||
machine AMD x86-64 architecture
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx true
|
||||
os linux
|
||||
pcalign 0
|
||||
pic false
|
||||
relocs true
|
||||
relro no
|
||||
rpath NONE
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static false
|
||||
stripped false
|
||||
subsys linux
|
||||
@ -3191,16 +3175,13 @@ lang c
|
||||
linenum true
|
||||
lsyms true
|
||||
machine AMD x86-64 architecture
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx true
|
||||
os linux
|
||||
pcalign 0
|
||||
pic false
|
||||
relocs true
|
||||
relro no
|
||||
rpath NONE
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static false
|
||||
stripped false
|
||||
subsys linux
|
||||
@ -3538,6 +3519,8 @@ EXPECT=<<EOF
|
||||
fd 3
|
||||
size 0x1a36
|
||||
humansz 6.6K
|
||||
minopsz 1
|
||||
maxopsz 16
|
||||
mode r-x
|
||||
iorw false
|
||||
block 0x100
|
||||
|
@ -446,6 +446,8 @@ fd 3
|
||||
file bins/elf/true32
|
||||
size 0x560c
|
||||
humansz 21.5K
|
||||
minopsz 1
|
||||
maxopsz 16
|
||||
mode r-x
|
||||
format elf
|
||||
iorw false
|
||||
@ -467,16 +469,13 @@ lang c
|
||||
linenum false
|
||||
lsyms false
|
||||
machine Intel 80386
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx true
|
||||
os linux
|
||||
pcalign 0
|
||||
pic false
|
||||
relocs false
|
||||
relro partial
|
||||
rpath NONE
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static false
|
||||
stripped true
|
||||
subsys linux
|
||||
@ -486,6 +485,8 @@ fd 3
|
||||
file malloc://512
|
||||
size 0x200
|
||||
humansz 512
|
||||
minopsz 1
|
||||
maxopsz 16
|
||||
mode rwx
|
||||
format any
|
||||
iorw true
|
||||
|
@ -74,6 +74,8 @@ EXPECT=<<EOF
|
||||
fd 3
|
||||
file malloc://1024
|
||||
humansz 1K
|
||||
minopsz 1
|
||||
maxopsz 16
|
||||
mode rwx
|
||||
format any
|
||||
iorw true
|
||||
@ -88,6 +90,8 @@ EXPECT=<<EOF
|
||||
fd 3
|
||||
file malloc://1024
|
||||
humansz 1K
|
||||
minopsz 1
|
||||
maxopsz 16
|
||||
mode rwx
|
||||
format any
|
||||
iorw true
|
||||
@ -102,6 +106,8 @@ EXPECT=<<EOF
|
||||
file malloc://1024
|
||||
size 0x400
|
||||
humansz 1K
|
||||
minopsz 1
|
||||
maxopsz 16
|
||||
mode rwx
|
||||
format any
|
||||
iorw true
|
||||
|
@ -24,14 +24,11 @@ laddr 0x0
|
||||
linenum false
|
||||
lsyms false
|
||||
machine AMD64
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx false
|
||||
os Unknown
|
||||
pcalign 0
|
||||
pic false
|
||||
relocs false
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static true
|
||||
stripped false
|
||||
va true
|
||||
|
@ -429,7 +429,7 @@ os linux
|
||||
pic false
|
||||
relocs true
|
||||
rpath NONE
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static true
|
||||
stripped false
|
||||
subsys linux
|
||||
|
@ -10,6 +10,9 @@ fd 3
|
||||
file bins/v850/ired_v850
|
||||
size 0xedeb8
|
||||
humansz 951.7K
|
||||
minopsz 2
|
||||
maxopsz 8
|
||||
pcalign 2
|
||||
mode r-x
|
||||
format elf
|
||||
iorw false
|
||||
@ -31,15 +34,12 @@ lang c
|
||||
linenum true
|
||||
lsyms true
|
||||
machine NEC V800 series
|
||||
maxopsz 8
|
||||
minopsz 2
|
||||
nx false
|
||||
os linux
|
||||
pcalign 2
|
||||
pic false
|
||||
relocs true
|
||||
rpath NONE
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static true
|
||||
stripped false
|
||||
subsys linux
|
||||
|
@ -26,15 +26,12 @@ laddr 0x0
|
||||
linenum false
|
||||
lsyms false
|
||||
machine AMD64
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx false
|
||||
os Windows NT Workstation 6.1.7601
|
||||
pcalign 0
|
||||
pic false
|
||||
relocs false
|
||||
rpath NONE
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static true
|
||||
streams 13
|
||||
stripped false
|
||||
|
@ -23,7 +23,7 @@ nx false
|
||||
os c64
|
||||
pic false
|
||||
relocs false
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static true
|
||||
stripped false
|
||||
va true
|
||||
|
@ -28,7 +28,7 @@ nx false
|
||||
os smd
|
||||
pic false
|
||||
relocs false
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static true
|
||||
stripped false
|
||||
va true
|
||||
|
@ -15,6 +15,9 @@ fd 3
|
||||
file bins/wasm/dotnet.wasm
|
||||
size 0x2ae89a
|
||||
humansz 2.7M
|
||||
minopsz 1
|
||||
maxopsz 1
|
||||
pcalign 1
|
||||
mode r-x
|
||||
format wasm
|
||||
iorw false
|
||||
@ -35,14 +38,11 @@ laddr 0x0
|
||||
linenum false
|
||||
lsyms false
|
||||
machine wasm
|
||||
maxopsz 1
|
||||
minopsz 1
|
||||
nx false
|
||||
os WebAssembly
|
||||
pcalign 1
|
||||
pic false
|
||||
relocs false
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static true
|
||||
stripped false
|
||||
subsys wasm
|
||||
|
@ -632,16 +632,13 @@ lang c
|
||||
linenum true
|
||||
lsyms true
|
||||
machine Intel 80386
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx true
|
||||
os linux
|
||||
pcalign 0
|
||||
pic false
|
||||
relocs true
|
||||
relro no
|
||||
rpath NONE
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static false
|
||||
stripped false
|
||||
subsys linux
|
||||
@ -740,16 +737,13 @@ lang c++
|
||||
linenum true
|
||||
lsyms true
|
||||
machine AMD x86-64 architecture
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx true
|
||||
os linux
|
||||
pcalign 0
|
||||
pic true
|
||||
relocs true
|
||||
relro full
|
||||
rpath NONE
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static false
|
||||
stripped false
|
||||
subsys linux
|
||||
@ -778,16 +772,13 @@ lang c++
|
||||
linenum true
|
||||
lsyms true
|
||||
machine AMD x86-64 architecture
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx true
|
||||
os linux
|
||||
pcalign 0
|
||||
pic false
|
||||
relocs true
|
||||
relro partial
|
||||
rpath NONE
|
||||
sanitiz true
|
||||
sanitize true
|
||||
static false
|
||||
stripped false
|
||||
subsys linux
|
||||
@ -815,14 +806,11 @@ lang c++ with blocks
|
||||
linenum false
|
||||
lsyms false
|
||||
machine x86 64 all
|
||||
maxopsz 16
|
||||
minopsz 1
|
||||
nx false
|
||||
os darwin
|
||||
pcalign 0
|
||||
pic true
|
||||
relocs false
|
||||
sanitiz false
|
||||
sanitize false
|
||||
static false
|
||||
stripped false
|
||||
subsys darwin
|
||||
|
Loading…
x
Reference in New Issue
Block a user