title: gdb remote debugging - program crashes when stepping into a shared library
body: <p>I cross compiled a linux targeted app on a cygwin host. The program runs ok on the target and also with gdbserver. However, when I try to step through the program it crashes whenever I step into a shared library function. The backtrace gdb prints is:</p>
  
  <p><code>(gdb) bt</code>
  <br/>
  <code>#0  0x00000000004008f4 in ?? ()</code>
  <br/>
  <code>#1  0x0000003f0380d7e4 in ?? ()</code>
  <br/>
  <code>#2  0x00002b1373630000 in ?? ()</code>
  <br/>
  <code>#3  0x00002b1373630590 in ?? ()</code>
  <br/>
  <code>#4  0x00002b1373631348 in ?? ()</code>
  <br/>
  <code>#5  0x00002b1373631888 in ?? ()</code>
  <br/>
  <code>#6  0x0000003f03a1c510 in ?? ()</code>
  <br/>
  <code>#7  0x0000000000000000 in ?? ()</code></p>
  
  <p>If I set a breakpoint on the function and continues it doesn't crash.</p>
  
  <p>This is hello.c:</p>
  
  <pre><code>void foo(int*);
  int main()
  {
      int a;
      foo(&amp;a);
      return a;
  }
  </code></pre>
  
  <p>compiled with <i>x86_64-unknown-linux-gnu-gcc -g -c hello.c</i>.</p>
  
  <p>and foo.c:</p>
  
  <pre><code>void foo(int *i)
  {
      *i = 2;
  }
  </code></pre>
  
  <p>compiled with <i>x86_64-unknown-linux-gnu-gcc -g -shared -Wl,-soname,libfoo.so -o libfoo.so foo.c</i>.</p>
  
  <p>The linking is with <i>x86_64-unknown-linux-gnu-gcc -Wl,-rpath,. libfoo.so hello.o -o hello</i>.</p>