<story><title>How breakpoints are set</title><url>http://majantali.net/2016/10/how-breakpoints-are-set/</url></story><parent_chain></parent_chain><comment><author>pcwalton</author><text>Also worth noting: x86 supports four hardware breakpoints, which are sometimes more convenient, since they don&amp;#x27;t involve overwriting any instructions. (They&amp;#x27;re also more flexible because they can be used to trap on memory reads, etc.) &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;en.wikipedia.org&amp;#x2F;wiki&amp;#x2F;X86_debug_register&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;en.wikipedia.org&amp;#x2F;wiki&amp;#x2F;X86_debug_register&lt;/a&gt;</text></comment>
<story><title>How breakpoints are set</title><url>http://majantali.net/2016/10/how-breakpoints-are-set/</url></story><parent_chain></parent_chain><comment><author>dkopi</author><text>The reason INT 3 is used is that it&amp;#x27;s the only interrupt that has a single byte opcode (0xCC). Other interrupts require two bytes: CD &amp;lt;interupt number&amp;gt;.&lt;p&gt;This makes setting a breakpoint really easy, as all you have to do is replace a single byte (and restore a single byte) where you want to place your breakpoint.
INT 3 being only one byte is also important when you&amp;#x27;re setting a breakpoint instead of a another single byte instruction - your newly set breakpoint won&amp;#x27;t override the consecutive instruction, which might be jumped to somewhere else in the code.</text></comment>