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

📄 debuggers.html

📁 ADI 公司blackfin系列的用户使用文挡。
💻 HTML
📖 第 1 页 / 共 3 页
字号:
</li><li class="level1"><div class="li"> Download linux image to the board and boot it</div></li><li class="level1"><div class="li"> Start gdbproxy<pre class="code">host$&gt; sudo gdbproxy bfin</pre></div></li><li class="level1"><div class="li"> Connect gdb to gdbproxy<pre class="code">host$&gt; bfin-elf-gdb vmlinux(gdb) target remote :2000</pre></div></li><li class="level1"><div class="li"> Now the kernel should be stopped in idle loop.</div></li><li class="level1"><div class="li"> Set software breakpoint<pre class="code">(gdb) b cpuinfo_open(gdb) c</pre></div></li><li class="level1"><div class="li"> When you do <code>cat /proc/cpuinfo</code> on the target board, it should stopped at <code>cpuinfo_open ()</code>.</div></li></ol><p> <strong>Example 2.</strong> Debugging the kernel boot process from the first instruction at 0&times;1000 </p><ol><li class="level1"><div class="li"> Run u-boot and tftp the kernel image</div></li><li class="level1"><div class="li"> Set a <strong>hardware</strong> breakpoint at 0&times;1000, the address of the first instruction the kernel executes when it boots<pre class="code">(gdb) hb *0x1000</pre></div></li><li class="level1"><div class="li"> Boot the kernel<pre class="code">stamp&gt; boote</pre></div></li><li class="level1"><div class="li"> Just after u-boot jumps to the first instruction of kernel, the kernel will stop, gdb will print out that the kernel has stopped at 0&times;1000</div></li></ol><p> <strong>Example 3.</strong> To load an ELF binary into memory and execute</p><pre class="code">(gdb) load blink.dxeLoading section .text, size 0x1b8 lma 0xffa00000Start address 0xffa00000, load size 440Transfer rate: 3520 bits in &lt;1 sec, 440 bytes/write.(gdb) cContinuing.</pre><p>More commands: see <a href="http://sources.redhat.com/gdb/current/onlinedocs/gdb_toc.html" class="urlextern" title="http://sources.redhat.com/gdb/current/onlinedocs/gdb_toc.html"  rel="nofollow">GDB help</a></p><p>Note that the above examples assume, that the peripheral hardware has been properly initialized. GDB does not initialize anything on start, since it has no knowledge about the current state of the system. Before you load a program into the Blackfin, make sure you have done the correct initialization - read more hints below.</p><p>For different system configurations, GDB scripts are used. GDB scripting is a very powerful feature and helps to automatize different system configurations.</p><p>     </p></div><!-- SECTION [10975-16486] --><h2><a name="common_gdb_commands" id="common_gdb_commands">Common gdb Commands</a></h2><div class="level2"><p>A summary of some common <em>gdb</em> commands are given below: </p><ul><li class="level1"><div class="li"> <strong>break &lt;function or </strong><strong>filename:line#&gt;</strong> - This command sets a breakpoint at the specified function or line number.  (e.g. break main, break myprog.c:7).</div></li><li class="level1"><div class="li"> <strong>continue</strong> - This command continues program execution from the point where it was last stopped.</div></li><li class="level1"><div class="li"> <strong>delete &lt;breakpoint# or </strong><strong>watchpoint</strong><strong>#&gt;</strong> - This command deletes the breakpoint or watchpoint specified by the breakpoint or watchpoint number.  The watchpoint / breakpoint number is given when the watchpoint / breakpoint is first set.</div></li><li class="level1"><div class="li"> <strong>disable &lt;breakpoint#&gt;</strong> - This command disables the breakpoint specified by the breakpoint number.  The breakpoint number is given when the breakpoint is first set.</div></li><li class="level1"><div class="li"> <strong>run</strong> - This command starts the program being debugged.  The <em>continue</em> command is used instead of <em>run</em> when debugging a program on a remote target.</div></li><li class="level1"><div class="li"> <strong>set variable &lt;symbol&gt; = &lt;value&gt;</strong> - This commands sets a variable specified by <em>symbol</em> to the given value. (e.g. set variable x = 3).</div></li><li class="level1"><div class="li"> <strong>step</strong> - This command executes the next line of code given in the source file.</div></li><li class="level1"><div class="li"> <strong>watch &lt;symbol&gt;</strong> - This command sets a watchpoint for the variable specified by the given symbol.  Whenever the value of the variable is changed <em>gdb</em> will alert you to the old value and the new value of the variable.  (e.g. To watch the value of a variable called <em>X</em> enter the command watch <em>X</em>).</div></li></ul><p><em>gdb</em> provides much more functionality that cannot be covered here.  Click <a href="http://www.gnu.org/software/gdb/documentation" class="urlextern" title="http://www.gnu.org/software/gdb/documentation"  rel="nofollow">here</a> for the gdb manual.</p></div><!-- SECTION [16487-18109] --><h1><a name="using_a_graphical_debugger" id="using_a_graphical_debugger">Using a Graphical Debugger</a></h1><div class="level1"></div><!-- SECTION [18110-18151] --><h2><a name="ddd" id="ddd">DDD</a></h2><div class="level2"><p>Data Display Debugger (<code>ddd</code>) is a graphical front-end for command-line debuggers such as <code>bfin-uclinux-gdb</code>.  For most distributions of Linux, <code>ddd</code> can be installed through the host package manager; alternately, the source code for <code>ddd</code> is available <a href="http://www.gnu.org/software/ddd" class="urlextern" title="http://www.gnu.org/software/ddd"  rel="nofollow">here</a> for you to compile yourself. The complete ddd manual can be found formatted in <a href="http://www.gnu.org/manual/ddd/html_mono/ddd.html" class="urlextern" title="http://www.gnu.org/manual/ddd/html_mono/ddd.html"  rel="nofollow">html</a> or as a <a href="http://www.gnu.org/manual/ddd/pdf/ddd.pdf" class="urlextern" title="http://www.gnu.org/manual/ddd/pdf/ddd.pdf"  rel="nofollow">pdf</a>. The problem with DDD is that the upstream development is not terribly active. However, it is usable, especially for people who are not familiar with GDB commands. </p><p>Once <code>ddd</code> is installed you must ensure that the correct <code>gdb</code> program will be used. To remotely debug uClinux programs, the Blackfin <code>bfin-uclinux-gdb</code> program described earlier must be used. To remotely debug the kernel, the Blackfin <code>bfin-elf-gdb</code> program should be used. To use <code>ddd</code> with either, invoke <code>ddd</code> with the <code>-debugger</code> option. </p><pre class="code">ddd 鈥揹ebugger bfin-uclinux-gdb</pre><p>An overview of the main <code>ddd</code> window is given below. It&rsquo;s also an example of the beginning of a typical debugging session. See the the command line window of <code>ddd</code> in the following screen shot for using <code>file</code> and <code>target remote</code> to connect to the target board:</p></div><h5><a name="source_text_window" id="source_text_window">Source Text Window</a></h5><div class="level5"><p><a href="media/debuggers1.png" class="media" target="_blank" title="debuggers1.png"><img src="media/debuggers1.png" class="medialeft" alt="" /></a></p><p>This window shows your source code along with any breakpoints you have inserted.  The arrow indicates the next line of source code to be executed.</p></div><h5><a name="gdb_console" id="gdb_console">GDB Console</a></h5><div class="level5"><p><a href="media/debuggers2.png" class="media" target="_blank" title="debuggers2.png"><img src="media/debuggers2.png" class="media" alt="" /></a></p><p>This window shows the output from the <code>gdb</code> program.  You can also enter <code>gdb</code> commands in this window.</p></div><h5><a name="command_buttons" id="command_buttons">Command Buttons</a></h5><div class="level5"><p><a href="media/debuggers3.png" class="media" target="_blank" title="debuggers3.png"><img src="media/debuggers3.png" class="media" alt="" /></a></p><p>These buttons execute some common <code>ddd</code> and <code>gdb</code> commands.</p></div><h5><a name="argument_field" id="argument_field">Argument Field</a></h5><div class="level5"><p><a href="media/debuggers4.png" class="media" target="_blank" title="debuggers4.png"><img src="media/debuggers4.png" class="media" alt="" /></a></p><p>This text field sets the value for the argument <strong>()</strong> which is passed to the commands executed by the command buttons.  In this example clicking on the the breakpoint command button would clear the breakpoint at <code>myprog.c:5</code> (myprog.c line 5) as this is the value in the argument field.  The current line or text selection in the source text window is written to this field.  You may also type a value into this field.</p></div><!-- SECTION [18152-20413] --><h2><a name="eclipse" id="eclipse">Eclipse</a></h2><div class="level2"><p>Eclipse is an excellent IDE framework. It supports a lot of plug-ins and the eclipse community keeps growing. In another page <a href="using_eclipse.html#debugging_using_eclipse" class="wikilink1" title="using_eclipse.html">debugging_using_eclipse</a>, we introduced how to set up eclipse for debugging on Blackfin uClinux. Since Eclipse is written in Java, it requires more memory for development system. Eclipse talks with GDB using Machine Interface, while DDD is using command interface. Machine Interface is considered to be more stable.</p></div><!-- SECTION [20414-20893] --><h2><a name="the_gnat_programming_studio_gps" id="the_gnat_programming_studio_gps">The GNAT Programming Studio (GPS)</a></h2><div class="level2"><p> <a href="https://libre2.adacore.com/gps/" class="urlextern" title="https://libre2.adacore.com/gps/"  rel="nofollow">https://libre2.adacore.com/gps/</a> GPS, the GNAT Programming Studio, is a Free Software IDE. With its intuitive interface, GPS is easy to use, simplifying source navigation and highlighting the fundamental ideas in the program.</p><p>Compared the DDD, the debugging interface looks much like modern IDEs.</p><p>GPS is invoked the same way as DDD: </p><pre class="code">ddd 鈥揹ebugger bfin-uclinux-gdb</pre><p>And here is a snap shot: <a href="media/gps_debuggers_1.png" class="media" target="_blank" title="gps_debuggers_1.png"><img src="media/gps_debuggers_1.png" class="medialeft" alt="" /></a></p></div><!-- SECTION [20894-21378] --><h2><a name="insight" id="insight">Insight</a></h2><div class="level2"><p><a href="http://www.sourceware.org/insight/" class="urlextern" title="http://www.sourceware.org/insight/"  rel="nofollow">http://www.sourceware.org/insight/</a> Insight is a graphical user interface to GDB, the GNU Debugger  written in Tcl/Tk by people working at Red Hat, Inc. and Cygnus Solutions. It is combined together with GDB, and built together with GDB. As a result, currently we have no Blackfin porting of Insight. However, when Blackfin GNU toolchain is integrated into mainline GCC toolchains, Insight will support Blackfin.</p></div><!-- SECTION [21379-21815] --><h2><a name="visual_dsp" id="visual_dsp">Visual DSP++</a></h2><div class="level2"><p> It is possible to debug assembly code (uboot, kernel, application) using VDSP. It may be helpful sometime.</p></div><!-- SECTION [21816-21950] --><h1><a name="external_resources" id="external_resources">External Resources</a></h1><div class="level1"><ol><li class="level1"><div class="li"> <a href="http://sourceware.org/gdb/" class="urlextern" title="http://sourceware.org/gdb/"  rel="nofollow">GDB Homepage</a></div></li><li class="level1"><div class="li"> <a href="http://sourceware.org/gdb/documentation/" class="urlextern" title="http://sourceware.org/gdb/documentation/"  rel="nofollow">GDB Manual</a></div></li></ol></div><!-- SECTION [21951-] --></body></html>

⌨️ 快捷键说明

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