{"id":8962,"date":"2023-03-20T09:53:30","date_gmt":"2023-03-20T01:53:30","guid":{"rendered":"http:\/\/xinyiworld.top\/wordpress_it\/?p=8962"},"modified":"2023-03-20T14:16:33","modified_gmt":"2023-03-20T06:16:33","slug":"gdb%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91","status":"publish","type":"post","link":"http:\/\/xinyiworld.top\/wordpress_it\/?p=8962","title":{"rendered":"gdb\u4ea4\u53c9\u7f16\u8bd1"},"content":{"rendered":"<p><a href=\"https:\/\/blog.csdn.net\/nanfeibuyi\/article\/details\/127940011\">https:\/\/blog.csdn.net\/nanfeibuyi\/article\/details\/127940011<\/a><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_16 counter-hierarchy counter-decimal ez-toc-grey\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" style=\"display: none;\"><i class=\"ez-toc-glyphicon ez-toc-icon-toggle\"><\/i><\/a><\/span><\/div>\n<nav><ul class=\"ez-toc-list ez-toc-list-level-1\"><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=8962\/#%E7%BC%96%E8%AF%91%E6%AD%A5%E9%AA%A4\" title=\"\u7f16\u8bd1\u6b65\u9aa4\">\u7f16\u8bd1\u6b65\u9aa4<\/a><ul class=\"ez-toc-list-level-4\"><li class=\"ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=8962\/#step1%EF%BC%9A%E6%8C%87%E5%AE%9A%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91%E5%99%A8%EF%BC%8C%E7%94%9F%E6%88%90makefile%E6%96%87%E4%BB%B6%E3%80%82\" title=\"step1\uff1a\u6307\u5b9a\u4ea4\u53c9\u7f16\u8bd1\u5668\uff0c\u751f\u6210makefile\u6587\u4ef6\u3002\">step1\uff1a\u6307\u5b9a\u4ea4\u53c9\u7f16\u8bd1\u5668\uff0c\u751f\u6210makefile\u6587\u4ef6\u3002<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=8962\/#step2_%E6%89%A7%E8%A1%8Cmake%E6%8C%87%E4%BB%A4\" title=\"step2: \u6267\u884cmake\u6307\u4ee4\">step2: \u6267\u884cmake\u6307\u4ee4<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-4\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=8962\/#step3_%E5%9C%A8android%E7%B3%BB%E7%BB%9F%E4%B8%8A%E8%BF%90%E8%A1%8Cgdbserver\" title=\"step3: \u5728android\u7cfb\u7edf\u4e0a\u8fd0\u884cgdbserver\">step3: \u5728android\u7cfb\u7edf\u4e0a\u8fd0\u884cgdbserver<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"%E7%BC%96%E8%AF%91%E6%AD%A5%E9%AA%A4\"><\/span>\u7f16\u8bd1\u6b65\u9aa4<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"step1%EF%BC%9A%E6%8C%87%E5%AE%9A%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91%E5%99%A8%EF%BC%8C%E7%94%9F%E6%88%90makefile%E6%96%87%E4%BB%B6%E3%80%82\"><\/span>step1\uff1a\u6307\u5b9a\u4ea4\u53c9\u7f16\u8bd1\u5668\uff0c\u751f\u6210makefile\u6587\u4ef6\u3002<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-bash\">.\/configure --prefix=\/home\/xinyi\/android\/code\/Demos\/gdb-9.2\/arm_build \n--host=arm-linux \nCC=aarch64-linux-gnu-gcc-8  \nCXX=\/usr\/bin\/aarch64-linux-gnu-g++-8 \nLD=\/usr\/bin\/aarch64-linux-gnu-ld \nAR=\/usr\/bin\/aarch64-linux-gnu-gcc-ar-8<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"step2_%E6%89%A7%E8%A1%8Cmake%E6%8C%87%E4%BB%A4\"><\/span>step2: \u6267\u884cmake\u6307\u4ee4<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u53ef\u80fd\u4f1a\u78b0\u52302\u4e2a\u95ee\u9898<br \/>\n<strong>\u95ee\u98981\uff1a\u2026\/\u2026\/gdb\/nat\/linux-ptrace.h:21:22: error: \u2018PTRACE_GETFPREGS\u2019 was not declared in this scope<\/strong><\/p>\n<pre><code class=\"language-c\"># vi .\/aarch64-linux-gnu\/libc\/usr\/include\/sys\/ptrace.h\n...\n  \/* Get all general purpose registers used by a process.  *\/\n  PTRACE_GETREGS = 12, \n#define PT_GETREGS PTRACE_GETREGS\n\n  \/* Set all general purpose registers used by a process.  *\/\n  PTRACE_SETREGS = 13,\n#define PT_SETREGS PTRACE_SETREGS\n\n  \/* Get all floating point registers used by a process.  *\/\n  PTRACE_GETFPREGS = 14,\n#define PT_GETFPREGS PTRACE_GETFPREGS                                          \n\n  \/* Set all floating point registers used by a process.  *\/\n  PTRACE_SETFPREGS = 15,\n#define PT_SETFPREGS PTRACE_SETFPREGS\n...<\/code><\/pre>\n<p>\u5c11\u4ec0\u4e48\u5b8f\u5c31\u5b9a\u4e49\u4ec0\u4e48\u5b8f\uff0c\u4e0d\u4e00\u5b9a\u8981\u5b9a\u4e49\u5728\u4ea4\u53c9\u7f16\u8bd1\u5de5\u5177\u94fe\u91cc\uff0c\u5b9a\u4e49\u5728gdb\u7a0b\u5e8f\u4e2d\u62a5\u9519\u7684c\u6587\u4ef6\u4e2d\u7684\u67d0\u4e2a\u5934\u6587\u4ef6\u4e2d\u4ea6\u53ef\uff1a<br \/>\n<code>gdb\/linux-ptrace.h<\/code><\/p>\n<pre><code class=\"language-c\">\/* Get all general purpose registers used by a process.  *\/\n#define PT_GETREGS 12\n\n\/* Set all general purpose registers used by a process.  *\/\n#define PT_SETREGS 13\n\n\/* Get all floating point registers used by a process.  *\/\n#define PT_GETFPREGS 14\n\n\/* Set all floating point registers used by a process.  *\/\n#define PT_SETFPREGS 15\n\n\/* Get all general purpose registers used by a process.  *\/\n#define PTRACE_GETREGS 12\n\n\/* Set all general purpose registers used by a process.  *\/\n#define PTRACE_SETREGS 13\n\n\/* Get all floating point registers used by a process.  *\/\n#define PTRACE_GETFPREGS 14\n\n\/* Set all floating point registers used by a process.  *\/\n#define PTRACE_SETFPREGS 15<\/code><\/pre>\n<p><strong>\u95ee\u98982\uff1a\u2026\/\u2026\/\u2026\/gdb\/gdbserver\/linux-arm-low.c:779:29: error: \u2018__NR_sigreturn\u2019 was not declared in this scope<\/strong><\/p>\n<pre><code class=\"language-c\"># vi .\/aarch64-linux-gnu\/libc\/usr\/include\/asm-generic\/unistd.h\n...\n#define __NR_sigreturn 292\n...<\/code><\/pre>\n<p>\u5c11\u4ec0\u4e48\u5b8f\u5c31\u5b9a\u4e49\u4ec0\u4e48\u5b8f\uff0c\u4e0d\u4e00\u5b9a\u8981\u5b9a\u4e49\u5728\u4ea4\u53c9\u7f16\u8bd1\u5de5\u5177\u94fe\u91cc\uff0c\u5b9a\u4e49\u5728gdb\u7a0b\u5e8f\u4e2d\u62a5\u9519\u7684c\u6587\u4ef6\u4e2d\u7684\u67d0\u4e2a\u5934\u6587\u4ef6\u4e2d\u4ea6\u53ef\uff1a<br \/>\n<code>gdb\/linux-low.h<\/code><\/p>\n<h4><span class=\"ez-toc-section\" id=\"step3_%E5%9C%A8android%E7%B3%BB%E7%BB%9F%E4%B8%8A%E8%BF%90%E8%A1%8Cgdbserver\"><\/span>step3: \u5728android\u7cfb\u7edf\u4e0a\u8fd0\u884cgdbserver<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><strong>\u9519\u8bef1\uff1asystem\/bin\/sh:xxx : No such file or directory<\/strong><br \/>\n<a href=\"https:\/\/www.jianshu.com\/p\/ac9911eb7958\">https:\/\/www.jianshu.com\/p\/ac9911eb7958<\/a><\/p>\n<p><strong>\u9519\u8bef2\uff1ash: .\/gdbserver: Permission denied<\/strong><br \/>\n\u5f85\u89e3\u51b3<\/p>\n<button class=\"simplefavorite-button\" data-postid=\"8962\" 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>https:\/\/blog.csdn.net\/nanfeibuyi\/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":[713],"tags":[],"_links":{"self":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/8962"}],"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=8962"}],"version-history":[{"count":9,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/8962\/revisions"}],"predecessor-version":[{"id":8972,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/8962\/revisions\/8972"}],"wp:attachment":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8962"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}