Discussion about this post

User's avatar
VJ's avatar

I wished at least assembler syntax would at be standardized for the x86 ISA so that we don't have AT&T vs Intel syntax as well as slightly different mnemonics across various assemblers/compilers. As far as the instruction names, maybe in addition to standardized short form mnemonics, the standard could also define longer descriptive aliases for the same opcode, and/or maybe allow the user to define their own alias in the asm source.

Having a standard where the machine code would also optionally retain labels would be helpful too in debugging / disassembly. Or does that exist? I suppose it verges into compiler symbols maybe such asm labels could be stored in the same section. In working with Solaris in the past, one the most brilliant features the engineers implemented in the OS, compiler and debugger was always pushing the arguments for each function call onto the stack even if the arguments were actually passed by registers. The debugger, mdb or kmdb would retrieve this information for each stack frame and display it as arguments. It results in extra overhead but an intentional and worthy compromise IMHO, invaluable for debugging and troubleshooting. It worked for live disassembly with their debugger as well as with core dumps to retain the current arguments for the whole stack trace.

Expand full comment
Carlos's avatar

One could argue the best way to "read assembly" is to read it's LLVM IR code.

The IR is why nearly all compiler development efforts have been switched to LLVM in recent years, and for good reason.

For one, it's actually a language meant to be read. Still, while staying implementation agnostic, it very closely resembles your machine code implementation.

And even if you don't have a source code, there are "lifters"" which translate your assembly code into IR, which in turn you can always compile back.

Expand full comment
30 more comments...

No posts