title: debug library loaded with ctypes using gdb
body: <p>I loaded in python a C library X.so, that I compiled with these flags.</p>
  
  <pre><code>GDBFLAGS = -gdwarf-2 -g3 -O0 -ggdb
  </code></pre>
  
  <p>and I call some of its non-static functions from python , using ctypes.</p>
  
  <p>I wish debugging the C library X.so. Some function from X.so crashes sometimes, not all the time, and I wish monitoring the execution using gdb.</p>
  
  <p>I use linux-gnu. How can I debug ctypes ?</p>