0

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?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
shest
  • 1
  • 1
  • Can't view, or can't find where to view? – tadman Nov 12 '20 at 01:18
  • Can't find where to view. I'll update the question to be clearer – shest Nov 12 '20 at 02:15
  • Updated the question – shest Nov 12 '20 at 02:22
  • @shest I can't see _any_ code. Put the [mcve] in your question **as text** and perhaps people will consider helping out. – Ted Lyngmo Nov 12 '20 at 04:01
  • Please post code, errors, sample data or textual output here as plain-text, not as images that can be hard to read, can’t be copy-pasted to help test code or use in answers, and are barrier to those who depend on screen readers. You can edit your question to add the code in the body of your question. For easy formatting use the `{}` button to mark blocks of code, or indent with four spaces for the same effect. The contents of a **screenshot can’t be searched, run as code, or copied and edited to create a solution.** – tadman Nov 12 '20 at 04:08
  • Edited the page to show code directly; however, the picture is important for Xcode context. – shest Nov 12 '20 at 21:30

1 Answers1

2

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.

Jim Ingham
  • 25,260
  • 2
  • 55
  • 63