Chapter 14. Using gdb with Different Languages
111
14.2. Displaying the language
The following commands help you find out which language is the working language, and also what
language source files were written in.
show language
Display the current working language. This is the language you can use with commands such as
to build and compute expressions that may involve variables in your program.
info frame
Display the source language for this frame. This language becomes the working language if you
use an identifier from this frame. Refer to Section 8.4
Information about a frame
, to identify the
other information listed here.
info source
Display the source language of this source file. Refer to Chapter 15
Examining the Symbol Table
,
to identify the other information listed here.
In unusual circumstances, you may have source files with extensions not in the standard list. You can
then set the extension associated with a language explicitly:
set extension-language
.ext language
Set source files with extension
.ext
to be assumed to be in the source language
language
.
info extensions
List all the filename extensions and the associated languages.
14.3. Type and range checking
Warning:
In this release, the gdb commands for type and range checking are included, but they do not yet
have any effect. This section documents the intended facilities.
Some languages are designed to guard you against making seemingly common errors through a series
of compile- and run-time checks. These include checking the type of arguments to functions and
operators, and making sure mathematical overflows are caught at run time. Checks such as these help
to ensure a program’s correctness once it has been compiled by eliminating type mismatches, and
providing active checks for range errors when your program is running.
gdb can check for conditions like the above if you wish. Although gdb does not check the statements
in your program, it can check expressions entered directly into gdb for evaluation via the
command, for example. As with the working language, gdb can also decide whether or not to check
automatically based on your program’s source language. Refer to Section 14.4
Supported languages
,
for the default settings of supported languages.
14.3.1. An overview of type checking
Some languages, such as Modula-2, are strongly typed, meaning that the arguments to operators and
functions have to be of the correct type, otherwise an error occurs. These checks prevent type mis-
match errors from ever causing any run-time problems. For example,
1 + 2 => 3
Summary of Contents for ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Page 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Page 12: ...2 Chapter 1 Debugging with gdb ...
Page 28: ...18 Chapter 4 Getting In and Out of gdb ...
Page 34: ...24 Chapter 5 gdb Commands ...
Page 44: ...34 Chapter 6 Running Programs Under gdb ...
Page 68: ...58 Chapter 8 Examining the Stack ...
Page 98: ...88 Chapter 10 Examining Data ...
Page 112: ...102 Chapter 12 Tracepoints ...
Page 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Page 138: ...128 Chapter 14 Using gdb with Different Languages ...
Page 144: ...134 Chapter 15 Examining the Symbol Table ...
Page 170: ...160 Chapter 19 Debugging remote programs ...
Page 198: ...188 Chapter 21 Controlling gdb ...
Page 204: ...194 Chapter 22 Canned Sequences of Commands ...
Page 206: ...196 Chapter 23 Command Interpreters ...
Page 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Page 296: ...286 Chapter 27 gdb Annotations ...
Page 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Page 322: ...312 Chapter 30 Using History Interactively ...
Page 362: ...352 Appendix D gdb Remote Serial Protocol ...
Page 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Page 386: ...376 Appendix G GNU Free Documentation License ...
Page 410: ......