• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/gdb/
1<html lang="en">
2<head>
3<title>Aliases - Debugging with GDB</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Debugging with GDB">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Extending-GDB.html#Extending-GDB" title="Extending GDB">
9<link rel="prev" href="Python.html#Python" title="Python">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<!--
12Copyright (C) 1988-2013 Free Software Foundation, Inc.
13
14Permission is granted to copy, distribute and/or modify this document
15under the terms of the GNU Free Documentation License, Version 1.3 or
16any later version published by the Free Software Foundation; with the
17Invariant Sections being ``Free Software'' and ``Free Software Needs
18Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
19and with the Back-Cover Texts as in (a) below.
20
21(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
22this GNU Manual.  Buying copies from GNU Press supports the FSF in
23developing GNU and promoting software freedom.''
24-->
25<meta http-equiv="Content-Style-Type" content="text/css">
26<style type="text/css"><!--
27  pre.display { font-family:inherit }
28  pre.format  { font-family:inherit }
29  pre.smalldisplay { font-family:inherit; font-size:smaller }
30  pre.smallformat  { font-family:inherit; font-size:smaller }
31  pre.smallexample { font-size:smaller }
32  pre.smalllisp    { font-size:smaller }
33  span.sc    { font-variant:small-caps }
34  span.roman { font-family:serif; font-weight:normal; } 
35  span.sansserif { font-family:sans-serif; font-weight:normal; } 
36--></style>
37<link rel="stylesheet" type="text/css" href="../cs.css">
38</head>
39<body>
40<div class="node">
41<a name="Aliases"></a>
42<p>
43Previous:&nbsp;<a rel="previous" accesskey="p" href="Python.html#Python">Python</a>,
44Up:&nbsp;<a rel="up" accesskey="u" href="Extending-GDB.html#Extending-GDB">Extending GDB</a>
45<hr>
46</div>
47
48<h3 class="section">23.3 Creating new spellings of existing commands</h3>
49
50<p><a name="index-aliases-for-commands-2210"></a>
51It is often useful to define alternate spellings of existing commands. 
52For example, if a new <span class="sc">gdb</span> command defined in Python has
53a long name to type, it is handy to have an abbreviated version of it
54that involves less typing.
55
56   <p><span class="sc">gdb</span> itself uses aliases.  For example &lsquo;<samp><span class="samp">s</span></samp>&rsquo; is an alias
57of the &lsquo;<samp><span class="samp">step</span></samp>&rsquo; command even though it is otherwise an ambiguous
58abbreviation of other commands like &lsquo;<samp><span class="samp">set</span></samp>&rsquo; and &lsquo;<samp><span class="samp">show</span></samp>&rsquo;.
59
60   <p>Aliases are also used to provide shortened or more common versions
61of multi-word commands.  For example, <span class="sc">gdb</span> provides the
62&lsquo;<samp><span class="samp">tty</span></samp>&rsquo; alias of the &lsquo;<samp><span class="samp">set inferior-tty</span></samp>&rsquo; command.
63
64   <p>You can define a new alias with the &lsquo;<samp><span class="samp">alias</span></samp>&rsquo; command.
65
66     
67<a name="index-alias-2211"></a>
68<dl><dt><code>alias [-a] [--] </code><var>ALIAS</var><code> = </code><var>COMMAND</var><dd>
69</dl>
70
71   <p><var>ALIAS</var> specifies the name of the new alias. 
72Each word of <var>ALIAS</var> must consist of letters, numbers, dashes and
73underscores.
74
75   <p><var>COMMAND</var> specifies the name of an existing command
76that is being aliased.
77
78   <p>The &lsquo;<samp><span class="samp">-a</span></samp>&rsquo; option specifies that the new alias is an abbreviation
79of the command.  Abbreviations are not shown in command
80lists displayed by the &lsquo;<samp><span class="samp">help</span></samp>&rsquo; command.
81
82   <p>The &lsquo;<samp><span class="samp">--</span></samp>&rsquo; option specifies the end of options,
83and is useful when <var>ALIAS</var> begins with a dash.
84
85   <p>Here is a simple example showing how to make an abbreviation
86of a command so that there is less to type. 
87Suppose you were tired of typing &lsquo;<samp><span class="samp">disas</span></samp>&rsquo;, the current
88shortest unambiguous abbreviation of the &lsquo;<samp><span class="samp">disassemble</span></samp>&rsquo; command
89and you wanted an even shorter version named &lsquo;<samp><span class="samp">di</span></samp>&rsquo;. 
90The following will accomplish this.
91
92<pre class="smallexample">     (gdb) alias -a di = disas
93</pre>
94   <p>Note that aliases are different from user-defined commands. 
95With a user-defined command, you also need to write documentation
96for it with the &lsquo;<samp><span class="samp">document</span></samp>&rsquo; command. 
97An alias automatically picks up the documentation of the existing command.
98
99   <p>Here is an example where we make &lsquo;<samp><span class="samp">elms</span></samp>&rsquo; an abbreviation of
100&lsquo;<samp><span class="samp">elements</span></samp>&rsquo; in the &lsquo;<samp><span class="samp">set print elements</span></samp>&rsquo; command. 
101This is to show that you can make an abbreviation of any part
102of a command.
103
104<pre class="smallexample">     (gdb) alias -a set print elms = set print elements
105     (gdb) alias -a show print elms = show print elements
106     (gdb) set p elms 20
107     (gdb) show p elms
108     Limit on string chars or array elements to print is 200.
109</pre>
110   <p>Note that if you are defining an alias of a &lsquo;<samp><span class="samp">set</span></samp>&rsquo; command,
111and you want to have an alias for the corresponding &lsquo;<samp><span class="samp">show</span></samp>&rsquo;
112command, then you need to define the latter separately.
113
114   <p>Unambiguously abbreviated commands are allowed in <var>COMMAND</var> and
115<var>ALIAS</var>, just as they are normally.
116
117<pre class="smallexample">     (gdb) alias -a set pr elms = set p ele
118</pre>
119   <p>Finally, here is an example showing the creation of a one word
120alias for a more complex command. 
121This creates alias &lsquo;<samp><span class="samp">spe</span></samp>&rsquo; of the command &lsquo;<samp><span class="samp">set print elements</span></samp>&rsquo;.
122
123<pre class="smallexample">     (gdb) alias spe = set print elements
124     (gdb) spe 20
125</pre>
126   </body></html>
127
128