[HN Gopher] In Praise of the Disassembler
       ___________________________________________________________________
        
       In Praise of the Disassembler
        
       Author : MindGods
       Score  : 57 points
       Date   : 2021-06-05 10:19 UTC (12 hours ago)
        
 (HTM) web link (queue.acm.org)
 (TXT) w3m dump (queue.acm.org)
        
       | rahen wrote:
       | > 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.
        
         | flohofwoe wrote:
         | Don'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)
        
           | marcosdumay wrote:
           | Programming 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.
        
           | ithkuil wrote:
           | I 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.
        
         | no_it_is_not wrote:
         | No, it is not.
        
         | bombcar wrote:
         | I 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.
        
         | pjmlp wrote:
         | To 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__ wrote:
         | Or 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.
        
       | nneonneo wrote:
       | These 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 wrote:
         | I 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.
        
       ___________________________________________________________________
       (page generated 2021-06-05 23:02 UTC)