{"id":2915,"date":"2019-09-25T13:29:55","date_gmt":"2019-09-25T13:29:55","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=2915"},"modified":"2025-06-30T11:02:59","modified_gmt":"2025-06-30T11:02:59","slug":"remote-debugging-gdbserver","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=2915","title":{"rendered":"Remote debugging (gdbserver)"},"content":{"rendered":"<p>Remote debugging creates the possibility to debug applications on a remote device.<\/p>\n<pre>Host system (gdb) <---[serial\/network]---> Target system (gdbserver)<\/pre>\n<hr>\n<h2>Precondition<\/h2>\n<ul>\n<li>Installed gcc\/g++ and gdb on the host<\/li>\n<li>Installed gdbserver on the target<\/li>\n<li>Connection between host and target<\/li>\n<\/ul>\n<hr>\n<h2>Procedure<\/h2>\n<ol>\n<li>Build the app on the host with debug symbols [Host]\n<pre>\r\ng++ app.cpp -o my_app\r\n<\/pre>\n<\/li>\n<li>Deploy that debug app on the target with scp  [Host]\n<pre>\r\nscp my_app root@192.168.1.4:\/usr\/bin\r\n<\/pre>\n<\/li>\n<li>Open a port and start gdbserver on the app [Target]\n<pre>\r\niptables -A INPUT -p tcp --dport 4444 -j ACCEPT\r\ngdbserver localhost:4444 my_app &\r\n<\/pre>\n<\/li>\n<li>Setup gdb session with running gdbserver [Host]\n<pre>\r\ngdb my_app\r\n(gdb) target remote 192.168.1.4:4444\r\n<\/pre>\n<\/li>\n<li>Debug the app via the created gdb session [Host]\n<pre>\r\n(gdb) b main\r\n(gdb) r\r\n...\r\n<\/pre>\n<\/li>\n<li>Finish gdb session with running gdbserver [Host]\n<pre>\r\n(gdb) q\r\n<\/pre>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Remote debugging creates the possibility to debug applications on a remote device. Host system (gdb) Target system (gdbserver) Precondition Installed<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[28],"tags":[],"_links":{"self":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/2915"}],"collection":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2915"}],"version-history":[{"count":3,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/2915\/revisions"}],"predecessor-version":[{"id":18900,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/2915\/revisions\/18900"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2915"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}