Additions-to-Ada.html 8.6 KB

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