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: Ada Glitches</title>
18
19<meta name="description" content="Debugging with GDB: Ada Glitches">
20<meta name="keywords" content="Debugging with GDB: Ada Glitches">
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="Unsupported-Languages.html#Unsupported-Languages" rel="next" title="Unsupported Languages">
30<link href="Ada-Settings.html#Ada-Settings" rel="previous" title="Ada Settings">
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="Ada-Glitches"></a>
65<div class="header">
66<p>
67Previous: <a href="Ada-Settings.html#Ada-Settings" accesskey="p" rel="previous">Ada Settings</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="Known-Peculiarities-of-Ada-Mode"></a>
71<h4 class="subsubsection">15.4.10.11 Known Peculiarities of Ada Mode</h4>
72<a name="index-Ada_002c-problems"></a>
73
74<p>Besides the omissions listed previously (see <a href="Omissions-from-Ada.html#Omissions-from-Ada">Omissions from Ada</a>),
75we know of several problems with and limitations of Ada mode in
76<small>GDB</small>,
77some of which will be fixed with planned future releases of the debugger
78and the GNU Ada compiler.
79</p>
80<ul>
81<li> Static constants that the compiler chooses not to materialize as objects in
82storage are invisible to the debugger.
83
84</li><li> Named parameter associations in function argument lists are ignored (the
85argument lists are treated as positional).
86
87</li><li> Many useful library packages are currently invisible to the debugger.
88
89</li><li> Fixed-point arithmetic, conversions, input, and output is carried out using
90floating-point arithmetic, and may give results that only approximate those on
91the host machine.
92
93</li><li> The GNAT compiler never generates the prefix <code>Standard</code> for any of
94the standard symbols defined by the Ada language.  <small>GDB</small> knows about
95this: it will strip the prefix from names when you use it, and will never
96look for a name you have so qualified among local symbols, nor match against
97symbols in other packages or subprograms.  If you have
98defined entities anywhere in your program other than parameters and
99local variables whose simple names match names in <code>Standard</code>,
100GNAT&rsquo;s lack of qualification here can cause confusion.  When this happens,
101you can usually resolve the confusion
102by qualifying the problematic names with package
103<code>Standard</code> explicitly.
104</li></ul>
105
106<p>Older versions of the compiler sometimes generate erroneous debugging
107information, resulting in the debugger incorrectly printing the value
108of affected entities.  In some cases, the debugger is able to work
109around an issue automatically. In other cases, the debugger is able
110to work around the issue, but the work-around has to be specifically
111enabled.
112</p>
113<a name="index-set-ada-trust_002dPAD_002dover_002dXVS"></a>
114<a name="index-show-ada-trust_002dPAD_002dover_002dXVS"></a>
115<dl compact="compact">
116<dt><code>set ada trust-PAD-over-XVS on</code></dt>
117<dd><p>Configure GDB to strictly follow the GNAT encoding when computing the
118value of Ada entities, particularly when <code>PAD</code> and <code>PAD___XVS</code>
119types are involved (see <code>ada/exp_dbug.ads</code> in the GCC sources for
120a complete description of the encoding used by the GNAT compiler).
121This is the default.
122</p>
123</dd>
124<dt><code>set ada trust-PAD-over-XVS off</code></dt>
125<dd><p>This is related to the encoding using by the GNAT compiler.  If <small>GDB</small>
126sometimes prints the wrong value for certain entities, changing <code>ada
127trust-PAD-over-XVS</code> to <code>off</code> activates a work-around which may fix
128the issue.  It is always safe to set <code>ada trust-PAD-over-XVS</code> to
129<code>off</code>, but this incurs a slight performance penalty, so it is
130recommended to leave this setting to <code>on</code> unless necessary.
131</p>
132</dd>
133</dl>
134
135<a name="index-GNAT-descriptive-types"></a>
136<a name="index-GNAT-encoding"></a>
137<p>Internally, the debugger also relies on the compiler following a number
138of conventions known as the &lsquo;<samp>GNAT Encoding</samp>&rsquo;, all documented in
139<samp>gcc/ada/exp_dbug.ads</samp> in the GCC sources. This encoding describes
140how the debugging information should be generated for certain types.
141In particular, this convention makes use of <em>descriptive types</em>,
142which are artificial types generated purely to help the debugger.
143</p>
144<p>These encodings were defined at a time when the debugging information
145format used was not powerful enough to describe some of the more complex
146types available in Ada.  Since DWARF allows us to express nearly all
147Ada features, the long-term goal is to slowly replace these descriptive
148types by their pure DWARF equivalent.  To facilitate that transition,
149a new maintenance option is available to force the debugger to ignore
150those descriptive types.  It allows the user to quickly evaluate how
151well <small>GDB</small> works without them.
152</p>
153<dl compact="compact">
154<dd>
155<a name="index-maint-ada-set-ignore_002ddescriptive_002dtypes"></a>
156</dd>
157<dt><code>maintenance ada set ignore-descriptive-types [on|off]</code></dt>
158<dd><p>Control whether the debugger should ignore descriptive types.
159The default is not to ignore descriptives types (<code>off</code>).
160</p>
161<a name="index-maint-ada-show-ignore_002ddescriptive_002dtypes"></a>
162</dd>
163<dt><code>maintenance ada show ignore-descriptive-types</code></dt>
164<dd><p>Show if descriptive types are ignored by <small>GDB</small>.
165</p>
166</dd>
167</dl>
168
169<hr>
170<div class="header">
171<p>
172Previous: <a href="Ada-Settings.html#Ada-Settings" accesskey="p" rel="previous">Ada Settings</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>
173</div>
174
175
176
177</body>
178</html>
179