Arbitrary expressions and global variables

The global variables and arbitrary expressions are not displayed with the local variables. You can click on the line in the Source Code viewer that contains a reference to the global variable and use the Current Line(s) tab.

Alternatively, the Evaluate window can be used to view the value of any arbitrary expression.

Evaluating Expressions

Right-click on the Evaluate window, click Add Expression, then type in the expression required in the current source file language. This value of the expression is displayed for the current process and stack/thread, and is updated after every step.

Note

Linaro DDT does not apply the usual rules of precedence to logical Fortran expressions, such as x .ge. 32 .and. x .le. 45.. You need to bracket such expressions thoroughly, for example: (x .ge. 32) .and. (x .le. 45).

Note

Although the Fortran syntax allows you to use keywords as variable names, Linaro DDT is not able to evaluate such variables on most platforms. Contact Forge Support if this issue affects you.

Expressions that contain function calls are only evaluated for the current process/thread, and sparklines are not displayed for those expressions. This is because of possible side effects caused by calling functions. Use the Cross-Process Comparison or Cross-Thread Comparison windows for functions instead. See Cross-process and cross-thread comparison.

Fortran intrinsics

The following Fortran intrinsics are supported by the default GNU debugger included with Linaro DDT:

ABS

AIMAG

CEILING

CMPLX

FLOOR

IEEE_IS_FINITE

IEEE_IS_INF

IEEE_IS_NAN

IEEE_IS_NORMAL

ISFINITE

ISINF

ISNAN

ISNORMAL

MOD

MODULO

REALPART

Support in other debuggers, including the CUDA debugger variants, may vary.

Changing the language of an expression

By default, expressions in the Evaluate window, Locals tab, and Current Line(s) tab are evaluated in the language of the current stack frame. This might not always be appropriate. For example, a pointer to user-defined structure might be passed as value within a Fortran section of code, and you might want to view the fields of the C structure. Alternatively, you might want to view a global value in a C++ class while your process is in a Fortran subroutine.

You can change the language of an expression by right-clicking on the expression, choosing Change Type/Language, and selecting the appropriate language for the expression. To restore the default behavior, change this back to Auto.

Macros and #defined constants

By default, many compilers do not output sufficient information to allow the debugger to display the values of #defined constants or macros, as including this information can greatly increase executable sizes.

For the GNU compiler, when you add the -g3 option to the command line options this generates extra definition information which will then be displayed.