Re:How to Read Assembly Language
by tptacek on Tuesday March 02, 2021 @10:28AM
(#26316253)
The major breakthrough I had in being able to comprehend assembly code was when I learned to look at it in basic blocks, rather than as a straight line. I don't know if that's super obvious (it seems obvious, written out that way), but just taking a listing and adding newlines at block boundaries is massively helpful to me.
[ Parent
| on HN ]
Re:How to Read Assembly Language
by chrisaycock on Tuesday March 02, 2021 @10:44AM
(#26316446)
That's definitely how a compiler does it, especially at the IR stage. It's much easier to track values within a localized region; this applies to both people and computers.
> it seems obvious, written out that way
Yep. Most disassembly tools have configuration settings specifically for that (add newline after jumps, put labels on separate lines, etc.)
Sure, and I'm guessing I learned to read assembly this way from IDA Pro; I'd had to deal with assembly long before IDA was a thing, but I was never an especially able reader of other people's assembly.
But even today, like, when the eBPF verifier coughs on a hairball, I end up pulling assembly into Emacs and then doing a quick pass marking up the basic blocks before I try to read it.
Re:How to Read Assembly Language
by dtornabene on Tuesday March 02, 2021 @12:29PM
(#26317807)
I'm sure its not too much trouble to whip up on my own but if you have any emacs lisp helping you do this I'd love to read (and use) it
I wish. If you write it, let me know.
That's how i write assembly. Extra newline between each small block, and two between every major block.
This was also discussed by Don Lancaster.
So for a good trivia question: who invented the concept of Basic Blocks?
It turns out it is not Frances Allen, if you're wondering.
Re:How to Read Assembly Language
by dtornabene on Tuesday March 02, 2021 @12:27PM
(#26317776)
this was also a major step for me, understanding what a basic block was and also seeing the code organized that way