{"id":1281,"date":"2013-11-07T10:43:46","date_gmt":"2013-11-07T10:43:46","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=1281"},"modified":"2014-07-09T15:12:06","modified_gmt":"2014-07-09T15:12:06","slug":"eclipse-debugging","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=1281","title":{"rendered":"Eclipse Debugging"},"content":{"rendered":"<h3>GDB<\/h3>\n<p><a href=\"https:\/\/sourceware.org\/gdb\/onlinedocs\/gdb\/Startup.html\">What gdb Does During Startup<\/a><br \/>\n<a href=\"http:\/\/www.yolinux.com\/TUTORIALS\/GDB-Commands.html\">GNU GDB Debugger Command Cheat Sheet<\/a><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n--command=&lt;file&gt;, -x &lt;file&gt;    File listing GDB commands to perform. Good for automating set-up.\r\n--batch -x &lt;file&gt;              Run in batch (not interactive) mode. Execute commands from file.\r\n<\/pre>\n<h4>Source Code Directory<\/h4>\n<p><a href=\"http:\/\/blog.kowalczyk.info\/article\/zt\/Gdb-basics.html\">Gdb basics<\/a><br \/>\nGdb looks for source files in $cdir (directory embedded in executable recorded during compilation) and $cwd (current working directory). You can add to this list via dir e.g. dir ..\\..\\WebCore\\platform. See current list via show dir. If you need this, it&#8217;s a perfect candidate for putting inside .gdbinit file.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n(gdb) info sources\r\nSource files for which symbols have been read in:\r\n\r\n\/home\/andreas\/src\/hcpp\/software\/app\/src\/hcpp\/ptp2_master.c, &#x5B;...]\r\n<\/pre>\n<h3>Stack \/ Stack Trace<\/h3>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/9809810\/gdb-corrupted-stack-frame-how-to-debug\">GDB corrupted stack frame &#8211; How to debug?<\/a><br \/>\n<a href=\"http:\/\/www.chemie.fu-berlin.de\/chemnet\/use\/info\/gdb\/gdb_7.html\">Examining the Stack<\/a><\/p>\n<h3>Watchpoint<\/h3>\n<p><a href=\"http:\/\/help.eclipse.org\/juno\/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_add_watch.htm\">Eclipse Help: Adding watchpoints<\/a><br \/>\n<a href=\"http:\/\/mcuoneclipse.com\/2012\/04\/29\/watchpoints-data-breakpoints-in-mcu10\/\">Watchpoints: Data Breakpoints<\/a><br \/>\n<a href=\"http:\/\/www.fayewilliams.com\/2013\/02\/19\/eclipse-cdt-toggle-watchpoint-greyed-out-juno\/\">Eclipse CDT + GDB: Setting Watchpoints (Juno)<\/a><\/p>\n<h3>Assembler<\/h3>\n<p><a href=\"http:\/\/mcuoneclipse.com\/2012\/10\/27\/assembly-instruction-stepping\/\">Assembly Instruction Stepping<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/14396665\/eclipse-gdb-in-combination-with-openocd\">Eclipse GDB in combination with OpenOCD<\/a><\/p>\n<h3>Scripting<\/h3>\n<p><a href=\"https:\/\/github.com\/gdbinit\/Gdbinit\">github Gdbinit: A user-friendly gdb configuration file, for x86\/x86_64 and ARM platforms<\/a><br \/>\n<a href=\"https:\/\/github.com\/gdbinit\/Gdbinit\/blob\/master\/gdbinit\">github Gdbinit: gdbinit<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/10748501\/automating-gdb-sessions\">Automating GDB Sessions<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/2388799\/automate-gdb-show-backtrace-at-every-call-to-function-puts\">Automate gdb: show backtrace at every call to function puts<\/a><\/p>\n<h3>Remote Debugging<\/h3>\n<pre class=\"brush: plain; title: Remote; notranslate\" title=\"Remote\">\r\n$ gdbserver :2345 .\/program\r\nProcess .\/program created; pid = 1851\r\nListening on port 2345\r\nRemote debugging from host 127.0.0.1\r\n<\/pre>\n<pre class=\"brush: plain; title: Local; notranslate\" title=\"Local\">\r\n$ gdb\r\nGNU gdb (GDB) 7.5-ubuntu\r\nCopyright (C) 2012 Free Software Foundation, Inc.\r\nThis GDB was configured as &quot;x86_64-linux-gnu&quot;.\r\nNo symbol table is loaded.  Use the &quot;file&quot; command.\r\n\r\n(gdb) file .\/program\r\nReading symbols from .\/program...done.\r\n\r\n(gdb) target remote :2345\r\nRemote debugging using :2345\r\nReading symbols from \/lib64\/ld-linux-x86-64.so.2...Reading symbols from \/usr\/lib\/debug\/lib\/x86_64-linux-gnu\/ld-2.15.so...done.\r\nLoaded symbols for \/lib64\/ld-linux-x86-64.so.2\r\n0x00007ffff7ddb6c0 in _start () from \/lib64\/ld-linux-x86-64.so.2\r\n<\/pre>\n<p>Or using Eclipse: C\/C++ Remote Application<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GDB What gdb Does During Startup GNU GDB Debugger Command Cheat Sheet &#8211;command=&lt;file&gt;, -x &lt;file&gt; File listing GDB commands to perform. Good for automating set-up. &#8211;batch -x &lt;file&gt; Run in batch (not interactive) mode. Execute commands from file. Source Code Directory Gdb basics Gdb looks for source files in $cdir (directory embedded in executable recorded [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1281","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/1281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1281"}],"version-history":[{"count":21,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/1281\/revisions"}],"predecessor-version":[{"id":2621,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/1281\/revisions\/2621"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}