📄 using-commandline-testcase.html
字号:
<!-- Copyright (C) 2003 Red Hat, Inc. --><!-- This material may be distributed only subject to the terms --><!-- and conditions set forth in the Open Publication License, v1.0 --><!-- or later (the latest version is presently available at --><!-- http://www.opencontent.org/openpub/). --><!-- Distribution of the work or derivative of the work in any --><!-- standard (paper) book form is prohibited unless prior --><!-- permission is obtained from the copyright holder. --><HTML><HEAD><TITLE>Using the command line</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos User Guide"HREF="ecos-user-guide.html"><LINKREL="UP"TITLE="Running an eCos Test Case"HREF="running-an-ecos-test-case.html"><LINKREL="PREVIOUS"TITLE="Running an eCos Test Case"HREF="running-an-ecos-test-case.html"><LINKREL="NEXT"TITLE="Testing Filters"HREF="testing-filters.html"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos User Guide</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="running-an-ecos-test-case.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 12. Running an <SPANCLASS="PRODUCTNAME">eCos</SPAN> Test Case</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="testing-filters.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="USING-COMMANDLINE-TESTCASE">Using the command line</H1><P>Start a command shell (such as a Cygwin shell window in Windows)with the environment variables set as described in the toolchaindocumentation. Change to the directory in which you set up your buildtree, and invoke GDB on the testprogram.</P><P>To run the bin_sem0 test (which willtest the kernel for the correct creation and destruction of binarysemaphores) type: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">$ <TTCLASS="REPLACEABLE"><I>TARGET-</I></TT>gdb -nw install/tests/kernel/<TTCLASS="REPLACEABLE"><I><version></I></TT>/tests/bin_sem0</PRE></TD></TR></TABLE><P>You should see output similar to the following in the commandwindow:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">GNU gdb THIS-GDB-VERSIONCopyright 2001 Free Software Foundation, Inc.GDB is free software, covered by the GNU General Public License, and you arewelcome to change it and/or distribute copies of it under certain conditions.Type "show copying" to see the conditions.There is absolutely no warranty for GDB. Type "show warranty" for details.This GDB was configured as "--host=THIS-HOST --target=THIS-TARGET".(gdb)</PRE></TD></TR></TABLE><P>If you are trying to run a synthetic target test on Linux, skip the following connection and downloadsteps. Otherwise, connect to the target by typing: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">(gdb) set remotebaud 38400(gdb) target remote /dev/ttyS0</PRE></TD></TR></TABLE><P>on Linux or</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">(gdb) set remotebaud 38400(gdb) target remote com1</PRE></TD></TR></TABLE><P>on Windows or</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">(gdb) target sim</PRE></TD></TR></TABLE><P>to use a simulator in either host O/S.</P><P>Check the documentation for the target board for the actual baud rateto use when connecting to real targets.</P><P>You will see output similar to the following: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">Remote debugging using /dev/ttyS10x0000d50c in ?? () at <TTCLASS="REPLACEABLE"><I>BASE_DIR</I></TT>/kernel/<TTCLASS="REPLACEABLE"><I><version></I></TT>/src/common/kapi.cxx:345Current language: auto; currently c++(gdb) </PRE></TD></TR></TABLE><P>Or if you are using the simulator:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">Connected to the simulator.(gdb)</PRE></TD></TR></TABLE><P>Now download the program to the target with</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">(gdb) load</PRE></TD></TR></TABLE><P>You should see output similar to the following on your screen: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">Loading section .text, size 0x4b04 lma 0x108000Loading section .rodata, size 0x738 lma 0x10cb08Loading section .data, size 0x1c0 lma 0x10d240Start address 0x108000, load size 21500Transfer rate: 24571 bits/sec, 311 bytes/write.(gdb)</PRE></TD></TR></TABLE><P>You are now ready to run your program. If you type: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">(gdb) continue</PRE></TD></TR></TABLE><P>you will see output similar to the following: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">Continuing.PASS:<Binary Semaphore 0 OK>EXIT:<done></PRE></TD></TR></TABLE><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B> If you are using a simulator or the synthetic target rather than real hardware, you must use the GDB command “run” rather than “continue” to start your program.</P></BLOCKQUOTE></DIV><P>You can terminate your GDB session with<SPANCLASS="emphasis"><ICLASS="EMPHASIS">Control+C</I></SPAN>, otherwise it will sit in the“idle” thread and use up CPU time. This is not a problemwith real targets, but may have undesirable effects in simulated orsynthetic targets. Type <BCLASS="COMMAND">quit</B> and you aredone. </P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="running-an-ecos-test-case.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-user-guide.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="testing-filters.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Running an <SPANCLASS="PRODUCTNAME">eCos</SPAN> Test Case</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="running-an-ecos-test-case.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Testing Filters</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -