Rename asm.{off} variables to asm.offset ##shell

This commit is contained in:
pancake 2022-07-02 01:50:26 +02:00 committed by pancake
parent 5600f4b941
commit 5ee08839ff
7 changed files with 25 additions and 25 deletions

View File

@ -317,7 +317,7 @@ static bool ranal2_list(RCore *core, const char *arch, int fmt) {
static inline void __setsegoff(RConfig *cfg, const char *asmarch, int asmbits) {
int autoseg = r_str_startswith (asmarch, "x86") && asmbits == 16;
r_config_set (cfg, "asm.segoff", r_str_bool (autoseg));
r_config_set (cfg, "asm.offset.segment", r_str_bool (autoseg));
}
static bool cb_debug_hitinfo(void *user, void *data) {
@ -2651,7 +2651,7 @@ static bool cb_segoff(void *user, void *data) {
return true;
}
static bool cb_seggrn(void *user, void *data) {
static bool cb_asm_offset_segment_bits(void *user, void *data) {
RCore *core = (RCore *) user;
RConfigNode *node = (RConfigNode *) data;
core->rasm->config->seggrn = node->i_value;
@ -3352,7 +3352,7 @@ R_API int r_core_config_init(RCore *core) {
SETCB ("anal.verbose", "false", &cb_analverbose, "show RAnal warnings when analyzing code");
SETBPREF ("anal.a2f", "false", "use the new WIP analysis algorithm (core/p/a2f), anal.depth ignored atm");
SETCB ("anal.roregs", "gp,zero", (RConfigCallback)&cb_anal_roregs, "comma separated list of register names to be readonly");
SETICB ("anal.cs", 0, (RConfigCallback)&cb_anal_cs, "set the value for the x86-16 CS segment register (see asm.seggrn and asm.segoff)");
SETICB ("anal.cs", 0, (RConfigCallback)&cb_anal_cs, "set the value for the x86-16 CS segment register (see asm.offset.segment and asm.offset.segment.bits)");
SETICB ("anal.gp", 0, (RConfigCallback)&cb_anal_gp, "set the value of the GP register (MIPS)");
SETBPREF ("anal.gpfixed", "true", "set gp register to anal.gp before emulating each instruction in aae");
SETCB ("anal.limits", "false", (RConfigCallback)&cb_anal_limits, "restrict analysis to address range [anal.from:anal.to]");
@ -3553,14 +3553,17 @@ R_API int r_core_config_init(RCore *core) {
SETBPREF ("asm.middle", "false", "allow disassembling jumps in the middle of an instruction");
SETBPREF ("asm.bbmiddle", "true", "realign disassembly if a basic block starts in the middle of an instruction");
SETBPREF ("asm.noisy", "true", "show comments considered noisy but possibly useful");
SETBPREF ("asm.offset", "true", "show offsets in disassembly");
SETBPREF ("hex.offset", "true", "show offsets in hex-dump");
SETBPREF ("scr.square", "true", "use square pixels or not");
SETCB ("scr.wideoff", "false", &cb_scr_wideoff, "adjust offsets to match asm.bits");
SETCB ("scr.rainbow", "false", &cb_scrrainbow, "shows rainbow colors depending of address");
SETCB ("scr.last", "true", &cb_scrlast, "cache last output after flush to make _ command work (disable for performance)");
SETBPREF ("asm.reloff", "false", "show relative offsets instead of absolute address in disasm");
SETBPREF ("asm.reloff.flags", "false", "show relative offsets to flags (not only functions)");
SETBPREF ("asm.offset", "true", "show offsets in disassembly");
SETCB ("asm.offset.segment", "false", &cb_segoff, "show segmented address in prompt (x86-16)");
SETICB ("asm.offset.segment.bits", 4, &cb_asm_offset_segment_bits, "segment granularity in bits (x86-16)");
SETCB ("asm.offset.base10", "false", &cb_decoff, "show address in base 10 instead of hexadecimal");
SETBPREF ("asm.offset.relative", "false", "show relative offsets instead of absolute address in disasm");
SETBPREF ("asm.offset.flags", "false", "show relative offsets to flags (not only functions)");
SETBPREF ("asm.section", "false", "show section name before offset");
SETBPREF ("asm.section.perm", "false", "show section permissions in the disasm");
SETBPREF ("asm.section.name", "true", "show section name in the disasm");
@ -3605,9 +3608,6 @@ R_API int r_core_config_init(RCore *core) {
n = NODECB ("asm.parser", "x86.pseudo", &cb_asmparser);
SETDESC (n, "set the asm parser to use");
update_asmparser_options (core, n);
SETCB ("asm.segoff", "false", &cb_segoff, "show segmented address in prompt (x86-16)");
SETCB ("asm.decoff", "false", &cb_decoff, "show segmented address in prompt (x86-16)");
SETICB ("asm.seggrn", 4, &cb_seggrn, "segment granularity in bits (x86-16)");
n = NODECB ("asm.syntax", "intel", &cb_asmsyntax);
SETDESC (n, "select assembly syntax");
SETOPTIONS (n, "att", "intel", "masm", "jz", "regnum", NULL);

View File

@ -1132,7 +1132,7 @@ R_API void r_core_set_asm_configs(RCore *core, char *arch, ut32 bits, int segoff
r_config_set_i (core->config, "asm.bits", bits);
// XXX - this needs to be done here, because
// if arch == x86 and bits == 16, segoff automatically changes
r_config_set_i (core->config, "asm.segoff", segoff);
r_config_set_i (core->config, "asm.offset.segment", segoff);
}
static int cmd_pdu(RCore *core, const char *input) {

View File

@ -3416,9 +3416,9 @@ static void set_prompt(RCore *r) {
}
// TODO: also in visual prompt and disasm/hexdump ?
if (r_config_get_i (r->config, "asm.segoff")) {
if (r_config_get_b (r->config, "asm.offset.segment")) {
ut32 sb = r_config_get_i (r->config, "anal.cs"); // segment base value
ut32 sg = r_config_get_i (r->config, "asm.seggrn"); // segment granurality
ut32 sg = r_config_get_i (r->config, "asm.offset.segment.bits"); // segment granurality
ut32 a, b;
r_num_segaddr (r->offset, sb, sg, &a, &b);
snprintf (tmp, sizeof (tmp), "%04x:%04x", a, b);

View File

@ -707,7 +707,7 @@ static RDisasmState *ds_init(RCore *core) {
ds->asm_demangle = r_config_get_i (core->config, "asm.demangle");
ds->asm_describe = r_config_get_i (core->config, "asm.describe");
ds->show_offset = r_config_get_i (core->config, "asm.offset");
ds->show_offdec = r_config_get_i (core->config, "asm.decoff");
ds->show_offdec = r_config_get_i (core->config, "asm.offset.base10");
ds->show_bbline = r_config_get_i (core->config, "asm.lines.bb");
ds->show_section = r_config_get_i (core->config, "asm.section");
ds->show_section_col = r_config_get_i (core->config, "asm.section.col");
@ -744,7 +744,7 @@ static RDisasmState *ds_init(RCore *core) {
}
}
ds->stackptr = core->anal->stackptr;
ds->show_offseg = r_config_get_i (core->config, "asm.segoff");
ds->show_offseg = r_config_get_b (core->config, "asm.offset.segment");
ds->show_flags = r_config_get_b (core->config, "asm.flags");
ds->show_bytes = r_config_get_b (core->config, "asm.bytes");
ds->show_bytes_right = r_config_get_i (core->config, "asm.bytes.right");
@ -752,8 +752,8 @@ static RDisasmState *ds_init(RCore *core) {
ds->show_optype = r_config_get_i (core->config, "asm.optype");
ds->asm_meta = r_config_get_i (core->config, "asm.meta");
ds->asm_xrefs_code = r_config_get_i (core->config, "asm.xrefs.code");
ds->show_reloff = r_config_get_i (core->config, "asm.reloff");
ds->show_reloff_flags = r_config_get_i (core->config, "asm.reloff.flags");
ds->show_reloff = r_config_get_i (core->config, "asm.offset.relative");
ds->show_reloff_flags = r_config_get_i (core->config, "asm.offset.flags");
ds->show_lines_fcn = ds->show_lines ? r_config_get_i (core->config, "asm.lines.fcn") : false;
ds->show_comments = r_config_get_i (core->config, "asm.comments");
ds->show_usercomments = r_config_get_i (core->config, "asm.usercomments");

View File

@ -208,7 +208,7 @@ FILE=malloc://2048
CMDS=<<EOF
e asm.arch=x86
e asm.bits=16
e asm.seggrn=8
e asm.offset.segment.bits=8
s 0x400
wx 9090558becea000004005dc3
pd 1 @ 0x405
@ -223,7 +223,7 @@ FILE=malloc://2048
CMDS=<<EOF
e asm.arch=x86
e asm.bits=16
e asm.seggrn=8
e asm.offset.segment.bits=8
s 0x400
wx 558becea000004005dc3
af funcA @ 0x400
@ -239,7 +239,7 @@ FILE=malloc://2048
CMDS=<<EOF
e asm.arch=x86
e asm.bits=16
e asm.seggrn=8
e asm.segmen.bits=8
s 0x400
wx 9090558bec9a000004005dc3
pd 1 @ 0x405
@ -254,7 +254,7 @@ FILE=malloc://2048
CMDS=<<EOF
e asm.arch=x86
e asm.bits=16
e asm.seggrn=8
e asm.offset.segment.bits=8
s 0x400
wx 558bec9a000004005dc3
af funcA @ 0x400

View File

@ -34,7 +34,7 @@ NAME=pd+reloff+colors
FILE=bins/elf/analysis/ls-alxchk
CMDS=<<EOF
af
e asm.reloff=true
e asm.offset.relative=true
pd 10
e scr.color=1
pd 10

View File

@ -5,16 +5,16 @@ e asm.arch=x86
e asm.bits=16
?e true
pd 1~[0]
e asm.segoff=true
e asm.offset.segment=true
?e true
pd 1~[0]
e asm.segoff=true
e asm.offset.segment=true
?e true
pd 1~[0]
e asm.segoff=false
e asm.offset.segment=false
?e false
pd 1~[0]
e asm.segoff=true
e asm.offset.segment=true
?e true
pd 1~[0]
EOF