Go to main content
Oracle® Developer Studio 12.6: Debugging a Program with dbx

Exit Print View

Updated: June 2017
 
 

print Command

In native mode, the print command prints the value of an expression. In Java mode, the print command prints the value of an expression, local variable, or parameter.

Native Mode Syntax

print expression, ...

Print the value of the expression expression, ... .

print -r expression

Print the value of the expression expression including its inherited members.

print +r expression

Do not print inherited members when the dbx output_inherited_members environment variable is set to on.

print -d [-r] expression

Show dynamic type of expression expression instead of static type.

print +d [-r] expression

Don’t use dynamic type of expression expression when the dbx output_dynamic_type environment variable is set to on.

print -s expression

Print the value of expression expression for each thread in the current OpenMP parallel region if the expression contains private or thread-private variables.

print -S [-r] [-d] expression

Print the value of expression expression including its static members (C++ only)

print +S [-r] [-d] expression

Don't print static members when the dbxenv variable show_static_members is set to on (C++ only).

print -p expression

Call the prettyprint function.

print +p expression

Do not call the prettyprint function when the dbx output_pretty_print environment variable is on.

print -L expression

If the printing object expression is larger than 4K, enforce the printing.

print +l expression

If the expression is a string (char *), print the address only, do not print the literal.

print -l expression

('Literal’) Do not print the left side. If the expression is a string (char *), do not print the address, just print the raw characters of the string, without quotes.

print -fformat expression

Use format as the format for integers, strings, or floating-point expressions.

print -Fformat expression

Use the given format but do not print the left hand side (the variable name or expression).

print -o expression

Print the value of expression, which must be an enumeration as an ordinal value. You can also use a format string here (-fformat). This option is ignored for non-enumeration expressions.

print —m expression

Apply macro expansion to expression when the dbxenv variable macro_expand is set to off.

print +m expression

Skip macro expansion of expression when the dbxenv variable macro_expand is set to on.

print -- expression

“--” signals the end of flag arguments. This is useful if expression can start with a plus or minus. SeeProgram Scope for scope resolution rules.

where:

expression is the expression whose value you want to print.

format is the output format you want used to print the expression. If the format does not apply to the given type, the format string is silently ignored and dbx uses its built-in printing mechanism.

The allowed formats are a subset of those used by the printf(3S) command. The following restrictions apply:

  • No n conversion.

  • No * for field width or precision.

  • No %<digits>$ argument selection.

  • Only one conversion specification per format string.

    The allowed forms are defined by the following simple grammar:

    FORMAT ::= CHARS % FLAGS WIDTH PREC MOD SPEC CHARS

    CHARS ::= <any character sequence not containing a %>

    | %%

    | <empty>

    | CHARS CHARS

    FLAGS ::= + | - | <space> | # | 0 | <empty>

    WIDTH ::= <decimal_number> | <empty>

    PREC ::= . | . <decimal_number> | <empty>

    MOD ::= h | l | L | ll | <empty>

    SPEC ::= d | i | o | u | x | X | f | e | E | g | G |

    c | wc | s | ws | p

    If the given format string does not contain a %, dbx automatically prepends one. If the format string contains spaces, semicolons, or tabs, the entire format string must be surrounded by double quotes.

Java Mode Syntax

print expression, ... | ...

Print the values of the expressions expression, ... or identifier identifier, ....

print -r expression | identifier

Print the value of expression or identifier including its inherited members.

print +r expression | identifier

Do not print inherited members when the dbx output_inherited_members environment variable is set to on.

print -d [-r] expression | identifier

Show dynamic type of expression or identifier instead of static type.

print +d [-r] expression | identifier

Do not use dynamic type of expression or identifier when the dbx output_dynamic_type environment variable is set to on.

print -- expression | identifier

”--’ signals the end of flag arguments. This is useful if expression can start with a plus or minus. See Program Scope for scope resolution rules.

where:

class-name is the name of a Java class. You can use either of the following:

  • The package path using a period (.) as a qualifier; for example, test1.extra.T1.Inner

  • The full path name preceded by a pound sign (#) and using slash (/) and dollar sign ($) as qualifiers. For example, #test1/extra/T1$Inner. Enclose class-name in quotation marks if you use the $ qualifier.

expression is the Java expression whose value you want to print.

field-name is the name of a field in the class.

identifier is a local variable or parameter, including this, the current class instance variable (object-name.field-name) or a class (static) variable (class-name.field-name).

object-name is the name of a Java object.