shest
shest

Reputation: 1

Xcode debugging C++ view global variables

No trouble viewing self/local variables, but can't view global variables in the debugging window while running C++ programs.

For example:

int global = 0;
void func(int arg1, int arg2) {
    page_table_base_register = nullptr; // defined globally elsewhere
    int local = arg1;
}

xcode example:
xcode example

I'd like to see the status of page_table_base_register, which is defined globally elsewhere, as well as the status of global even though it is not used in the func. I can only inspect the arguments of the function and local variable in the Xcode debugging stack window. The Linked picture shows the Xcode debugging stack window that I'm referring to.

Is there any way to do this?

Upvotes: 0

Views: 415

Answers (1)

Jim Ingham
Jim Ingham

Reputation: 27173

Xcode doesn't have a dedicated UI for global variables. But you can get a live display of the results of any expression in the Xcode Locals view by bringing up the context menu in the Locals area and choosing "Add expression". For the expression, use the name of the global variable you want to see.

Upvotes: 2

Related Questions