

That’s the display number assigned to that particular variable. Note the 3 before the colon? It’s not just to pretty up the output. In our example above, the display output for our variable c is “3: c = 11”. It’s the number next to the “variable=value” line in the display output. The gotcha here is that undisplay doesn’t operate on variable names. When you’re no longer interested in a given variable, you can issue the undisplay command. If you later step into that function again, those variables will be displayed. It will absolutely display them the next chance it gets. However, gdb doesn’t forget about those variables. If the variables we’re interested in are local to a function that at some point returns, those variables will no longer be displayed once they’re out of scope. It’s worth noting that the variable value information will only be displayed for variables that are currently in scope. As you can imagine, this can save a tremendous amount of time over, say, repeatedly using a step command followed by a print command. Let’s now run our app, stopping at main().Įvery time we step through the code, our program execution pauses and the current values of the variables we asked gdb to display are shown. Reading symbols from /home/skirk/demo.done. Reading symbols from /home /skirk /demo.done.Ĭopyright (C) 2017 Free Software Foundation, Inc. Type "apropos word" to search for commands related to "word". Type "show configuration" for configuration details.įor bug reporting instructions, please see:įind the GDB manual and other documentation resources online at: This GDB was configured as "x86_64-pc-linux-gnu". There is NO WARRANTY, to the extent permitted by law. This is free software: you are free to change and redistribute it. License GPLv3+: GNU GPL version 3 or later Copyright (C ) 2017 Free Software Foundation, Inc.
