Radare2: Cleanup asm. variables

Created on 4 Apr 2018  Â·  16Comments  Â·  Source: radareorg/radare2

its a bit confusing that asm.filter, asm.relsub asm.varsub, asm.decode... all those vars should have similar name prefixes to be easily spottable because they all work on the string representation of the instruction and improve it by showing flag names instead of offsets and such.

Also, right now we have 44 config keys under asm. this is probably too much :3

FEEDBACK WANTED

All 16 comments

I agree, too many vars all over the place. Some things make sense to let the user choose, others don't.

I think to have a cleaner structure we should add more nested levels of vars, like "asm.cmt" groups all comments related vars.

yep, any proposal?

On 4 Apr 2018, at 13:21, Riccardo Schirone notifications@github.com wrote:

I agree, too many vars all over the place. Some things make sense to let the user choose, others don't.

I think to have a cleaner structure we should add more nested levels of vars, like "asm.cmt" groups all comments related vars.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/radare/radare2/issues/9798#issuecomment-378566561, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3-li6IiXzgcHm2M8_0CAPEQYif7wJjks5tlKzRgaJpZM4TGmWu.

asm.emu.* to emu.*? Less typing

e asm.lines* moved to asm.lines.*

any more changes here? @ret2libc @kazarmy @Maijin @xarkes

here's the current list of asm. variables (which is pretty large)

```
[0x100001200]> e asm.
asm.anal = false
asm.arch = x86
asm.armimm = 0
asm.assembler =
asm.bbline = false
asm.bits = 64
asm.bytes = true
asm.bytespace = false
asm.calls = true
asm.capitalize = false
asm.cmt.col = 55
asm.cmt.flgrefs = true
asm.cmt.fold = false
asm.cmt.off = nodup
asm.cmt.patch = false
asm.cmt.refs = false
asm.cmt.right = true
asm.comments = true
asm.cpu = x86
asm.cycles = false
asm.cyclespace = false
asm.decode = false
asm.decoff = false
asm.demangle = true
asm.describe = false
asm.dwarf = false
asm.dwarf.abspath = false
asm.dwarf.file = true
asm.emu = false
asm.esil = false
asm.family = false
asm.fcncalls = true
asm.fcnlines = true
asm.features =
asm.filter = true
asm.flags = true
asm.flagsinbytes = false
asm.flgoff = false
asm.functions = true
asm.highlight =
asm.hints = false
asm.immstr = false
asm.immtrim = false
asm.indent = false
asm.indentspace = 2
asm.invhex = false
asm.jmphints = true
asm.jmpsub = false
asm.lbytes = true
asm.leahints = false
asm.lines = true
asm.lines.call = false
asm.lines.ret = false
asm.linesout = true
asm.linesright = false
asm.lineswide = false
asm.lineswidth = 7
asm.marks = true
asm.maxrefs = 5
asm.meta = true
asm.midcursor = false
asm.middle = false
asm.midflags = 2
asm.minicols = false
asm.minvalsub = 256
asm.nbytes = 4
asm.nodup = false
asm.noisy = true
asm.offset = true
asm.os = macos
asm.parser = x86.pseudo
asm.payloads = false
asm.pcalign = 0
asm.pseudo = false
asm.reloff = false
asm.reloff.flags = false
asm.relsub = true
asm.section = false
asm.section.col = 20
asm.section.sub = false
asm.seggrn = 4
asm.segoff = false
asm.shortcut = 0
asm.size = false
asm.slow = true
asm.stackptr = false
asm.strenc = guess
asm.strip =
asm.symbol = false
asm.symbol.col = 40
asm.syntax = intel
asm.tabs = 0
asm.tabsoff = 0
asm.tabsonce = false
asm.trace = false
asm.tracespace = false
asm.ucase = false
asm.vars = true
asm.varsub = true
asm.varsub_only = true
asm.varsum = true
asm.varxs = false
asm.xrefs = true
````

asm.vars = true
asm.varsub = true
asm.varsub_only = true
asm.varsum = true
asm.varxs = false

->

asm.var (asm.vars)
asm.var.sub (asm.varsub)
asm.var.subonly (asm.varsub_only)
asm.var.submin (asm.minvalsub)
asm.var.summary (asm.varsum)
asm.var.access (asm.varxs)

i think asm.minvalsub should be under asm.var too

[0x00000000]> e??~var
       asm.minvalsub: Minimum value to substitute in instructions (asm.varsub)
            asm.vars: Show local function variables in disassembly
          asm.varsub: Substitute variables in disassembly
     asm.varsub_only: Substitute the entire variable expression with the local variable name (e.g. [local10h] instead of [ebp+local10h])
          asm.varsum: Show variables summary instead of full list in disasm (0, 1, 2)
           asm.varxs: Show accesses of local variables
asm.lines = true
asm.lines.call = false
asm.lines.ret = false
asm.linesout = true
asm.linesright = false
asm.lineswide = false
asm.lineswidth = 7

->

asm.lines = true
asm.lines.call = false
asm.lines.ret = false
asm.lines.out = true
asm.lines.right = false
asm.lines.wide = false
asm.lines.width = 7

From what I understand there are 2 major things under asm.

  • How to disassemble (asm.cpu, asm.bits, asm.arch, asm.dwarf, asm.maxrefs, and so on...)
  • How to print it (asm.bytes, asm.cmt, asm.lines, asm.fcnlines, asm.pcalign, ...)

So maybe we could move the second part under a new variable, something like display., render., print., ... I don't know

Agree on "asm.var." - sounds good, same with "asm.lines."

next change:

[0x00000000]> e asm.~imm
asm.armimm = 0
asm.immstr = false
asm.immtrim = false

must be

asm.imm.arm = 0
asm.imm.str = false
asm.imm.trim = false

Another one

asm.flags = true
asm.flagsinbytes = false
asm.flgoff = false
asm.midflags = 2
asm.reloff.flags = false

must be:
` asm.flags = true asm.flags.inbytes = false asm.flags.offset = false asm.flags.mid = 2 asm.reloff.flags = false # imho keep it like this

asm.tabs = 0
asm.tabsoff = 0
asm.tabsonce = false

into
```
asm.tabs = 0
asm.tabs.off = 0
asm.tabs.once = false
````

asm.fcnlines

into

asm.lines.fcn

i think we can close this issue for now :) we can open another one for other variables like debug. or anal. which may be also interesting to discuss.

One interesting comment on this issue is https://github.com/radare/radare2/issues/9798#issuecomment-388315320 , which is actually true and probably would deserve some more thinking. As he said, there are printing configurations and disassembly ones.

yep. but this issue is large enough to open another issue to discuss that

Was this page helpful?
0 / 5 - 0 ratings

Related issues

XVilka picture XVilka  Â·  7Comments

unixfreaxjp picture unixfreaxjp  Â·  8Comments

Manouchehri picture Manouchehri  Â·  3Comments

MariasStory picture MariasStory  Â·  6Comments

PaquitoRiviera picture PaquitoRiviera  Â·  7Comments