3 ms·
In Praise of the Disassembler
- rahen 5y ago> without even the cushion of C (a.k.a. assembly with for loops) This over-simplification is getting tiring. What's a typedef struct in assembly again? Or an union? Like it or not, C _is_ a high level language.
- bombcar 5y agoI feel people without experience in C can underestimate how high-level it can be and base their assumptions on how cleanly simple structures translate into machine language. But people forget how high-level assembly can be, especially if using a macro assembler (which almost anyone does). The line between “my language handles this for me” and “my macro/function handles this for me” gets blurred pretty easily.
- no_it_is_not 5y agoNo, it is not.
- pjmlp 5y agoTo make some of those people happy lets call it a portable macro Assembler. Except on a proper Macro Assembler my code doesn't vanish just because I missed a condition that made use of UB.
- mhh__ 5y agoOr atomics, why do I have to memcpy a pointer etc. I find these tropes are often perpetuated by people who program but are basically non-programmers e.g. the guy who taught me C at university (I already knew C) was one of those people who thinks everything fast must be implemented in C because his area of work hasn't moved to C++ yet.
- flohofwoe 5y agoDon't underestimate the "high-levelness" of macro assemblers by looking at a raw disassembler listing ;) Programming with a macro assembler can be pretty close to programming in C. What actually makes C a high-level language is the abstract memory model, not the structured programming features or type system. (also, on today's CPUs, even assembly code is a high-level language)
- ithkuil 5y agoI spent good chunk of my childhood with a m68k macro assembler. Good times. It dealt well with the "struct fields are just glorified offsets" side of the picture, but you still had to be very aware of the width of the operands.
- marcosdumay 5y agoProgramming with C may feel similar to a macro assembler, but the resulting binaries will look nothing alike. (And yeah, the memory model is mostly, but not entirely different from assembly too.) That doesn't make C high-level. It makes C some kind or weird chimera whose nature changes depending on what subject you are talking about.
- a1369209993 5y ago> What's a typedef struct in assembly again? [section discard] [org 0] node: .next: dd 0 .prev: dd 0 .foo: times(foo.len) db 0 .bar: dw 0 .len: :)
- nneonneo 5y agoThese days, with tools like IDA and Ghidra, I find I’m no longer dealing with disassembly regularly. These tools are doing such a good job of turning assembly code into usable C that reading disassembly is now only necessary in corner cases (SSE functions, rare instructions like AAD, or obfuscated code). It’s honestly incredible how much progress has been made in this area over the past few years.
- souprock 5y agoI have those tools, and I rarely bother with the C they can generate. Plain disassembly isn't so great either. Usually IDA's graph view is the most productive. (it looks like a flow chart made from chunks of assembly code) I really wish Ghidra had a usable graph view; the graph view in Ghidra is just awful. I know somebody else who sticks to the plain assembly listing view. People have their preferences.