{"id":7104,"date":"2014-05-21T03:37:15","date_gmt":"2014-05-21T03:37:15","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/21\/how-to-set-ndkcompatabi-for-eclipse-x86-android-jni-debugging-collection-of-common-programming-errors-2\/"},"modified":"2014-05-21T03:37:15","modified_gmt":"2014-05-21T03:37:15","slug":"how-to-set-ndkcompatabi-for-eclipse-x86-android-jni-debugging-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/21\/how-to-set-ndkcompatabi-for-eclipse-x86-android-jni-debugging-collection-of-common-programming-errors-2\/","title":{"rendered":"How to set NdkCompatAbi for Eclipse x86 Android JNI debugging?-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m trying to debug a JNI crash on an Android x86 phone (San Diego). I&#8217;m using Eclipse\/Helios and Linux, and I&#8217;m as up to date as Helios permits.<\/p>\n<p>When I &#8216;Debug as&#8230; Native&#8217; on an ARM phone, as is known, I have to mess around with<\/p>\n<pre><code>set solib-search-path .\/obj\/local\/armeabi\nfile .\/obj\/local\/armeabi\/app_process\n<\/code><\/pre>\n<p>but things work as expected from that point, complete with the &#8216;no debugging symbols found&#8217; lie.<\/p>\n<p>On x86, before the &#8216;No segment defined&#8217; and &#8216;Could not load shared library&#8217; warnings to which the foregoing commands are a response appear, I get this pop-up instead:<\/p>\n<pre><code>Launching jniTestApp has encountered a problem:\n\nError in final launch sequence\nFailed to execute MI command:\n-target-select remote localhost:5039\nError message from debugger back end:\nRemote 'g' packet reply is too long: fcffffff84fdf0bf10000000280000000...000\n<\/code><\/pre>\n<p>In the &#8216; gdb traces&#8217; console, I see this:<\/p>\n<pre><code>088,221 &amp;\"warning: while parsing target description (at line 1): Target description specified unknown architecture \\\"i386\\\"\\n\"\n<\/code><\/pre>\n<p>and looking in the &#8216;Android&#8217; console, I see this:<\/p>\n<pre><code>[2012-11-08 11:06:23 - Substitute: ] ${NdkGdb}\n[2012-11-08 11:06:23 - Substitute: ]  --&gt; \n[2012-11-08 11:06:23 - Substitute: ] \/home\/tim\/lib\/android-ndk-r8b\/toolchains\/arm-linux-androideabi-4.6\/prebuilt\/linux-x86\/bin\/arm-linux-androideabi-gdb\n[2012-11-08 11:06:23 - Substitute: ] ${NdkProject}\/obj\/local\/${NdkCompatAbi}\/app_process\n[2012-11-08 11:06:23 - Substitute: ]  --&gt; \n[2012-11-08 11:06:23 - Substitute: ] \/home\/tim\/gitsvn\/workspace\/jniTestApp\/jniDir\/builds\/Android\/obj\/local\/armeabi\/app_process\n<\/code><\/pre>\n<p>and various other things referring to armeabi.<\/p>\n<p>I observe I can change this in the debug configuration &#8211; setting Launch Options\/Debugger\/Debugger to \/home\/tim\/lib\/android-ndk-r8b\/toolchains\/x86-4.6\/prebuilt\/linux-x86\/bin\/i686-linux-android-gdb and replacing the Shared Library from ${NdkProject}\/obj\/local\/${NdkCompatAbi} with the absolute &#8230;\/obj\/local\/x86 path gets me back to where I ensure the library is loaded, then suspend and paste into gdb<\/p>\n<pre><code>set solib-search-path .\/obj\/local\/x86\nfile .\/obj\/local\/x86\/app_process\n<\/code><\/pre>\n<p>which is great, but really it&#8217;s a bit of a faff. And error-prone.<\/p>\n<p>A websearch for NdkCompatAbi just gives me java source files containing it, and searching for NdkGdb isn&#8217;t helpful.<\/p>\n<p>Are these variables set anywhere I can get to them?<\/p>\n<p>My issue has resolved; I don&#8217;t know whether this is an interesting question now.<\/p>\n<p>It seems that this problem arose because when I tried to Debug as&#8230; Native, the Navigator panel elected not to give me a properly populated submenu &#8211; only offering &#8216;debug configurations&#8217; which I clicked on and used to create a debug configuration &#8216;manually&#8217;. Somehow, that managed to set up the non-adaptive behaviour outlined above. Perhaps I tried to &#8216;debug&#8217; from the src\/ folder instead of the project? I don&#8217;t know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to debug a JNI crash on an Android x86 phone (San Diego). I&#8217;m using Eclipse\/Helios and Linux, and I&#8217;m as up to date as Helios permits. When I &#8216;Debug as&#8230; Native&#8217; on an ARM phone, as is known, I have to mess around with set solib-search-path .\/obj\/local\/armeabi file .\/obj\/local\/armeabi\/app_process but things work as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7104","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7104"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7104\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}