📄 cyggdb.htm
字号:
<title>GNU's gdb from Cygnus Support</title> <h1 align=center>GNU's gdb from Cygnus Support</h1><!--INDEX "Source-level debug with Cygnus' gdb" -->To use the debug <a href="mondef.htm">Monitor</a> with GNU's gdb,connect the serial port that gdb will use, to the Monitor's tty0 (theconsole) on the target board. i.e., gdb only uses one serial port.<p><!--If necessary, use the <a href="c_set.htm">set</a> command to set your<a href="mondef.htm">Monitor</a>'s prompt to "PMON> ". Gdb ishardwired to expect that string, and will not work with any other value(note the space after the ">").<p>-->Compile and link your modules with the -g option. This will generatethe extra information that is required by gdb. For example,<p><pre> pmcc -g -o bubble bubble.c</pre>Invoke gdb.<p><pre> % mips-lsi-elf-gdb -b 9600 bubble</pre>where 'bubble' is the name of the object file that you are debugging.The option "-b 9600" specifies that 9600 baud will be used for theHost-to-Target communications.<p>By default gdb from Cygnus Support runs in a windowed mode. However, itthe time of writing, the windowed mode was incomplete/buggy, so you mightprefer to run it in non-windowed mode. To select non-windowed mode, addthe option -nw to the command line.<p><pre> % mips-lsi-elf-gdb -nw -b 9600 bubble</pre>gdb normally expects your monitor to have a prompt of "PMON> " (notethe space). If your monitor uses a different type of prompt you caneither change it in the Monitor using the <a href="c_set.htm">set</a>command or tell gdb what prompt to expect. For example,<p><pre> (gdb) set monitor-prompt IMON> </pre>Note that this command does <i>not</i> expect quotes around the prompt,but gdb will take the entire string including trailing spaces. So be carefulto type the string exactly.<p>Next you must specify the target type, and serial portthat will be used to communicated with the target. For example,<p><pre> (gdb) target lsi /dev/ttyb</pre>this specifies that the target is running LSI Logic's PMON (or IMON),and that the target is connected to /dev/ttyb on the host. If you areusing <a href="dosdef.htm">MSDOS</a> you will need to specify one ofthe COM ports. eg. com1.<p>To download your program to the Target issue the "load" command. Noarguments are necessary as gdb has all the other information it needs.<p><pre> (gdb) load</pre>If you simply want to run your program, you can just type "run". But ifas is more likely you want to be able to set breakpoints and single-stepyour program, you should type,<p><pre> (gdb) b main (gdb) run</pre>this will set a breakpoint at "main" and execute the program until itreaches that point.<p>The following table is a summary of the most frequently used commands:<p><center><table border cellpadding=6 width=80%><tr><th colspan=3>Brief Command Summary</th></tr><tr><th>gdb</th><th>PMON/IMON equivalent</th><th>Description</th></tr><tr><td>step</td><td>t</td><td>Single Step</td></tr><tr><td>next</td><td>to</td><td>Step Over</td></tr><tr><td>b addr</td><td>b addr</td><td>Set Breakpoint</td></tr><tr><td>delete</td><td>db *</td><td>Delete</td></tr><tr><td>c</td><td>c</td><td>Continue</td></tr><tr><td>run</td><td>g</td><td>Start Execution</td></tr></table></center><p>When debugging the Host-to-Target communications it is sometimes usefulto create of log of all the transactions. The following command writesa log to the file "remote.log".<p><pre> (gdb) set remotelogfile remote.log</pre></dl><p><hr><b>Navigation:</b> <a href="index.htm">Document Home</a> | <a href="doctoc.htm">Document Contents</a> | <a href="docindex.htm">Document Index</a> <p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -