Chapter 14. Using gdb with Different Languages
113
an error. In many implementations of C, mathematical overflow causes the result to "wrap around" to
lower values--for example, if
m
is the largest integer value, and
s
is the smallest, then
m
+ 1 =>
s
This, too, is specific to individual languages, and in some cases specific to individual compilers or
machines. Refer to Section 14.4
Supported languages
, for further details on specific languages.
gdb provides some additional commands for controlling the range checker:
set check range auto
Set range checking on or off based on the current working language. Refer to Section 14.4
Sup-
ported languages
, for the default settings for each language.
set check range on
set check range off
Set range checking on or off, overriding the default setting for the current working language. A
warning is issued if the setting does not match the language default. If a range error occurs and
range checking is on, then a message is printed and evaluation of the expression is aborted.
set check range warn
Output messages when the gdb range checker detects a range error, but attempt to evaluate the
expression anyway. Evaluating the expression may still be impossible for other reasons, such as
accessing memory that the process does not own (a typical example from many Unix systems).
show range
Show the current setting of the range checker, and whether or not it is being set automatically by
gdb.
14.4. Supported languages
gdb supports C, C
++
, Objective-C, Fortran, Java, assembly, and Modula-2. Some gdb features may
be used in expressions regardless of the language you use: the gdb
@
and
::
operators, and the
{type}addr
construct (refer to Section 10.1
Expressions
) can be used with the constructs of any
supported language.
The following sections detail to what degree each source language is supported by gdb. These sections
are not meant to be language tutorials or references, but serve only as a reference guide to what the gdb
expression parser accepts, and what input and output formats should look like for different languages.
There are many good books written on each of these languages; please look to these for a language
reference or tutorial.
14.4.1. C and C
++
Since C and C
++
are so closely related, many features of gdb apply to both languages. Whenever this
is the case, we discuss those languages together.
The C
++
debugging facilities are jointly implemented by the C
++
compiler and gdb. Therefore, to
debug your C
++
code effectively, you must compile your C
++
programs with a supported C
++
compiler, such as gnu
g++
, or the HP ANSI C
++
compiler (
aCC
).
Summary of Contents for ENTERPRISE LINUX 3 - SECURITY GUIDE
Page 1: ...Red Hat Enterprise Linux 3 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: ......