Chapter 14. Using gdb with Different Languages
125
14.4.3.3. Constants
gdb allows you to express the constants of Modula-2 in the following ways:
•
Integer constants are simply a sequence of digits. When used in an expression, a constant is inter-
preted to be type-compatible with the rest of the expression. Hexadecimal integers are specified by
a trailing
H
, and octal integers by a trailing
B
.
•
Floating point constants appear as a sequence of digits, followed by a decimal point and another
sequence of digits. An optional exponent can then be specified, in the form
E[+|-]
nnn
, where
[+|-]
nnn
is the desired exponent. All of the digits of the floating point constant must be valid
decimal (base 10) digits.
•
Character constants consist of a single character enclosed by a pair of like quotes, either single
(
’
) or double (
"
). They may also be expressed by their ordinal value (their ascii value, usually)
followed by a
C
.
•
String constants consist of a sequence of characters enclosed by a pair of like quotes, either single
(
’
) or double (
"
). Escape sequences in the style of C are also allowed. Refer to Section 14.4.1.2
C
and C++constants
, for a brief explanation of escape sequences.
•
Enumerated constants consist of an enumerated identifier.
•
Boolean constants consist of the identifiers
TRUE
and
FALSE
.
•
Pointer constants consist of integral values only.
•
Set constants are not yet supported.
14.4.3.4. Modula-2 defaults
If type and range checking are set automatically by gdb, they both default to
on
whenever the working
language changes to Modula-2. This happens regardless of whether you or gdb selected the working
language.
If you allow gdb to set the language automatically, then entering code compiled from a file whose
name ends with
.mod
sets the working language to Modula-2. Refer to Section 14.1.3
Having gdb
infer the source language
, for further details.
14.4.3.5. Deviations from standard Modula-2
A few changes have been made to make Modula-2 programs easier to debug. This is done primarily
via loosening its type strictness:
•
Unlike in standard Modula-2, pointer constants can be formed by integers. This allows you to
modify pointer variables during debugging. (In standard Modula-2, the actual address contained in
a pointer variable is hidden from you; it can only be modified through direct assignment to another
pointer variable or expression that returned a pointer.)
•
C escape sequences can be used in strings and characters to represent non-printable characters.
gdb prints out strings with these escape sequences embedded. Single non-printable characters are
printed using the
CHR(
nnn
)
format.
•
The assignment operator (
:=
) returns the value of its right-hand argument.
•
All built-in procedures both modify
and
return their argument.
Содержание ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Страница 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Страница 12: ...2 Chapter 1 Debugging with gdb ...
Страница 28: ...18 Chapter 4 Getting In and Out of gdb ...
Страница 34: ...24 Chapter 5 gdb Commands ...
Страница 44: ...34 Chapter 6 Running Programs Under gdb ...
Страница 68: ...58 Chapter 8 Examining the Stack ...
Страница 98: ...88 Chapter 10 Examining Data ...
Страница 112: ...102 Chapter 12 Tracepoints ...
Страница 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Страница 138: ...128 Chapter 14 Using gdb with Different Languages ...
Страница 144: ...134 Chapter 15 Examining the Symbol Table ...
Страница 170: ...160 Chapter 19 Debugging remote programs ...
Страница 198: ...188 Chapter 21 Controlling gdb ...
Страница 204: ...194 Chapter 22 Canned Sequences of Commands ...
Страница 206: ...196 Chapter 23 Command Interpreters ...
Страница 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Страница 296: ...286 Chapter 27 gdb Annotations ...
Страница 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Страница 322: ...312 Chapter 30 Using History Interactively ...
Страница 362: ...352 Appendix D gdb Remote Serial Protocol ...
Страница 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Страница 386: ...376 Appendix G GNU Free Documentation License ...
Страница 410: ......