1 From gdb-patches-return-33877-listarch-gdb-patches=sources dot redhat dot com at sources dot redhat dot com Wed Jun 16 08:42:53 2004
2 Return-Path: <gdb-patches-return-33877-listarch-gdb-patches=sources dot redhat dot com at sources dot redhat dot com>
3 Delivered-To: listarch-gdb-patches at sources dot redhat dot com
4 Received: (qmail 7986 invoked by alias); 16 Jun 2004 08:42:52 -0000
5 Mailing-List: contact gdb-patches-help at sources dot redhat dot com; run by ezmlm
7 List-Subscribe: <mailto:gdb-patches-subscribe at sources dot redhat dot com>
8 List-Archive: <http://sources.redhat.com/ml/gdb-patches/>
9 List-Post: <mailto:gdb-patches at sources dot redhat dot com>
10 List-Help: <mailto:gdb-patches-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs>
11 Sender: gdb-patches-owner at sources dot redhat dot com
12 Delivered-To: mailing list gdb-patches at sources dot redhat dot com
13 Received: (qmail 7802 invoked from network); 16 Jun 2004 08:42:38 -0000
14 Received: from unknown (HELO nile.gnat.com) (205.232.38.5)
15 by sourceware dot org with SMTP; 16 Jun 2004 08:42:38 -0000
16 Received: from localhost (localhost [127.0.0.1])
17 by nile dot gnat dot com (Postfix) with ESMTP
18 id 73F11F28E9; Wed, 16 Jun 2004 04:42:38 -0400 (EDT)
19 Received: from nile.gnat.com ([127.0.0.1])
20 by localhost (nile dot gnat dot com [127 dot 0 dot 0 dot 1]) (amavisd-new, port 10024) with LMTP
21 id 10906-01-2; Wed, 16 Jun 2004 04:42:38 -0400 (EDT)
22 Received: by nile.gnat.com (Postfix, from userid 1345)
23 id F02D1F292A; Wed, 16 Jun 2004 04:42:37 -0400 (EDT)
24 From: Paul Hilfinger <hilfingr at gnat dot com>
25 To: gdb-patches at sources dot redhat dot com
26 Cc: drow at false dot org, jimb at redhat dot com, eliz at gnu dot org
27 In-reply-to: <20040609131240 dot GA7587 at nevyn dot them dot org> (message from Daniel
28 Jacobowitz on Wed, 9 Jun 2004 09:12:40 -0400)
29 Subject: Re: [RFA]: Turn on Ada support, take 2
30 References: <20040608090758.C59CAF2940@nile.gnat.com> <vt2aczd8aah.fsf@zenia.home> <20040609131240.GA7587@nevyn.them.org>
31 Message-Id: <20040616084237.F02D1F292A@nile.gnat.com>
32 Date: Wed, 16 Jun 2004 04:42:37 -0400 (EDT)
33 X-Virus-Scanned: by amavisd-new at nile.gnat.com
37 Here is an update to the patch I sent previously. In this version, I have
39 1. Removed the compilation of ada-tasks.o, since we have not yet turned
40 on any of it in the public version.
42 2. Responded to most of Eli's comments. I will have to consider the
43 issue of formating things like 'Address, since the standard rendering
44 in info files provided by the technically appropriate marker,
45 @code, looks rather bad (in my opinion), due to the adjacent quotes
48 A previous patch to the Ada sources added some conditionalization to mark code
49 that is not yet used in the public version (for the benefit of reviewers).
54 2004-06-16 Paul N. Hilfinger <Hilfinger@gnat.com>
56 Turn on initial Ada support (mainly expression evaluation).
58 * Makefile.in (ada_lex_c): Define
59 (HFILES_NO_SRCDIR): Add ada-lang.h.
60 (COMMON_OBS): Add ada-lang.o, ada-typeprint.o, ada-valprint.o.
61 (YYOBJ): Add ada-exp.o.
62 (rule .l.c): Generalize to not mention ada.
63 (ada-lex.o): Remove (ada-lex.c is included by ada-exp.y).
64 (ada-lang.o): Add dependencies on completer.h, gdb_obstack.h,
66 (ada-tasks.o): Add dependency on gdb_string.h.
67 (ada-valprint.o): Add dependency on gdb_string.h.
69 * symtab.c: Add dependency on ada-lang.h.
70 (symbol_natural_name): Add Ada case.
71 (symbol_demangled_name): Add Ada case.
72 (symbol_search_name): Add Ada case.
74 * symfile.c (init_filename_language_table): Add extensions for
77 * defs.h (enum language): Add language_ada.
79 * gdbtypes.h (TYPE_FLAG_FIXED_INSTANCE): Define.
81 2004-06-09 Paul N. Hilfinger <hilfinger@gnat.com>
83 * doc/gdb.texinfo (Filenames): Add Ada suffixes.
88 Index: gdb/Makefile.in
89 ===================================================================
90 RCS file: /cvs/src/src/gdb/Makefile.in,v
91 retrieving revision 1.587
92 diff -u -p -r1.587 Makefile.in
93 --- gdb/Makefile.in 14 Jun 2004 20:40:39 -0000 1.587
94 +++ gdb/Makefile.in 16 Jun 2004 08:23:45 -0000
95 @@ -616,6 +616,7 @@ nm_h = @nm_h@
99 +ada_lex_c = ada-lex.c
100 ada_lang_h = ada-lang.h $(value_h) $(gdbtypes_h)
101 alphabsd_tdep_h = alphabsd-tdep.h
102 alpha_tdep_h = alpha-tdep.h
103 @@ -833,7 +834,7 @@ HFILES_NO_SRCDIR = bcache.h buildsym.h c
104 symfile.h symfile-mem.h stabsread.h target.h terminal.h typeprint.h \
106 macrotab.h macroexp.h macroscope.h \
107 - c-lang.h f-lang.h \
108 + ada-lang.h c-lang.h f-lang.h \
111 complaints.h valprint.h \
112 @@ -894,7 +895,7 @@ COMMON_OBS = $(DEPFILES) $(YYOBJ) \
113 dbxread.o coffread.o coff-pe-read.o elfread.o \
114 dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \
115 dwarf2expr.o dwarf2loc.o dwarf2-frame.o \
116 - c-lang.o f-lang.o objc-lang.o \
117 + ada-lang.o c-lang.o f-lang.o objc-lang.o \
120 jv-lang.o jv-valprint.o jv-typeprint.o \
121 @@ -902,8 +903,8 @@ COMMON_OBS = $(DEPFILES) $(YYOBJ) \
122 scm-exp.o scm-lang.o scm-valprint.o \
124 complaints.o typeprint.o \
125 - c-typeprint.o f-typeprint.o m2-typeprint.o \
126 - c-valprint.o cp-valprint.o f-valprint.o m2-valprint.o \
127 + ada-typeprint.o c-typeprint.o f-typeprint.o m2-typeprint.o \
128 + ada-valprint.o c-valprint.o cp-valprint.o f-valprint.o m2-valprint.o \
129 nlmread.o serial.o mdebugread.o top.o utils.o \
132 @@ -927,6 +928,7 @@ YYFILES = c-exp.c \
133 f-exp.c m2-exp.c p-exp.c
138 f-exp.o m2-exp.o p-exp.o
140 @@ -1495,7 +1497,7 @@ valprint.o: $(srcdir)/valprint.c
141 echo $(FLEX) -Isit $< ">" $@; \
142 $(FLEX) -Isit $< > $@; \
143 elif [ ! -f $@ -a ! -f $< ]; then \
144 - echo "ada-lex.c missing and flex not available."; \
145 + echo "$< missing and flex not available."; \
147 elif [ ! -f $@ ]; then \
148 echo "Warning: $*.c older than $*.l and flex not available."; \
149 @@ -1522,18 +1524,18 @@ ada-lang.o: ada-lang.c $(gdb_string_h) $
150 $(gdbtypes_h) $(gdbcmd_h) $(expression_h) $(parser_defs_h) \
151 $(language_h) $(c_lang_h) $(inferior_h) $(symfile_h) $(objfiles_h) \
152 $(breakpoint_h) $(gdbcore_h) $(ada_lang_h) $(ui_out_h) $(block_h) \
153 - $(infcall_h) $(dictionary_h)
154 -ada-lex.o: ada-lex.c
155 + $(completer_h) $(infcall_h) $(gdb_obstack_h) $(dictionary_h) \
157 ada-tasks.o: ada-tasks.c $(defs_h) $(command_h) $(value_h) $(language_h) \
158 $(inferior_h) $(symtab_h) $(target_h) $(regcache_h) $(gdbcore_h) \
159 - $(gregset_h) $(ada_lang_h)
160 + $(gregset_h) $(gdb_string_h) $(ada_lang_h)
161 ada-typeprint.o: ada-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) \
162 $(symtab_h) $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) \
163 $(target_h) $(command_h) $(gdbcmd_h) $(language_h) $(demangle_h) \
164 $(c_lang_h) $(typeprint_h) $(ada_lang_h) $(gdb_string_h)
165 ada-valprint.o: ada-valprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \
166 $(expression_h) $(value_h) $(demangle_h) $(valprint_h) $(language_h) \
167 - $(annotate_h) $(ada_lang_h) $(c_lang_h) $(infcall_h)
168 + $(annotate_h) $(ada_lang_h) $(c_lang_h) $(gdb_string_h) $(infcall_h)
169 aix-thread.o: aix-thread.c $(defs_h) $(gdb_assert_h) $(gdbthread_h) \
170 $(target_h) $(inferior_h) $(regcache_h) $(gdbcmd_h) $(language_h) \
171 $(ppc_tdep_h) $(gdb_string_h)
173 ===================================================================
174 RCS file: /cvs/src/src/gdb/defs.h,v
175 retrieving revision 1.147
176 diff -u -p -r1.147 defs.h
177 --- gdb/defs.h 10 Jun 2004 20:05:43 -0000 1.147
178 +++ gdb/defs.h 16 Jun 2004 08:23:45 -0000
179 @@ -220,6 +220,7 @@ enum language
180 language_asm, /* Assembly language */
181 language_scm, /* Scheme / Guile */
182 language_pascal, /* Pascal */
183 + language_ada, /* Ada */
184 language_minimal /* All other languages, minimal support only */
187 Index: gdb/gdbtypes.h
188 ===================================================================
189 RCS file: /cvs/src/src/gdb/gdbtypes.h,v
190 retrieving revision 1.53
191 diff -u -p -r1.53 gdbtypes.h
192 --- gdb/gdbtypes.h 2 Jun 2004 21:01:55 -0000 1.53
193 +++ gdb/gdbtypes.h 16 Jun 2004 08:23:45 -0000
194 @@ -273,6 +273,17 @@ enum type_code
195 #define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
196 & TYPE_FLAG_ADDRESS_CLASS_ALL)
198 +/* The debugging formats (especially STABS) do not contain enough information
199 + to represent all Ada types---especially those whose size depends on
200 + dynamic quantities. Therefore, the GNAT Ada compiler includes
201 + extra information in the form of additional type definitions
202 + connected by naming conventions. This flag indicates that the
203 + type is an ordinary (unencoded) GDB type that has been created from
204 + the necessary run-time information, and does not need further
205 + interpretation. Optionally marks ordinary, fixed-size GDB type. */
207 +#define TYPE_FLAG_FIXED_INSTANCE (1 << 15)
209 /* Array bound type. */
210 enum array_bound_type
213 ===================================================================
214 RCS file: /cvs/src/src/gdb/symfile.c,v
215 retrieving revision 1.132
216 diff -u -p -r1.132 symfile.c
217 --- gdb/symfile.c 15 Jun 2004 01:04:20 -0000 1.132
218 +++ gdb/symfile.c 16 Jun 2004 08:23:46 -0000
219 @@ -2158,6 +2158,10 @@ init_filename_language_table (void)
220 add_filename_language (".pas", language_pascal);
221 add_filename_language (".p", language_pascal);
222 add_filename_language (".pp", language_pascal);
223 + add_filename_language (".adb", language_ada);
224 + add_filename_language (".ads", language_ada);
225 + add_filename_language (".a", language_ada);
226 + add_filename_language (".ada", language_ada);
231 ===================================================================
232 RCS file: /cvs/src/src/gdb/symtab.c,v
233 retrieving revision 1.132
234 diff -u -p -r1.132 symtab.c
235 --- gdb/symtab.c 10 Jun 2004 20:05:44 -0000 1.132
236 +++ gdb/symtab.c 16 Jun 2004 08:23:47 -0000
239 #include "filenames.h" /* for FILENAME_CMP */
240 #include "objc-lang.h"
241 +#include "ada-lang.h"
245 @@ -632,17 +633,24 @@ symbol_init_demangled_name (struct gener
247 symbol_natural_name (const struct general_symbol_info *gsymbol)
249 - if ((gsymbol->language == language_cplus
250 - || gsymbol->language == language_java
251 - || gsymbol->language == language_objc)
252 - && (gsymbol->language_specific.cplus_specific.demangled_name != NULL))
253 + switch (gsymbol->language)
255 - return gsymbol->language_specific.cplus_specific.demangled_name;
259 - return gsymbol->name;
260 + case language_cplus:
261 + case language_java:
262 + case language_objc:
263 + if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
264 + return gsymbol->language_specific.cplus_specific.demangled_name;
267 + if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
268 + return gsymbol->language_specific.cplus_specific.demangled_name;
270 + return ada_decode_symbol (gsymbol);
275 + return gsymbol->name;
278 /* Return the demangled name for a symbol based on the language for
279 @@ -650,13 +658,24 @@ symbol_natural_name (const struct genera
281 symbol_demangled_name (struct general_symbol_info *gsymbol)
283 - if (gsymbol->language == language_cplus
284 - || gsymbol->language == language_java
285 - || gsymbol->language == language_objc)
286 - return gsymbol->language_specific.cplus_specific.demangled_name;
290 + switch (gsymbol->language)
292 + case language_cplus:
293 + case language_java:
294 + case language_objc:
295 + if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
296 + return gsymbol->language_specific.cplus_specific.demangled_name;
299 + if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
300 + return gsymbol->language_specific.cplus_specific.demangled_name;
302 + return ada_decode_symbol (gsymbol);
310 /* Return the search name of a symbol---generally the demangled or
311 #### gdb post-6.1 branch
312 ##@@ -664,7 +683,10 @@ symbol_demangled_name (struct general_sy
313 ## If there is no distinct demangled name, then returns the same value
314 ## (same pointer) as SYMBOL_LINKAGE_NAME. */
315 ## char *symbol_search_name (const struct general_symbol_info *gsymbol) {
316 ##- return symbol_natural_name (gsymbol);
317 ##+ if (gsymbol->language == language_ada)
318 ##+ return gsymbol->name;
320 ##+ return symbol_natural_name (gsymbol);
323 ## /* Initialize the structure fields to zero values. */
325 Index: gdb/doc/gdb.texinfo
326 ===================================================================
327 RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
328 retrieving revision 1.206
329 diff -u -p -r1.206 gdb.texinfo
330 --- gdb/doc/gdb.texinfo 14 Jun 2004 22:26:33 -0000 1.206
331 +++ gdb/doc/gdb.texinfo 16 Jun 2004 08:23:53 -0000
332 @@ -7741,6 +7741,11 @@ If a source file name ends in one of the
333 @value{GDBN} infers that its language is the one indicated.
344 @@ -8031,7 +8036,7 @@ being set automatically by @value{GDBN}.
346 @section Supported languages
348 -@value{GDBN} supports C, C@t{++}, Objective-C, Fortran, Java, assembly, and Modula-2.
349 +@value{GDBN} supports C, C@t{++}, Objective-C, Fortran, Java, assembly, Modula-2, and Ada.
351 Some @value{GDBN} features may be used in expressions regardless of the
352 language you use: the @value{GDBN} @code{@@} and @code{::} operators,
353 @@ -8051,6 +8056,7 @@ language reference or tutorial.
355 * Objective-C:: Objective-C
356 * Modula-2:: Modula-2
361 @@ -8666,7 +8672,7 @@ the description of an object. However,
362 with certain Objective-C libraries that have a particular hook
363 function, @code{_NSPrintForDebugger}, defined.
365 -@node Modula-2, , Objective-C, Support
366 +@node Modula-2, Ada, Objective-C, Support
369 @cindex Modula-2, @value{GDBN} support
370 @@ -9109,6 +9115,481 @@ address can be specified by an integral
371 In @value{GDBN} scripts, the Modula-2 inequality operator @code{#} is
372 interpreted as the beginning of a comment. Use @code{<>} instead.
378 +The extensions made to @value{GDBN} for Ada only support
379 +output from the @sc{gnu} Ada (GNAT) compiler.
380 +Other Ada compilers are not currently supported, and
381 +attempting to debug executables produced by them is most likely
385 +@cindex expressions in Ada
387 +* Ada Mode Intro:: General remarks on the Ada syntax
388 + and semantics supported by Ada mode
390 +* Omissions from Ada:: Restrictions on the Ada expression syntax.
391 +* Additions to Ada:: Extensions of the Ada expression syntax.
392 +* Stopping Before Main Program:: Debugging the program during elaboration.
393 +* Ada Exceptions:: Setting breakpoints on exception handlers.
394 +* Ada Generic Units:: Dealing with generic instantiations.
395 +* Ada Glitches:: Known peculiarities of Ada mode.
398 +@node Ada Mode Intro
399 +@subsubsection Introduction
400 +@cindex Ada mode, general
402 +The Ada mode of @value{GDBN} supports a fairly large subset of Ada expression
403 +syntax, with some extensions.
404 +The philosophy behind the design of this subset is
408 +That @value{GDBN} should provide basic literals and access to operations for
409 +arithmetic, dereferencing, field selection, indexing, and subprogram calls,
410 +leaving more sophisticated computations to subprograms written into the
411 +program (which therefore may be called from @value{GDBN}).
414 +That type safety and strict adherence to Ada language restrictions
415 +are not particularly important to the @value{GDBN} user.
418 +That brevity is important to the @value{GDBN} user.
421 +Thus, for brevity, the debugger acts as if there were
422 +implicit @code{with} and @code{use} clauses in effect for all user-written
423 +packages, making it unnecessary to fully qualify most names with
424 +their packages, regardless of context. Where this causes ambiguity,
425 +@value{GDBN} asks the user's intent.
427 +The debugger will start in Ada mode if it detects an Ada main program.
428 +As for other languages, it will enter Ada mode when stopped in a program that
429 +was translated from an Ada source file.
431 +While in Ada mode, you may use `@t{--}' for comments. This is useful
432 +mostly for documenting command files. The standard @value{GDBN} comment
433 +(@samp{#}) still works at the beginning of a line in Ada mode, but not in the
434 +middle (to allow based literals).
436 +The debugger supports limited overloading. Given a subprogram call in which
437 +the function symbol has multiple definitions, it will use the number of
438 +actual parameters and some information about their types to attempt to narrow
439 +the set of definitions. It also makes very limited use of context, preferring
440 +procedures to functions in the context of the @code{call} command, and
441 +functions to procedures elsewhere.
443 +@node Omissions from Ada
444 +@subsubsection Omissions from Ada
445 +@cindex Ada, omissions from
447 +Here are the notable omissions from the subset:
451 +Only a subset of the attributes are supported:
455 +@t{'First}, @t{'Last}, and @t{'Length}
456 + on array objects (not on types and subtypes).
459 +@t{'Min} and @t{'Max}.
462 +@t{'Pos} and @t{'Val}.
468 +@t{'Range} on array objects (not subtypes), but only as the right
469 +operand of the membership (@code{in}) operator.
472 +@t{'Access}, @t{'Unchecked_Access}, and
473 +@t{'Unrestricted_Access} (a GNAT extension).
481 +@code{Characters.Latin_1} are not available and
482 +concatenation is not implemented. Thus, escape characters in strings are
483 +not currently available.
486 +Equality tests (@samp{=} and @samp{/=}) on arrays test for bitwise
487 +equality of representations. They will generally work correctly
488 +for strings and arrays whose elements have integer or enumeration types.
489 +They may not work correctly for arrays whose element
490 +types have user-defined equality, for arrays of real values
491 +(in particular, IEEE-conformant floating point, because of negative
492 +zeroes and NaNs), and for arrays whose elements contain unused bits with
493 +indeterminate values.
496 +The other component-by-component array operations (@code{and}, @code{or},
497 +@code{xor}, @code{not}, and relational tests other than equality)
498 +are not implemented.
501 +There are no record or array aggregates.
504 +Dispatching subprogram calls are not implemented.
507 +The overloading algorithm is much more limited (i.e., less selective)
508 +than that of real Ada. It makes only limited use of the context in which a subexpression
509 +appears to resolve its meaning, and it is much looser in its rules for allowing
510 +type matches. As a result, some function calls will be ambiguous, and the user
511 +will be asked to choose the proper resolution.
514 +The @code{new} operator is not implemented.
517 +Entry calls are not implemented.
520 +Aside from printing, arithmetic operations on the native VAX floating-point
521 +formats are not supported.
524 +It is not possible to slice a packed array.
527 +@node Additions to Ada
528 +@subsubsection Additions to Ada
529 +@cindex Ada, deviations from
531 +As it does for other languages, @value{GDBN} makes certain generic
532 +extensions to Ada (@pxref{Expressions}):
536 +If the expression @var{E} is a variable residing in memory
537 +(typically a local variable or array element) and @var{N} is
538 +a positive integer, then @code{@var{E}@@@var{N}} displays the values of
539 +@var{E} and the @var{N}-1 adjacent variables following it in memory as an array.
540 +In Ada, this operator is generally not necessary, since its prime use
541 +is in displaying parts of an array, and slicing will usually do this in Ada.
542 +However, there are occasional uses when debugging programs
543 +in which certain debugging information has been optimized away.
546 +@code{@var{B}::@var{var}} means ``the variable named @var{var} that appears
547 +in function or file @var{B}.'' When @var{B} is a file name, you must typically
548 +surround it in single quotes.
551 +The expression @code{@{@var{type}@} @var{addr}} means ``the variable of type
552 +@var{type} that appears at address @var{addr}.''
555 +A name starting with @samp{$} is a convenience variable
556 +(@pxref{Convenience Vars}) or a machine register (@pxref{Registers}).
559 +In addition, @value{GDBN} provides a few other shortcuts and outright additions specific
564 +The assignment statement is allowed as an expression, returning
565 +its right-hand operand as its value. Thus, you may enter
569 +print A(tmp := y + 1)
573 +The semicolon is allowed as an ``operator,'' returning as its value
574 +the value of its right-hand operand.
575 +This allows, for example,
576 +complex conditional breaks:
580 +condition 1 (report(i); k += 1; A(k) > 100)
584 +Rather than use catenation and symbolic character names to introduce special
585 +characters into strings, one may instead use a special bracket notation,
586 +which is also used to print strings. A sequence of characters of the form
587 +@samp{["@var{XX}"]} within a string or character literal denotes the
588 +(single) character whose numeric encoding is @var{XX} in hexadecimal. The
589 +sequence of characters @samp{["""]} also denotes a single quotation mark
590 +in strings. For example,
592 + "One line.["0a"]Next line.["0a"]"
595 +Contains an ASCII newline character (@code{Ada.Characters.Latin_1.LF}) after each
599 +The subtype used as a prefix for the attributes @t{'Pos}, @t{'Min}, and
600 +@t{'Max} is optional (and is ignored in any case). For example, it is valid
608 +When printing arrays, @value{GDBN} uses positional notation when the
609 +array has a lower bound of 1, and uses a modified named notation otherwise.
610 +For example, a one-dimensional array of three integers with a lower bound of 3 might print as
617 +That is, in contrast to valid Ada, only the first component has a @code{=>}
621 +You may abbreviate attributes in expressions with any unique,
622 +multi-character subsequence of
623 +their names (an exact match gets preference).
624 +For example, you may use @t{a'len}, @t{a'gth}, or @t{a'lh}
625 +in place of @t{a'length}.
628 +@cindex quoting Ada internal identifiers
629 +Since Ada is case-insensitive, the debugger normally maps identifiers you type
630 +to lower case. The GNAT compiler uses upper-case characters for
631 +some of its internal identifiers, which are normally of no interest to users.
632 +For the rare occasions when you actually have to look at them,
633 +enclose them in angle brackets to avoid the lower-case mapping.
636 +(gdb) print <JMPBUF_SAVE>[0]
640 +Printing an object of class-wide type or dereferencing an
641 +access-to-class-wide value will display all the components of the object's
642 +specific type (as indicated by its run-time tag). Likewise, component
643 +selection on such a value will operate on the specific type of the
648 +@node Stopping Before Main Program
649 +@subsubsection Stopping at the Very Beginning
651 +@cindex breakpointing Ada elaboration code
652 +It is sometimes necessary to debug the program during elaboration, and
653 +before reaching the main procedure.
654 +As defined in the Ada Reference
655 +Manual, the elaboration code is invoked from a procedure called
656 +@code{adainit}. To run your program up to the beginning of
657 +elaboration, simply use the following two commands:
658 +@code{tbreak adainit} and @code{run}.
660 +@node Ada Exceptions
661 +@subsubsection Breaking on Ada Exceptions
662 +@cindex Ada, exceptions
664 +In Ada mode, you can set breakpoints that trip when your program raises
665 +selected exceptions.
668 +@kindex break exception
669 +@item break exception
670 +Set a breakpoint that trips whenever (any task in the) program raises
673 +@item break exception @var{name}
674 +Set a breakpoint that trips whenever (any task in the) program raises
675 +the exception @var{name}.
677 +When inserting a breakpoint on a specific exception for which an
678 +homonym entity exists in the application, it is necessary to prefix
679 +the exception name with its package name. In particular, if an entity
680 +sharing the same name as one of the standard exceptions has been defined,
681 +the exception name must be prefixed with package @code{Standard} when
682 +setting a breakpoint on this exception.
688 +(gdb) break exception Standard.Constraint_Error
691 +@item break exception unhandled
692 +Set a breakpoint that trips whenever (any task in the) program raises an
693 +exception for which there is no handler.
695 +depending on the implementation of exceptions used on your platform,
696 +this may not have quite the desired effect. Other forms of
697 +exception breaking stop the program at the point the exception is raised.
698 +In Ada implementations that use setjmp and longjmp to implement exception
699 +handling, however, unhandled exceptions are not detected until the
700 +affected task's stack is completely unwound. Thus, you find out that a
701 +task has terminated with an exception, but you aren't told where it was
704 +@kindex info exceptions
705 +@item info exceptions
706 +@itemx info exceptions @var{regexp}
707 +The @code{info exceptions} command permits the user to examine all defined
708 +exceptions within Ada programs. With a regular expression, @var{regexp}, as
709 +argument, prints out only those exceptions whose name matches @var{regexp}.
712 +@node Ada Generic Units
713 +@subsubsection Debugging Generic Units
714 +@cindex Ada, generic units
716 +GNAT always uses code expansion for generic instantiation. This means that
717 +each time an instantiation occurs, a complete copy of the original code is
718 +made with appropriate substitutions.
720 +It is not possible to refer to the original generic entities themselves
721 +in @value{GDBN} (there is no code to refer to), but it
722 +is certainly possible to debug a particular instance of a generic, simply by
723 +using the appropriate expanded names. For example, suppose that
724 +@code{Gen} is a generic package:
728 +generic package Gen is
729 + function F (v1 : Integer) return Integer;
734 + function F (v1 : Integer) return Integer is
736 + return v1+1; -- Line 5
742 +and we have the following expansions
747 + package Gen1 is new Gen;
748 + package Gen2 is new Gen;
760 +Then to break on a call to procedure @code{F} in the @code{Gen2} instance, simply
767 +When a breakpoint occurs, you can step through the code of the generic
768 +instance in the normal manner. You can also examine values of data in the
769 +normal manner, providing the appropriate generic package qualification to
770 +refer to non-local entities.
773 +@subsubsection Known Peculiarities of Ada Mode
774 +@cindex Ada, problems
776 +Besides the omissions listed previously (@pxref{Omissions from Ada}),
777 +we know of several problems with and limitations of Ada mode in
779 +some of which will be fixed with planned future releases of the debugger
780 +and the GNU Ada compiler.
784 +Currently, the debugger
785 +has insufficient information to determine whether certain pointers represent
786 +pointers to objects or the objects themselves.
787 +Thus, the user may have to tack an extra @code{.all} after an expression
788 +to get it printed properly.
791 +Static constants that the compiler chooses not to materialize as objects in
792 +storage are invisible to the debugger.
795 +Named parameter associations in function argument lists are ignored (the
796 +argument lists are treated as positional).
799 +Many useful library packages are currently invisible to the debugger.
802 +Fixed-point arithmetic, conversions, input, and output is carried out using
803 +floating-point arithmetic, and may give results that only approximate those on
807 +The type of the @t{'Address} attribute may not be @code{System.Address}.
810 +When stopped in a particular subprogram, you can access variables defined
812 +enclosing subprograms by their simple names. At the moment, however, this
813 +may not always work; it depends on whether the compiler happens to have
814 +made the necessary information (the ``static link'') available
815 +at execution time, which it can sometimes avoid. Of course,
816 +even in those cases where
817 +the compiler does not provide the information, you can still look at such
818 +variables by issuing the appropriate number of @code{up} commands to get to
819 +frame containing the variable you wish to see.
820 +Access to non-local variables does not, at the moment, work in
821 +the test expressions for conditional breakpoints
822 +(@pxref{Conditions, ,Break conditions}) unless you happen to specify these
823 +while stopped in the subprogram in which they are to be applied.
826 +Depending on the platform, it is not always possible to set breakpoints
827 +on nested functions by name (e.g., @code{break foo}). In effect, the
828 +nested functions act like local variables of the enclosing function.
829 +On these platforms, you must wait until @value{GDBN} is stopped in
830 +the enclosing function before using this form of @code{break} command.
831 +This is not much of a limitation, since you can still set a breakpoint on
832 +the first line of the desired function using the usual
833 +@code{break @var{file}:@var{line}} syntax.
836 +The GNAT compiler never generates the prefix @code{Standard} for any of
837 +the standard symbols defined by the Ada language. @value{GDBN} knows about
838 +this: it will strip the prefix from names when you use it, and will never
839 +look for a name you have so qualified among local symbols, nor match against
840 +symbols in other packages or subprograms. If you have
841 +defined entities anywhere in your program other than parameters and
842 +local variables whose simple names match names in @code{Standard},
843 +GNAT's lack of qualification here can cause confusion. When this happens,
844 +you can usually resolve the confusion
845 +by qualifying the problematic names with package
846 +@code{Standard} explicitly.
849 @node Unsupported languages
850 @section Unsupported languages