title: gdb: "Left operand of assignment is not an lvalue."
body: <p>I am debugging an ARM microcontroller remotely and trying to modify a variable with gdb in the following block of code:</p>
  
  <pre><code>for (int i = 0; i &lt; 100; i++) {
      __asm__("nop");
  }
  </code></pre>
  
  <p>When I execute <code>print i</code> I can see the value of the variable</p>
  
  <pre><code>(gdb) print i
  $1 = 0
  </code></pre>
  
  <p>Executing <code>whatis i</code> returns this</p>
  
  <pre><code>whatis i
  ~"type = int\n"
  </code></pre>
  
  <p>But when I try to change the variable I get the following error</p>
  
  <pre><code>(gdb) set variable i=99
  Left operand of assignment is not an lvalue.
  </code></pre>
  
  <p>What am I doing wrong here?</p>
  
  <p><b>UPDATE:</b> here is the assembler code</p>
  
  <pre><code>!        for (int i = 0; i &lt; 100; i++) {
  main+38: subs\tr3, #1
  main+40: bne.n\t0x80001d0 &lt;main+36&gt;
  main+42: b.n\t0x80001c4 &lt;main+24&gt;
  main+44: lsrs\tr0, r0, #16
  main+46: ands\tr2, r0
  !            __asm__("nop");
  main+36: nop    
  </code></pre>