{"id":19873,"date":"2024-11-19T15:00:46","date_gmt":"2024-11-19T07:00:46","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19873\/"},"modified":"2024-11-19T15:00:46","modified_gmt":"2024-11-19T07:00:46","slug":"vscode%e4%b8%ad%e6%80%8e%e4%b9%88%e8%bf%9c%e7%a8%8bgdb%e8%b0%83%e8%af%95%ef%bc%9f%e6%96%b9%e6%b3%95%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19873\/","title":{"rendered":"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3"},"content":{"rendered":"<p>vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u4e0b\u9762\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e0bvscode\u8fdc\u7a0bgdb\u8c03\u8bd5\u7684\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/643540fc31fcd941.jpg\" class=\"aligncenter\" title=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe\" alt=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe\" \/><\/p>\n<p>\u6700\u8fd1\u5728\u540c\u4e8b\u7684\u5b89\u5229\u4e0b\uff0c\u5c1d\u8bd5\u4e86\u7528 vscode \u505a gdb \u8c03\u8bd5\uff0c\u7528\u5b8c\u4e4b\u540e\uff0c\u201c\u771f\u9999\u201d\u3002<\/p>\n<p>\u8bdd\u4e0d\u591a\u8bf4\uff0c\u672c\u6587\u8981\u5b9e\u73b0\u7684\u662f\uff1a\u5728 windows \u7aef\u8fdc\u7a0b\u8c03\u8bd5 linux \u670d\u52a1\u5668\u548c arm \u5d4c\u5165\u5f0f\u8bbe\u5907\u4e0a\u7684 c++ \u4ee3\u7801\uff0c\u5bf9 gdb \u8c03\u8bd5\u7684\u914d\u7f6e\u53ca\u4f7f\u7528\u8fdb\u884c\u4e00\u4e2a\u6574\u7406\u3002<\/p>\n<h2><strong>1\u3001\u8fdc\u7a0b\u8fde\u63a5<\/strong><\/h2>\n<p>\u9996\u5148\u9700\u8981\u5b9e\u73b0\u8fdc\u7a0b\u8fde\u63a5\u670d\u52a1\u5668\uff0c\u5728\u63d2\u4ef6\u5e93\u4e2d\u641c\u7d22 \u201cremote-ssh\u201d\uff0c\u53cc\u51fb\u4e0b\u8f7d\u5b89\u88c5\u5373\u53ef\uff08\u4e0b\u56fe\u4e2d\u6211\u5df2\u5b89\u88c5\u597d\uff09\uff0c\u5b89\u88c5\u597d\u4e4b\u540e\u5728\u4fa7\u8fb9\u680f\u51fa\u73b0\u8fdc\u7a0b\u8d44\u6e90\u7ba1\u7406\u5668\u3002\u3010\u63a8\u8350\u5b66\u4e60\uff1a\u3001\u3011<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/5c50158a748d7c0df06e1ff5a2ae8f19-0.png\" class=\"aligncenter\" title=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe1\" alt=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe1\" \/><\/p>\n<p>\u70b9\u51fb \uff0b \u53f7\uff0c\u5728\u5f39\u51fa\u7684\u547d\u4ee4\u7a97\u53e3\u4e2d\u8f93\u5165 ssh \u767b\u9646\u6307\u4ee4\uff0c\u6309\u7167\u63d0\u793a\uff0c\u8f93\u5165\u5bc6\u7801\u5e76\u786e\u8ba4\uff0c\u5373\u53ef\u8fde\u63a5\u6210\u529f<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/5c50158a748d7c0df06e1ff5a2ae8f19-1.png\" class=\"aligncenter\" title=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe2\" alt=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe2\" \/><\/p>\n<h2><strong>2\u3001\u914d\u7f6e GDB \u73af\u5883<\/strong><\/h2>\n<p>\u5728\u670d\u52a1\u7aef\u521b\u5efa\u4e00\u4e2a c++ \u4ee3\u7801\uff0c\u8fd9\u91cc\u4ee5\u300a\u300b\u4e2d\u7684\u4ee3\u7801\u4e3a\u4f8b\uff0c\u5f88\u7b80\u5355<\/p>\n<pre>#include &lt;unistd.h&gt;\n#include &lt;pwd.h&gt;\n#include &lt;iostream&gt;\n \nint main()\n{\n\tstruct passwd* pwd;\n\tuid_t userid;\n\tuserid = getuid();\n\tpwd = getpwuid(userid);\n \n\tstd::cout &lt;&lt; \"pw_name:\" &lt;&lt; pwd-&gt;pw_name &lt;&lt; std::endl;\n\tstd::cout &lt;&lt; \"pw_passwd:\" &lt;&lt; pwd-&gt;pw_passwd &lt;&lt; std::endl;\n\tstd::cout &lt;&lt; \"pw_uid\uff1a\" &lt;&lt; pwd-&gt;pw_uid &lt;&lt; std::endl;\n\tstd::cout &lt;&lt; \"pw_gid:\" &lt;&lt; pwd-&gt;pw_gid &lt;&lt; std::endl;\n\tstd::cout &lt;&lt; \"pw_gecos:\" &lt;&lt; pwd-&gt;pw_gecos &lt;&lt; std::endl;\n\tstd::cout &lt;&lt; \"pw_dir:\" &lt;&lt; pwd-&gt;pw_dir &lt;&lt; std::endl;\n\tstd::cout &lt;&lt; \"pw_shell:\" &lt;&lt; pwd-&gt;pw_shell &lt;&lt; std::endl;\n \n    return 0;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7f16\u8bd1\u65b9\u6cd5\u5982\u4e0b\uff0c\u6ce8\u610f\u4e00\u5b9a\u8981\u52a0\u4e0a -g \u6307\u4ee4\uff0c\u5426\u5219\u65e0\u6cd5 gdb \u8c03\u8bd5<\/p>\n<pre>g++ -g test.cpp -o test<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\u70b9\u51fb \u6587\u4ef6-\u6253\u5f00\u6587\u4ef6\u5939\uff0c\u627e\u5230\u521b\u5efa\u7684\u4ee3\u7801\u8def\u5f84\uff0c\u786e\u5b9a\u540e\uff0c\u5728\u5de6\u4fa7\u7684\u8d44\u6e90\u7ba1\u7406\u5668\u53ef\u4ee5\u770b\u5230\u4ee3\u7801\u6587\u4ef6\u3002<\/p>\n<p>\u7b2c\u4e00\u6b21\u8fd0\u884c\u9700\u8981\u5b89\u88c5 c++ \u7684\u6269\u5c55\uff0c\u5728\u6269\u5c55\u9875\u9762\u4e2d\uff0c\u5b89\u88c5 C\/C++&nbsp;<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/c008e29ef7d4fd6ef8ebe5640266c5b6-2.png\" class=\"aligncenter\" title=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe3\" alt=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe3\" \/><\/p>\n<p>&nbsp;\u540c\u65f6\u641c\u7d22 GDB Debug \u5e76\u5b89\u88c5<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/c008e29ef7d4fd6ef8ebe5640266c5b6-3.png\" class=\"aligncenter\" title=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe4\" alt=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe4\" \/><\/p>\n<p>&nbsp;\u5b89\u88c5\u597d\u4e4b\u540e\uff0c\u70b9\u51fb\u201c\u8fd0\u884c\u548c\u8c03\u8bd5\u201d\u6309\u94ae\uff0c\u201c\u521b\u5efa launch.json\u201d \u6587\u4ef6\uff0c<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/c14b05ecf0202c6025a285ad1711d4d2-4.png\" class=\"aligncenter\" title=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe5\" alt=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe5\" \/><\/p>\n<p>&nbsp;\u9009\u62e9 C++(GDB\/LLDB\uff09\u9879\uff0c\u81ea\u52a8\u751f\u6210 launch.json \u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b<\/p>\n<pre>{\n    \/\/ \u4f7f\u7528 IntelliSense \u4e86\u89e3\u76f8\u5173\u5c5e\u6027\u3002 \n    \/\/ \u60ac\u505c\u4ee5\u67e5\u770b\u73b0\u6709\u5c5e\u6027\u7684\u63cf\u8ff0\u3002\n    \/\/ \u6b32\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u8bbf\u95ee: https:\/\/go.microsoft.com\/fwlink\/?linkid=830387\n    \"version\": \"0.2.0\",\n    \"configurations\": []\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6309\u7167\u4e0b\u8fb9\u7684\u5185\u5bb9\uff0c\u5bf9\u5e94\u7684\u4fee\u6539\u4e00\u4e0b<\/p>\n<pre>{\n    \/\/ \u4f7f\u7528 IntelliSense \u4e86\u89e3\u76f8\u5173\u5c5e\u6027\u3002 \n    \/\/ \u60ac\u505c\u4ee5\u67e5\u770b\u73b0\u6709\u5c5e\u6027\u7684\u63cf\u8ff0\u3002\n    \/\/ \u6b32\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u8bbf\u95ee: https:\/\/go.microsoft.com\/fwlink\/?linkid=830387\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"name\": \"(gdb) \u542f\u52a8\", \/\/\u914d\u7f6e\u540d\u79f0\uff0c\u663e\u793a\u5728\u914d\u7f6e\u4e0b\u62c9\u83dc\u5355\u4e2d\n            \"type\": \"cppdbg\", \/\/\u914d\u7f6e\u7c7b\u578b\n            \"request\": \"launch\", \/\/\u8bf7\u6c42\u914d\u7f6e\u7c7b\u578b\uff0c\u53ef\u4ee5\u662f\u542f\u52a8\u6216\u8005\u662f\u9644\u52a0\n            \"program\": \"${workspaceFolder}\/test\", \/\/\u7a0b\u5e8f\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5b8c\u6574\u8def\u5f84\uff0c${workspaceFolder}\u8868\u793a\u8fdc\u7a0b\u8fde\u63a5\u7684\u521d\u59cb\u8def\u5f84\n            \"args\": [], \/\/\u4f20\u9012\u7ed9\u7a0b\u5e8f\u7684\u547d\u4ee4\u884c\u53c2\u6570\n            \"stopAtEntry\": false,\/\/\u53ef\u9009\u53c2\u6570\uff0c\u5982\u679c\u4e3atrue,\u8c03\u8bd5\u7a0b\u5e8f\u5e94\u8be5\u5728\u5165\u53e3\uff08main\uff09\u5904\u505c\u6b62\n            \"cwd\": \"${workspaceFolder}\", \/\/\u76ee\u6807\u7684\u5de5\u4f5c\u76ee\u5f55\n            \"environment\": [], \/\/\u8868\u793a\u8981\u9884\u8bbe\u7684\u73af\u5883\u53d8\u91cf\n            \"externalConsole\": false,\/\/\u5982\u679c\u4e3atrue\uff0c\u5219\u4e3a\u8c03\u8bd5\u5bf9\u8c61\u542f\u52a8\u63a7\u5236\u53f0\n            \"MIMode\": \"gdb\",\/\/\u8981\u8fde\u63a5\u5230\u7684\u63a7\u5236\u53f0\u542f\u52a8\u7a0b\u5e8f\n            \"setupCommands\": [ \/\/\u4e3a\u4e86\u5b89\u88c5\u57fa\u7840\u8c03\u8bd5\u7a0b\u5e8f\u800c\u6267\u884c\u7684\u4e00\u4e2a\u6216\u591a\u4e2aGDB\/LLDB\u547d\u4ee4\n                {\n                    \"description\": \"\u4e3a gdb \u542f\u7528\u6574\u9f50\u6253\u5370\",\n                    \"text\": \"-enable-pretty-printing\",\n                    \"ignoreFailures\": true\n                }\n            ]\n        }\n    ]\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u81f3\u6b64\u73af\u5883\u914d\u7f6e\u5b8c\u6bd5<\/p>\n<h2><strong>3\u3001GDB \u8c03\u8bd5\u65b9\u6cd5<\/strong><\/h2>\n<p>\u5728\u6e90\u4ee3\u7801\u4e2d\u76f4\u63a5\u70b9\u51fb\u884c\u6570\u5de6\u4fa7\uff0c\u5373\u53ef\u589e\u52a0\u65ad\u70b9\uff0c\u8bbe\u7f6e\u597d\u65ad\u70b9\u4e4b\u540e\uff0c\u70b9\u51fb\u201c\u8fd0\u884c\u548c\u8c03\u8bd5\u201d&#8211;\uff08gdb\uff09\u542f\u52a8\uff0c\u5982\u4e0b<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/c14b05ecf0202c6025a285ad1711d4d2-5.png\" class=\"aligncenter\" title=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe6\" alt=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe6\" \/><\/p>\n<p>\u5373\u53ef\u8fdb\u5165\u8c03\u8bd5\u9875\u9762<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/c14b05ecf0202c6025a285ad1711d4d2-6.png\" class=\"aligncenter\" title=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe7\" alt=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe7\" \/><\/p>\n<p>\u53ef\u4ee5\u5728\u53d8\u91cf\u533a\u76f4\u63a5\u770b\u5230\u53d8\u91cf\u503c\uff0c\u5b8c\u6210\u8c03\u8bd5\u76ee\u7684\u3002<\/p>\n<p>\u5e38\u7528\u7684\u8c03\u8bd5\u6309\u952e\u5982\u4e0b<\/p>\n<blockquote><p>\n  F5&nbsp; &nbsp; \u5f00\u59cb\u8c03\u8bd5F10&nbsp; &nbsp;\u5355\u6b65\u8df3\u8fc7F11&nbsp; &nbsp;\u5355\u6b65\u8c03\u8bd5shift + F11&nbsp; &nbsp;\u5355\u6b65\u8df3\u51factrl + shift + F5&nbsp; \u91cd\u542f\u8c03\u8bd5shift + F5&nbsp; \u505c\u6b62\u8c03\u8bd5\n<\/p><\/blockquote>\n<h2><strong>4\u3001\u95ee\u9898\u6c47\u603b<\/strong><\/h2>\n<p>\u5982\u679c\u4e4b\u524d\u8fde\u63a5\u8fc7\u67d0\u53f0\u8bbe\u5907\uff0c\u540e\u7eed\u66f4\u6362\u8bbe\u5907\u662f\u540c\u4e00\u4e2aIP\uff0c\u6216\u8005\u8bf4\u8bbe\u5907\u91cd\u88c5\u8fc7\u7cfb\u7edf\uff0c\u4f46IP\u6ca1\u53d8\uff0c\u91cd\u8fde\u7684\u65f6\u5019\u4f1a\u62a5\u9519\uff0c\u539f\u56e0\u662f\u4e3b\u673a\u5c06\u670d\u52a1\u5668 IP \u5217\u4e3aknown_host<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/3c6344cb8816f24e304e96d3a436bdf7-7.png\" class=\"aligncenter\" title=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe8\" alt=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe8\" \/><\/p>\n<p>&nbsp;\u6211\u4eec\u627e\u5230\u4fee\u6539\u5220\u9664\u8be5 IP \u7136\u540e\u91cd\u8fde\u5373\u53ef<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/3c6344cb8816f24e304e96d3a436bdf7-8.png\" class=\"aligncenter\" title=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe9\" alt=\"vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u63d2\u56fe9\" \/><\/p>\n<p>\u66f4\u591a\u5173\u4e8eVSCode\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u8bbf\u95ee\uff1a\uff01<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fvscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u65b9\u6cd5\u8be6\u89e3\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>vscode\u4e2d\u600e\u4e48\u8fdc\u7a0bgdb\u8c03\u8bd5\uff1f\u4e0b\u9762\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e0bvscode\u8fdc\u7a0bgdb\u8c03\u8bd5\u7684\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\uff01 \u6700\u8fd1\u5728\u540c\u4e8b\u7684\u5b89\u5229\u4e0b\uff0c\u5c1d\u8bd5\u4e86\u7528 vscode \u505a gdb \u8c03\u8bd5\uff0c\u7528\u5b8c\u4e4b\u540e\uff0c\u201c\u771f\u9999\u201d\u3002 \u8bdd\u4e0d\u591a\u8bf4\uff0c\u672c\u6587\u8981\u5b9e\u73b0\u7684\u662f\uff1a\u5728 windows \u7aef\u8fdc\u7a0b\u8c03\u8bd5 linux \u670d\u52a1\u5668\u548c arm \u5d4c\u5165\u5f0f\u8bbe\u5907\u4e0a\u7684 c++ \u4ee3\u7801\uff0c\u5bf9 gdb \u8c03\u8bd5\u7684\u914d\u7f6e\u53ca\u4f7f\u7528\u8fdb\u884c\u4e00\u4e2a\u6574\u7406\u3002 1\u3001\u8fdc\u7a0b\u8fde\u63a5 \u9996\u5148\u9700\u8981\u5b9e\u73b0\u8fdc\u7a0b\u8fde\u63a5\u670d\u52a1\u5668\uff0c\u5728\u63d2\u4ef6\u5e93\u4e2d\u641c\u7d22 \u201cremote-ssh\u201d\uff0c\u53cc\u51fb\u4e0b\u8f7d\u5b89\u88c5\u5373\u53ef\uff08\u4e0b\u56fe\u4e2d\u6211\u5df2\u5b89\u88c5\u597d\uff09\uff0c\u5b89\u88c5\u597d\u4e4b\u540e\u5728\u4fa7\u8fb9\u680f\u51fa\u73b0\u8fdc\u7a0b\u8d44\u6e90\u7ba1\u7406\u5668\u3002\u3010\u63a8\u8350\u5b66\u4e60\uff1a\u3001\u3011 \u70b9\u51fb \uff0b \u53f7\uff0c\u5728\u5f39\u51fa\u7684\u547d\u4ee4\u7a97\u53e3\u4e2d\u8f93\u5165 ssh \u767b\u9646\u6307\u4ee4\uff0c\u6309\u7167\u63d0\u793a\uff0c\u8f93\u5165\u5bc6\u7801\u5e76\u786e\u8ba4\uff0c\u5373\u53ef\u8fde\u63a5\u6210\u529f 2\u3001\u914d\u7f6e GDB \u73af\u5883 \u5728\u670d\u52a1\u7aef\u521b\u5efa\u4e00\u4e2a c++ \u4ee3\u7801\uff0c\u8fd9\u91cc\u4ee5\u300a\u300b\u4e2d\u7684\u4ee3\u7801\u4e3a\u4f8b\uff0c\u5f88\u7b80\u5355 #include &lt;unistd.h&gt; #include &lt;pwd.h&gt; #include &lt;iostream&gt; int main() { struct passwd* pwd; uid_t userid; userid = getuid(); pwd = getpwuid(userid); std::cout &lt;&lt; &#8220;pw_name:&#8221; &lt;&lt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-19873","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19873","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=19873"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19873\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19873"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19873"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19873"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}