⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debuggers.html

📁 ADI 公司blackfin系列的用户使用文挡。
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head>  <title></title>  <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />  <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />  <link rel="stylesheet" media="print" type="text/css" href="./print.css" />  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><a href=start.html>start</a></br><div class="toc"><div class="tocheader toctoggle" id="toc__header">Table of Contents</div><div id="toc__inside"><ul class="toc"><li class="level1"><div class="li"><span class="li"><a href="#debuggers" class="toc">Debuggers</a></span></div><ul class="toc"><li class="level2"><div class="li"><span class="li"><a href="#debugging_single_applications" class="toc">Debugging Single Applications</a></span></div><ul class="toc"><li class="level3"><div class="li"><span class="li"><a href="#debugging_via_serial_port" class="toc">Debugging Via Serial Port</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#debugging_via_ethernet" class="toc">Debugging Via Ethernet</a></span></div></li></ul></li><li class="level2"><div class="li"><span class="li"><a href="#debugging_dynamic_object_libraries" class="toc">Debugging Dynamic Object Libraries</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#debugging_kernel" class="toc">Debugging Kernel</a></span></div><ul class="toc"><li class="level3"><div class="li"><span class="li"><a href="#debugging_via_ethernet1" class="toc">Debugging Via Ethernet</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#debugging_via_the_second_uart" class="toc">Debugging Via the second UART</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#debugging_via_jtag_gdbproxy" class="toc">Debugging via Jtag (gdbproxy)</a></span></div></li></ul></li><li class="level2"><div class="li"><span class="li"><a href="#common_gdb_commands" class="toc">Common gdb Commands</a></span></div></li></ul></li><li class="level1"><div class="li"><span class="li"><a href="#using_a_graphical_debugger" class="toc">Using a Graphical Debugger</a></span></div><ul class="toc"><li class="level2"><div class="li"><span class="li"><a href="#ddd" class="toc">DDD</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#eclipse" class="toc">Eclipse</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#the_gnat_programming_studio_gps" class="toc">The GNAT Programming Studio (GPS)</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#insight" class="toc">Insight</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#visual_dsp" class="toc">Visual DSP++</a></span></div></li></ul></li><li class="level1"><div class="li"><span class="li"><a href="#external_resources" class="toc">External Resources</a></span></div></li></ul></div></div><h1><a name="debuggers" id="debuggers">Debuggers</a></h1><div class="level1"><p><em>gdb</em> is the one and only standard debugger for the GNU toolchain. Learning and understanding gdb will not only help you do source level debugging on kernel, driver, libraries and applications, but will also improve your productivity. While graphical front ends like DDD and eclipse simplify the interface to gdb, understanding gdb at a command line will also help you run the graphical front ends better. </p><p></p><p>gdb is not the only way to resolve issues &ndash; check out <a href="debuging_applications.html" class="wikilink1" title="debuging_applications.html">debuging applications</a> for other methods.</p><p>gdb is part of the Blackfin toolchain and can be found on the Blackfin/uClinux website <a href="http://blackfin.uclinux.org/projects/gcc3" class="urlextern" title="http://blackfin.uclinux.org/projects/gcc3"  rel="nofollow">here</a>.  Click on the <em>Files</em> tab to obtain the latest release of gdb. To install gdb (for ethernet or serial), since it is not packaged separately, check the instructions on <a href="installing_the_blackfin_tool_chain.html" class="wikilink1" title="installing_the_blackfin_tool_chain.html">installing the Blackfin tool chain</a> to either build from source, or use a pre-compiled rpm for your system. If you want gdb for jtag you must install that separately. See the <a href="http://blackfin.uclinux.org/projects/jtag/" class="urlextern" title="http://blackfin.uclinux.org/projects/jtag/"  rel="nofollow">gdb/jtag site</a> for more information.</p><p>There are two main types of code which need to be debugged:</p><ul><li class="level1"><div class="li"> applications (using gdb)</div></li><li class="level1"><div class="li"> drivers or kernel (using kgdb)</div></li></ul></div><!-- SECTION [1-1365] --><h2><a name="debugging_single_applications" id="debugging_single_applications">Debugging Single Applications</a></h2><div class="level2"><p> <a href="compiling_the_kernel.html" class="wikilink1" title="compiling_the_kernel.html">Compiling the Kernel</a><a href="adding_user_applications.html" class="wikilink1" title="adding_user_applications.html">Adding User Applications</a> </p><p>To debug your program, the the uClinux kernel must be build in a specific manner:</p><ol><li class="level1"><div class="li"> add the program <code>gdbserver</code> as well as the application you wish to debug.  </div><ul><li class="level2"><div class="li"> <code>gdbserver</code> is found in the <code>Application Configuration</code> window (displayed by choosing <code>Customize Vendor/User Settings</code>) under the <code>Blackfin app programs</code> category. </div></li></ul></li><li class="level1"><div class="li"> make the bootimage</div></li><li class="level1"><div class="li"> load this kernel&rsquo;s memory image onto the target system and boot the kernel.</div></li><li class="level1"><div class="li"> Load symbols into GDB from user-app.gdb if user-app is built into FLAT binary.</div></li><li class="level1"><div class="li"> Load symbols into GDB from user-app directly if user-app is built into ELF binary.</div></li><li class="level1"><div class="li"> since <code>gdbserver</code> can communicate with the host computer through a serial connection or through an Ethernet connection, you must decide which you want to do.</div></li></ol></div><!-- SECTION [1366-2339] --><h3><a name="debugging_via_serial_port" id="debugging_via_serial_port">Debugging Via Serial Port</a></h3><div class="level3"><p>The following instruction explain how to remotely debug uClinux programs via the serial port. </p><ul><li class="level1"><div class="li"> on the target system enter the following command at the uClinux prompt: <pre class="code">uClinux&gt; gdbserver /dev/ttyS1 &lt;program to debug&gt;</pre></div></li></ul><p>This assumes you are connecting to <code>gdb</code> through the device ttyS1 on the target system.</p><ul><li class="level1"><div class="li"> on the Linux host computer enter the following command:<pre class="code">bash$ bfin-uclinux-gdb -b 57600 &lt;program to debug&gt;.gdb</pre><p> The -b switch specifies the baud rate the program will use with the serial port, 57600 in this example. The <code>*.gdb</code> file for your program is generated when your program is compiled.  It can be found in your program&rsquo;s directory.  For more information see <a href="adding_user_applications.html" class="wikilink1" title="adding_user_applications.html">Adding User Applications</a>.  If your program complied successfully and the <code>*.gdb</code> file does not exist, ensure that you are calling <code>gcc</code> with the <code>-g</code> switch.  This should be done by default when using the procedure described in the <a href="adding_user_applications.html" class="wikilink1" title="adding_user_applications.html">Adding User Applications </a>  section.</p></div></li></ul><p>  <em>gdb</em><em>gdb</em> <code>gdb) target remote /dev/ttyS0</code> <em>gdbserver</em>  </p><ul><li class="level1"><div class="li"> You should now be connected to the target system.  To start debugging your program with a breakpoint at the start of the function <em>main</em> enter the following commands at the <code>gdb</code> prompt:<pre class="code">gdb) break maingdb) continue</pre><p> You must use the continue command instead of the run command because the program is already running on the remote system.</p></div></li></ul><p>  <em>gdb</em><code>gdb</code> </p></div><!-- SECTION [2340-4186] --><h3><a name="debugging_via_ethernet" id="debugging_via_ethernet">Debugging Via Ethernet</a></h3><div class="level3"><p>The following instruction explain how to remotely debug uClinux programs via an Ethernet connection. </p><ul><li class="level1"><div class="li"> if the target system not already been assigned an IP address this must be done with a command similar to the following: <pre class="code">uClinux&gt; ifconfig eth0 &lt;IP address to assign to system&gt;ORuClinux&gt; dhcpcd &amp;</pre><p>Once this is done you may wish to check if you can communicate with the Linux host by using the <code>ping</code> utility.  </p></div></li><li class="level1"><div class="li"> start <code>gdbserver</code> on the target system by entering the following commands:<pre class="code">uClinux&gt; gdbserver localhost:3456 &lt;program to debug&gt;</pre><p>Any port number (3456) may be used as long as it does not conflict with any port already in use on the system or the Linux host.</p></div></li><li class="level1"><div class="li"> on the Linux host computer enter the following command:<pre class="code">bash$ bfin-uclinux-gdb &lt;program to debug&gt;.gdb</pre><p> The <code>*.gdb</code> file for your program is generated when your program is compiled.  It can be found in your program&rsquo;s directory.  For more information see <a href="adding_user_applications.html" class="wikilink1" title="adding_user_applications.html">Adding User Applications</a>.  If your program complied successfully and the <code>*.gdb</code> file does not exist, ensure that you are calling <code>gcc</code> with the <code>-g</code> switch.  This should be done by default when using the procedure described in the <a href="adding_user_applications.html" class="wikilink1" title="adding_user_applications.html">Adding User Applications </a>section.</p></div></li></ul><p> <code>gdb</code><code>gdb</code></p><p> <code>gdb) target remote &lt;IP address of target system&gt;:3456</code></p><p><code>gdbserver</code>  </p><ul><li class="level1"><div class="li"> You should now be connected to the target system.  To start debugging your program with a breakpoint at the start of the function <code>main</code> enter the following commands at the host machine <code>gdb</code> prompt:<pre class="code">gdb) break maingdb) continue</pre></div></li><li class="level1"><div class="li"> You must use the continue command instead of the run command because the program is already running on the remote system.</div></li></ul><p>  <code>gdb</code><code>gdb</code> </p></div><!-- SECTION [4187-6351] --><h2><a name="debugging_dynamic_object_libraries" id="debugging_dynamic_object_libraries">Debugging Dynamic Object Libraries</a></h2><div class="level2"><p>The way to debug dynamic object library by GDB is nearly the same as that of application.  Only several differences:</p><ol><li class="level1"><div class="li"> User object library libusertest.so should be compiled with flag &ldquo;-shared -mfdpic -g -ldl&rdquo;.</div></li><li class="level1"><div class="li"> User application usertest should be compiled with flag &ldquo;-mfdpic -g&rdquo;.</div></li><li class="level1"><div class="li"> Library libdl.so and libusertest.so should be copied to folder &ldquo;lib&rdquo; in the root file system image first. User application &ldquo;usertest&rdquo; should be copied to a proper position in the same image.</div></li><li class="level1"><div class="li"> Start GDB on host with the user application. <pre class="code"> /&gt; bfin-uclinux-gdb usertest</pre></div></li>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -