Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>for a more recent version of NDK (I am using r7c), you can build debug version by</p> <ol> <li>add <code>android:debuggable="true"</code> flag to <code>&lt;Application&gt;</code> tag in <code>AndroidManifest.xml</code></li> <li>invoke <code>ndk-build</code> with <code>NDK_DEBUG=1</code> (NDK_DEBUG flag not necessary if running ndk-build with unix shell)</li> </ol> <p>on Windows, things get a bit tricky because to use <code>ndk-gdb</code>, you still need bash (or cygwin) as of NDK r7c, yet <code>ndk-build</code> running in cygwin bash will run into permission problem if you ever use any of the pre-built static library</p> <p>my solution on windows machine is</p> <ol> <li>add <code>android:debuggable="true"</code> flag to <code>&lt;application</code> tag in <code>AndroidManifest.xml</code> (same as above)</li> <li>in cmd (windows' command prompt): invoke <code>ndk-build</code> with <code>NDK_DEBUG=1</code></li> <li>in cygwin bash: run <code>ndk-gdb</code> </li> </ol> <p>for quick initial investigation of native so library, create a simple activity with one button to trigger library entry function and <code>loadLibrary</code> in the activity like:</p> <pre><code>class MyActivity extends Activity { static { System.loadLibrary("mylibrary"); } /* other functions like onCreate, etc... */ public native void libfunc(); public void onClick(View v){ libfunc(); } } </code></pre> <p>So when <code>gdb</code> starts, the library in question is actually loaded, yet you can still have time to set break points, etc before the program crashes; when you finish setting up the debugger, at <code>(gdb)</code> prompt, type <code>continue</code> (or just '<code>c</code>'), then hit the button to start the crashing program and happy debugging...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload