{"id":10152,"date":"2023-07-31T15:18:38","date_gmt":"2023-07-31T07:18:38","guid":{"rendered":"http:\/\/xinyiworld.top\/wordpress_it\/?p=10152"},"modified":"2023-12-12T15:14:45","modified_gmt":"2023-12-12T07:14:45","slug":"gdb-arm64-v8a-64%e4%bd%8d%e5%b9%b3%e5%8f%b0%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91","status":"publish","type":"post","link":"http:\/\/xinyiworld.top\/wordpress_it\/?p=10152","title":{"rendered":"gdb arm64-v8a 64\u4f4d\u5e73\u53f0\u4ea4\u53c9\u7f16\u8bd1"},"content":{"rendered":"<p>\u53c2\u8003\uff1a<a href=\"https:\/\/www.dandelioncloud.cn\/article\/details\/1527473447139819521\">https:\/\/www.dandelioncloud.cn\/article\/details\/1527473447139819521<\/a><\/p>\n<p>gdb\u4e0b\u8f7d\u8def\u5f84\uff1a<a href=\"http:\/\/ftp.gnu.org\/gnu\/gdb\/\">http:\/\/ftp.gnu.org\/gnu\/gdb\/<\/a><\/p>\n<p>configure\u53c2\u6570\uff1a<code>.\/configure LDFLAGS=-static --host=aarch64-linux-gnu  CC=\/usr\/bin\/aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++<\/code>\uff0c\u6ce8\u610f\u8981\u52a0static\u53c2\u6570\uff0c\u5426\u5219\u4f7f\u7528\u5168\u8def\u5f84\u6267\u884cgdbserver\u4f1a\u62a5\u627e\u4e0d\u5230\u6587\u4ef6\u9519\u8bef\u3002<\/p>\n<h4>\u9519\u8bef\u6392\u67e5<\/h4>\n<ul>\n<li>\n<p>\u5bf9\u4e8egdb7.8\u7f16\u8bd1\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u9519\u8bef<br \/>\n<a href=\"https:\/\/www.cnblogs.com\/eastgeneral\/p\/11615368.html\">https:\/\/www.cnblogs.com\/eastgeneral\/p\/11615368.html<\/a>\uff0c \u5c06\u76f8\u5173\u7684c\u6587\u4ef6\u7684\u91cd\u590d\u51fd\u6570\u6ce8\u91ca\u6389\u5c31\u884c\u3002<\/p>\n<\/li>\n<li>\n<p>\u8fde\u63a5android\u5e73\u53f0\u62a5\u9519\uff1awarning: while parsing target description (at line 10): Target description specified unknown architecture &quot;arm&quot;<br \/>\n<a href=\"https:\/\/blog.csdn.net\/qq_40351988\/article\/details\/121631918\">https:\/\/blog.csdn.net\/qq_40351988\/article\/details\/121631918<\/a><br \/>\n\u4f7f\u7528gdb-multiarch\uff0c\u4e00\u822cclion\u9ed8\u8ba4\u7684\u4e5f\u662f\u8fd9\u4e2a\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528clion\u65e0\u6cd5catch\u5230\u65ad\u70b9\uff0c\u4f46\u662f\u4f7f\u7528gdb\u547d\u4ee4\u53ef\u4ee5\u3002<br \/>\n\u53ef\u6267\u884c\u6587\u4ef6\u5728\u7f16\u8bd1\u7684\u65f6\u5019\u6ca1\u6709\u52a0-g\u53c2\u6570<\/p>\n<\/li>\n<li>\n<p>file exe fialure<br \/>\n1\uff09\u4e0d\u8981\u4f7f\u7528strip\u5904\u7406\u6267\u884c\u6587\u4ef6\uff0c\u5426\u5219\u65e0\u6cd5debug.\u5bf9\u4e8eclion\u5219\u63d0\u793a\u2018file exe fialure\u2019<br \/>\n2\uff09\u5c06\u8981debug\u7684\u7a0b\u5e8f\u6b63\u5728\u8fd0\u884c<\/p>\n<\/li>\n<li>\n<p>warning: Selected architecture aarch64 is not compatible with reported target architecture arm<br \/>\nReply contains invalid hex digit 59<br \/>\n\u573a\u666f\uff1andk\u7f16\u8bd1\u7684\u53ef\u6267\u884c\u6587\u4ef6<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">mkdir -p build\n\ncd build\n\nrm -rf *\n\nexport CMAKE_BUILD_TYPE=Debug\n\ncmake .. \\\n-DCMAKE_TOOLCHAIN_FILE=\/etc\/opt\/pkg\/android-ndk-r25c\/build\/cmake\/android.toolchain.cmake \\\n-DANDROID_ABI=&quot;arm64-v8a&quot; \\\n-DANDROID_NATIVE_API_LEVEL=android-24\n\nmake -j4<\/code><\/pre>\n<p>\u901a\u8fc7gdb-multiarch\u547d\u4ee4\u8fdb\u5165gdb\u547d\u4ee4\u884c\uff0c\u6267\u884c<code>set architecture arm<\/code>\uff0c\u4e0a\u9762\u9519\u8bef\u6d88\u9664\u3002\u4f46\u662f\u8bfb\u4e0d\u5230debug\u76f8\u5173\u7684\u7b26\u53f7\u8868<\/p>\n<pre><code class=\"language-bash\">(gdb) set architecture arm\nThe target architecture is assumed to be arm\n(gdb)  target  remote 10.0.3.16:1234\nRemote debugging using 10.0.3.16:1234\nReading \/system\/bin\/linker64 from remote target...\nwarning: File transfers from remote targets can be slow. Use &quot;set sysroot&quot; to access files locally instead.\nwarning: `target:\/system\/bin\/linker64&#039;: Shared library architecture aarch64 is not compatible with target architecture arm.\nReading \/system\/bin\/linker64 from remote target...\nwarning: `target:\/system\/bin\/linker64&#039;: Shared library architecture aarch64 is not compatible with target architecture arm.\nReading symbols from target:\/system\/bin\/linker64...\nReading \/system\/bin\/.debug\/linker64 from remote target...\nReading \/usr\/lib\/debug\/\/system\/bin\/linker64 from remote target...\nReading \/usr\/lib\/debug\/system\/bin\/\/linker64 from remote target...\nReading target:\/usr\/lib\/debug\/system\/bin\/\/linker64 from remote target...\n(No debugging symbols found in target:\/system\/bin\/linker64)\n<\/code><\/pre>\n<ul>\n<li>gdb-multiarch \u8bfb\u53d6\u53ef\u6267\u884c\u6587\u4ef6\u8c03\u8bd5\u4fe1\u606f\u5931\u8d25<\/li>\n<\/ul>\n<p><code>Dwarf Error: DW_FORM_strx1 found in non-DWO CU [in module \/home\/xinyi\/code\/cplus\/lxc_socket\/build\/lxc_socket_server] (No debugging symbols found in build\/lxc_socket_server)<\/code><\/p>\n<p>\u5f53\u7f16\u8bd1\u9759\u6001\u94fe\u63a5\u53ef\u6267\u884c\u6587\u4ef6<code>SET(CMAKE_EXE_LINKER_FLAGS &quot;-static -ffunction-sections -fdata-sections -Wl,--gc-sections&quot;)<\/code>\u65f6\u5c31\u4f1a\u62a5\u4e0a\u9762\u7684\u9519\u8bef<\/p>\n<ul>\n<li>gdb-server \u8bfb\u53d6\u53ef\u6267\u884c\u6587\u4ef6\u8c03\u8bd5\u4fe1\u606f\u5931\u8d25<\/li>\n<\/ul>\n<p>\u5ba2\u6237\u7aef\uff1a<\/p>\n<pre><code class=\"language-bash\">(gdb) set architecture arm\nThe target architecture is assumed to be arm\n(gdb) target remote 10.0.3.16:1234\nRemote debugging using 10.0.3.16:1234\nReading \/system\/bin\/linker64 from remote target...\nwarning: File transfers from remote targets can be slow. Use &quot;set sysroot&quot; to access files locally instead.\nwarning: `target:\/system\/bin\/linker64&#039;: Shared library architecture aarch64 is not compatible with target architecture arm.\nReading \/system\/bin\/linker64 from remote target...\nwarning: `target:\/system\/bin\/linker64&#039;: Shared library architecture aarch64 is not compatible with target architecture arm.\nReading symbols from target:\/system\/bin\/linker64...\nReading \/system\/bin\/.debug\/linker64 from remote target...\nReading \/usr\/lib\/debug\/\/system\/bin\/linker64 from remote target...\nReading \/usr\/lib\/debug\/system\/bin\/\/linker64 from remote target...\nReading target:\/usr\/lib\/debug\/system\/bin\/\/linker64 from remote target...\n(No debugging symbols found in target:\/system\/bin\/linker64)\n0xb7f51c64 in ?? ()\n(gdb) <\/code><\/pre>\n<p><code>(No debugging symbols found in target:\/system\/bin\/linker)<\/code>\u53ef\u80fd\u7684\u60c5\u51b5\u662f\u8c03\u8bd5\u7684\u7a0b\u5e8f\u662ftripped\u4e86\uff0c\u901a\u8fc7file\u67e5\u770b\u4e00\u4e0b\u3002\u53ef\u4ee5debug\u7684\u662f<code>not stripped<\/code><\/p>\n<p>\u4f46\u662f\u5947\u602a\u7684\u662f\u8c03\u8bd5\u6587\u4ef6\u5df2\u7ecf\u662f<code>not stripped<\/code>\u4e86\uff0cgdb\u4ecd\u7136\u65e0\u6cd5\u8bfb\u53d6\u5230\u8c03\u8bd5\u7b26\u53f7\u4fe1\u606f\u3002<\/p>\n<p>\u670d\u52a1\u7aef\uff1a<\/p>\n<pre><code class=\"language-bash\">Remote debugging from host 10.0.2.54\ngdbserver: unexpected r_debug version 0<\/code><\/pre>\n<h4>\u76f4\u63a5\u4f7f\u7528ndk\u91cc\u81ea\u5e26\u7684gdbserver<\/h4>\n<p><code>android-ndk-r9\\prebuilt\\android-arm\\gdbserver<\/code><\/p>\n<h4>\u76f4\u63a5\u4f7f\u7528Android\u7cfb\u7edf\u81ea\u5e26\u7684gdbserver<\/h4>\n<p>\/system\/bin\/gdbserver<\/p>\n<button class=\"simplefavorite-button\" data-postid=\"10152\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>\u53c2\u8003\uff1ahttps:\/\/www.dandelioncloud.cn\/article\/details\/1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[499],"tags":[],"_links":{"self":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/10152"}],"collection":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10152"}],"version-history":[{"count":16,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/10152\/revisions"}],"predecessor-version":[{"id":10921,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/10152\/revisions\/10921"}],"wp:attachment":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10152"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}