Learning to read GCC assembler output

前端 未结 6 1351
长情又很酷
长情又很酷 2021-01-30 01:03

I\'m considering picking up some very rudimentary understanding of assembly. My current goal is simple: VERY BASIC understanding of GCC assembler output when co

6条回答
  •  长情又很酷
    2021-01-30 01:51

    I usually hunt down the processor documentation when faced with a new device, and then just look up the opcodes as I encounter ones I don't know.

    On Intel, thankfully the opcodes are somewhat sensible. PowerPC not so much in my opinion. MIPS was my favorite. For MIPS I borrowed my neighbor's little reference book, and for PPC I had some IBM documentation in a PDF that was handy to search through. (And for Intel, mostly I guess and then watch the registers to make sure I'm guessing right! heh)

    Basically, the assembly itself is easy. It basically does three things: move data between memory and registers, operate on data in registers, and change the program counter. Mapping between your language of choice and the assembly will require some study (e.g. learning how to recognize a virtual function call), and for this an "integrated" source and disassembly view (like you can get in Visual Studio) is very useful.

提交回复
热议问题