I did some looking around to find an assembly visualizer kind of how Regex sites show you explain it, or the BF (language) visualizer when shows you how its going through the stack, is there something like this for assembly somewhere online?
Brainf**k example: https://fatiherikli.github.io/brainfuck-visualizer/
Unlike BF, real CPU assembly languages usually don't have huge repeats of instructions that need to be summarized; the instruction itself is already a compact but readable statement of what it does. If you want higher level than that, use a decompiler to turn it into C. (Often being able to recognize loops and write them in a C-like fashion, not just if()goto
for compare/branch instructions.)
Even more importantly, most asm isn't known to be a whole program, it's usually a function with unknown register values as inputs, so tracing on the level of knowing where every pointer is pointing is not possible, not allowing the kind of analysis in the BF visualizer example. BF only has a single "cursor" that code has to constantly move around to work on multiple "variables", but regular asm doesn't suck that much and is usually closer to the level that the BF visualizer summarizes into.
A good disassembler (like objconv
for x86/x86-64) will show branch targets, making it fairly possible to identify loops (because backward conditional branches are often loops).
Branching is another thing that makes real asm harder to statically trace than a regex or BF. BF branching is limited to structured nesting via [ ]
, but CPU asm is not.
A good asm debugger will have a way to show you the registers, ideally highlighting the one(s) that changed since the last breakpoint or single-step. You can usually configure the same for memory, at worst with a manual GDB command like display /8gx $rsp
to show 8 qwords (g = Giant, in heX) above the stack pointer on x86-64 before every prompt.
So you can follow what's going on by single-stepping the asm.
The https://godbolt.org/ compiler explorer's asm window has mouseover for x86 instruction mnemonics with a one-line reminder of what they do; useful if you forget which registers are implicit operands for instructions like cdq
or idiv
.