Find which assembly instruction caused an Illegal Instruction error without debugging

后端 未结 6 1942
走了就别回头了
走了就别回头了 2020-12-24 05:57

While running a program I\'ve written in assembly, I get Illegal instruction error. Is there a way to know which instruction is causing the error, without debug

6条回答
  •  旧巷少年郎
    2020-12-24 06:24

    For handwritten assembly I would suspect a stack management problem resulting in a return-to-nowhere. Write a debugging printout routine that saves every register and insert a call to it at the top of every function.

    Then you will see how far you get...

    (BTW, a good editor and a good understanding of the assembler's macro syntax are lifesavers when writing machine code.)

提交回复
热议问题