Visual C++ appends 0xCC (int3) bytes at the end of functions

前端 未结 3 1343
小蘑菇
小蘑菇 2021-01-25 11:05

This is my first time around, and I really hope you guys can help me, as I have ran out of ideas by now.

I have searched for an answer for a couple of hours now, and cou

3条回答
  •  轮回少年
    2021-01-25 11:08

    As Devolus points out, the compiler is inserting these extra bytes after your code in order to align the next function on a reasonable (usually divisible by 16) starting address.

    The compiler is actually trying to help you since 0xCC is the breakpoint instruction, the code will break into the debugger (if attached) should the instruction pointer accidentally point outside a function at any point during execution.

    None of this should worry you for your purposes. You can consider the 0xCC padding as part of the function.

提交回复
热议问题