1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!-- Copyright (C) 1988-2021 Free Software Foundation, Inc.
4
5Permission is granted to copy, distribute and/or modify this document
6under the terms of the GNU Free Documentation License, Version 1.3 or
7any later version published by the Free Software Foundation; with the
8Invariant Sections being "Free Software" and "Free Software Needs
9Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
10and with the Back-Cover Texts as in (a) below.
11
12(a) The FSF's Back-Cover Text is: "You are free to copy and modify
13this GNU Manual.  Buying copies from GNU Press supports the FSF in
14developing GNU and promoting software freedom." -->
15<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
16<head>
17<title>Debugging with GDB: Additions to Ada</title>
18
19<meta name="description" content="Debugging with GDB: Additions to Ada">
20<meta name="keywords" content="Debugging with GDB: Additions to Ada">
21<meta name="resource-type" content="document">
22<meta name="distribution" content="global">
23<meta name="Generator" content="makeinfo">
24<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
25<link href="index.html#Top" rel="start" title="Top">
26<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
27<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
28<link href="Ada.html#Ada" rel="up" title="Ada">
29<link href="Overloading-support-for-Ada.html#Overloading-support-for-Ada" rel="next" title="Overloading support for Ada">
30<link href="Omissions-from-Ada.html#Omissions-from-Ada" rel="previous" title="Omissions from Ada">
31<style type="text/css">
32<!--
33a.summary-letter {text-decoration: none}
34blockquote.smallquotation {font-size: smaller}
35div.display {margin-left: 3.2em}
36div.example {margin-left: 3.2em}
37div.indentedblock {margin-left: 3.2em}
38div.lisp {margin-left: 3.2em}
39div.smalldisplay {margin-left: 3.2em}
40div.smallexample {margin-left: 3.2em}
41div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
42div.smalllisp {margin-left: 3.2em}
43kbd {font-style:oblique}
44pre.display {font-family: inherit}
45pre.format {font-family: inherit}
46pre.menu-comment {font-family: serif}
47pre.menu-preformatted {font-family: serif}
48pre.smalldisplay {font-family: inherit; font-size: smaller}
49pre.smallexample {font-size: smaller}
50pre.smallformat {font-family: inherit; font-size: smaller}
51pre.smalllisp {font-size: smaller}
52span.nocodebreak {white-space:nowrap}
53span.nolinebreak {white-space:nowrap}
54span.roman {font-family:serif; font-weight:normal}
55span.sansserif {font-family:sans-serif; font-weight:normal}
56ul.no-bullet {list-style: none}
57-->
58</style>
59
60
61</head>
62
63<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
64<a name="Additions-to-Ada"></a>
65<div class="header">
66<p>
67Next: <a href="Overloading-support-for-Ada.html#Overloading-support-for-Ada" accesskey="n" rel="next">Overloading support for Ada</a>, Previous: <a href="Omissions-from-Ada.html#Omissions-from-Ada" accesskey="p" rel="previous">Omissions from Ada</a>, Up: <a href="Ada.html#Ada" accesskey="u" rel="up">Ada</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
68</div>
69<hr>
70<a name="Additions-to-Ada-1"></a>
71<h4 class="subsubsection">15.4.10.3 Additions to Ada</h4>
72<a name="index-Ada_002c-deviations-from"></a>
73
74<p>As it does for other languages, <small>GDB</small> makes certain generic
75extensions to Ada (see <a href="Expressions.html#Expressions">Expressions</a>):
76</p>
77<ul>
78<li> If the expression <var>E</var> is a variable residing in memory (typically
79a local variable or array element) and <var>N</var> is a positive integer,
80then <code><var>E</var>@<var>N</var></code> displays the values of <var>E</var> and the
81<var>N</var>-1 adjacent variables following it in memory as an array.  In
82Ada, this operator is generally not necessary, since its prime use is
83in displaying parts of an array, and slicing will usually do this in
84Ada.  However, there are occasional uses when debugging programs in
85which certain debugging information has been optimized away.
86
87</li><li> <code><var>B</var>::<var>var</var></code> means &ldquo;the variable named <var>var</var> that
88appears in function or file <var>B</var>.&rdquo;  When <var>B</var> is a file name,
89you must typically surround it in single quotes.
90
91</li><li> The expression <code>{<var>type</var>} <var>addr</var></code> means &ldquo;the variable of type
92<var>type</var> that appears at address <var>addr</var>.&rdquo;
93
94</li><li> A name starting with &lsquo;<samp>$</samp>&rsquo; is a convenience variable
95(see <a href="Convenience-Vars.html#Convenience-Vars">Convenience Vars</a>) or a machine register (see <a href="Registers.html#Registers">Registers</a>).
96</li></ul>
97
98<p>In addition, <small>GDB</small> provides a few other shortcuts and outright
99additions specific to Ada:
100</p>
101<ul>
102<li> The assignment statement is allowed as an expression, returning
103its right-hand operand as its value.  Thus, you may enter
104
105<div class="smallexample">
106<pre class="smallexample">(gdb) set x := y + 3
107(gdb) print A(tmp := y + 1)
108</pre></div>
109
110</li><li> The semicolon is allowed as an &ldquo;operator,&rdquo;  returning as its value
111the value of its right-hand operand.
112This allows, for example,
113complex conditional breaks:
114
115<div class="smallexample">
116<pre class="smallexample">(gdb) break f
117(gdb) condition 1 (report(i); k += 1; A(k) &gt; 100)
118</pre></div>
119
120</li><li> Rather than use catenation and symbolic character names to introduce special
121characters into strings, one may instead use a special bracket notation,
122which is also used to print strings.  A sequence of characters of the form
123&lsquo;<samp>[&quot;<var>XX</var>&quot;]</samp>&rsquo; within a string or character literal denotes the
124(single) character whose numeric encoding is <var>XX</var> in hexadecimal.  The
125sequence of characters &lsquo;<samp>[&quot;&quot;&quot;]</samp>&rsquo; also denotes a single quotation mark
126in strings.   For example,
127<div class="smallexample">
128<pre class="smallexample">   &quot;One line.[&quot;0a&quot;]Next line.[&quot;0a&quot;]&quot;
129</pre></div>
130<p>contains an ASCII newline character (<code>Ada.Characters.Latin_1.LF</code>)
131after each period.
132</p>
133</li><li> The subtype used as a prefix for the attributes <tt>'Pos</tt>, <tt>'Min</tt>, and
134<tt>'Max</tt> is optional (and is ignored in any case).  For example, it is valid
135to write
136
137<div class="smallexample">
138<pre class="smallexample">(gdb) print 'max(x, y)
139</pre></div>
140
141</li><li> When printing arrays, <small>GDB</small> uses positional notation when the
142array has a lower bound of 1, and uses a modified named notation otherwise.
143For example, a one-dimensional array of three integers with a lower bound
144of 3 might print as
145
146<div class="smallexample">
147<pre class="smallexample">(3 =&gt; 10, 17, 1)
148</pre></div>
149
150<p>That is, in contrast to valid Ada, only the first component has a <code>=&gt;</code>
151clause.
152</p>
153</li><li> You may abbreviate attributes in expressions with any unique,
154multi-character subsequence of
155their names (an exact match gets preference).
156For example, you may use <tt>a'len</tt>, <tt>a'gth</tt>, or <tt>a'lh</tt>
157in place of  <tt>a'length</tt>.
158
159</li><li> <a name="index-quoting-Ada-internal-identifiers"></a>
160Since Ada is case-insensitive, the debugger normally maps identifiers you type
161to lower case.  The GNAT compiler uses upper-case characters for
162some of its internal identifiers, which are normally of no interest to users.
163For the rare occasions when you actually have to look at them,
164enclose them in angle brackets to avoid the lower-case mapping.
165For example,
166<div class="smallexample">
167<pre class="smallexample">(gdb) print &lt;JMPBUF_SAVE&gt;[0]
168</pre></div>
169
170</li><li> Printing an object of class-wide type or dereferencing an
171access-to-class-wide value will display all the components of the object&rsquo;s
172specific type (as indicated by its run-time tag).  Likewise, component
173selection on such a value will operate on the specific type of the
174object.
175
176</li></ul>
177
178<hr>
179<div class="header">
180<p>
181Next: <a href="Overloading-support-for-Ada.html#Overloading-support-for-Ada" accesskey="n" rel="next">Overloading support for Ada</a>, Previous: <a href="Omissions-from-Ada.html#Omissions-from-Ada" accesskey="p" rel="previous">Omissions from Ada</a>, Up: <a href="Ada.html#Ada" accesskey="u" rel="up">Ada</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
182</div>
183
184
185
186</body>
187</html>
188