title: gdb cannot access variables after spawning a thread
body: <p>I am trying to debug an application, after migrating from an old development board to a new one (iMX6 sabre lite  board with ARM cortex A9).
  I'm also running gdb on the host and gdbserver on the development board as explain in the __answer__section here <a href="https://stackoverflow.com/questions/15298377/how-can-i-change-the-runtime-libraries-libc-ld-etc-used-by-gdb-in-cross-arm/15301872?noredirect=1#comment21601674_15301872">how can i change the runtime libraries (libc ,ld, etc) used by gdb in cross (ARM) debugging</a></p>
  
  <p>while trying to run the application and on executing the step to create a thread I get this:</p>
  
  <pre><code>(gdb) 
  681             if (pthread_create(&amp;serial_thread, &amp;attr_detach, read_serial, argv[1]) != 0){
  (gdb) 
      Cannot remove breakpoints because program is no longer writable.
      Further execution is probably impossible.
  0x00023308 in main (
      argc=&lt;error reading variable: Cannot access memory at address 0x7efffc8c&gt;, 
      argv=&lt;error reading variable: Cannot access memory at address 0x7efffc88&gt;)
      at main_process/main_process.c:681
  681             if (pthread_create(&amp;serial_thread, &amp;attr_detach, read_serial, argv[1]) != 0){
      warning: Error removing breakpoint 0
      Cannot access memory at address 0x7efffc88
  (gdb) info threads
        Id   Target Id         Frame 
      * 1    Thread 2588.2588  0x00023308 in main (
      argc=&lt;error reading variable: Cannot access memory at address 0x7efffc8c&gt;, 
      argv=&lt;error reading variable: Cannot access memory at address 0x7efffc88&gt;)
      at main_process/main_process.c:681
  </code></pre>
  
  <p>I can not continue with the debug execution after that.
  if i simply run through the code (instead of stepping through it) I'll get</p>
  
  <pre><code>(gdb) c
  Continuing.
  [Inferior 1 (process 2601) exited with code 0377]
  </code></pre>
  
  <p>if I add a breakpoint in the thread that is to be created, I will get the execution to halt there, but continuing afterwards is impossible (it will not exit either).</p>
  
  <p>I read about the posibility that the thread stack size may be small, but it is 8MB and I am only passing an argument argv[1] (which is empty at the moment) to the thread.</p>
  
  <p>I used the Linaro gcc-linaro-arm-linux-gnueabi-2012.04-20120426_linux toolchain to create my application. and the shared libraries running on the board (and used while debugging) belong to LTIB_201204 rootfs. </p>
  
  <p>Thank you for your help</p>