title: "Trace/breakpoint trap (core dumped)" error when dividing by negative value in Assembly
body: <p>I have written out a small assembly program that divides two numbers, then displays the results through C <code>printf</code> function. The program asks for user input for the numbers, then does division as so:</p>
  
  <pre><code>mov rax, r14 ;r14 holds the numerator
  cqo
  mov rbx, r13 ;r13 holds the divisor
  idiv rbx
  mov r12, rax ;place divided answer into r12
  mov r11, rdx ;place remainder from rdx into r11
  </code></pre>
  
  <p>Later printing out the values with:</p>
  
  <pre><code>mov rax, 0
  mov rdi, outputresult ;outputresult defined as "The quotient of %ld divided by %ld is %ld with remainder %ld."
  mov rsi, rsp
  mov rsi, r14
  mov rdx, rbx
  mov rcx, r12
  mov r8, r11
  call printf
  </code></pre>
  
  <p>As is evident, I moved all values into their respective "calling" register to display the values correctly. This functions perfectly, except when the divisor (<code>r13</code>) is a negative number, I get the error stated before (<code>Trace/breakpoint trap (core dumped</code>).</p>
  
  <p>The program continues to run regardless, and actually displays the correct values no matter if the divisor is negative or positive. However, I wish to get rid of the error which always appears right before the program finishes running. I can provide any further code if I am missing anything crucial.</p>