Visual Studio 2013 - Variable Value Window In Debugging - c++

I am a newbie programmer, and have Visual Studio Update 3 on my computer. I cannot find the window that displays the values of variables as I am debugging.
I have looked under the pull-down tab at the top entitled "Debug" and "Window", and cannot find anything. I do not know exactly what the window is called either. Please help.

If you're looking for the scoped local variable values or Autos:
you must first have the debugger running, then goto:
DEBUG => Windows => Autos
and
DEBUG => Windows => Locals
to actually see those values, you need to have a debug stopper in place and it get hit by the program.
Alternatively you can - while debugging - highlight a variable name and use the 'Quick Watch'

In the default layout, the Locals window will typically be visible in the lower left pane, but only while debugging is active.
Here you can see the debugger windows on the bottom. The left side shows current breakpoints while the right side is showing watched variables in the pane labeled Watch 1. At the bottom you'll see other panes available to display in the lower left, specifically Call Stack, Command Window, etc. The one you want to see all in scope variables at a given breakpoint is Locals
If you have closed the locals window, or otherwise cannot find it, there is a way to re-open it through the Debug->Windows menu as pnm points out

Related

Intellisense autocompletion of expressions to watch in watch window or debug console

Is it possible while debugging, and a breakpoint has been hit, to autocomplete variables in the current scope in the Debug Console or the Watch Window?
An example gif is attached of where I would hope to get some auto-completion suggestions.
Essentially, on typing just long, I would like to autocomplete to work here so that it suggests longish_variable_name that I can then possibly tab complete.
VSCode has, by default, CtrlSpace mapped to triggering autocompletion suggestions, but this only seems to work in the editor window.
Use the variable once in the debug window, and auto-complete will do the rest of the work for you ever after (given the variable name shouldn't be changed, or you need to use it in the debugger console again to get auto-completion suggestion.)
I have a test variable named very_very_long_var — but the debug window didn't suggest anything on the first go. It was presented once I used it the first time in that window.

How to return debug window in Qt Creator

When I run C++ program under qt creator in debug mode, Qt creator shows me debug window with "local and expressions", "breakpoints" and so on.
Sometimes I close these windows to watch the code by pressing Esc. How to return this views back? I really need to loot at stack trace right now, but I can't find a button to show me the stack.
I looked at this question but it didn't help. My debugging window working well, but when I close it, I cannot open it again. The only way - restart whole program, than debugging view appear again and I can operate with it.
You need to go back to the "Debug" mode by clicking on the debug (bug) icon on the left hand side.
You can do so by pressing CTRL + 4.
"Debug" mode and CTRL + 4 didn't help me, so here is another solution:
Click "Views" which should be on the dark grey bar in the lower right area of your user interface, in small print. There you can check or uncheck any of the Debug windows you want to see.
I find it easier to just click "Reset to Default Layout" under this menu because I'm not hard to please and it brings all the debug windows I want to see back instantly.

watch window in the debug is empty

I was trying to understand how to fix my watch window but didn't find any good answer(I'm using visual studio 2013).
I used the debugger and suddenly the watch window didn't show the values or the object i'm have in the block - actually it didn't show anything anymore.
Does anyone know how can it be fixed?
Many thanks!!!
Maby this will help you:
To open the QuickWatch dialog box with a variable added While in break
mode, right-click a variable name in the source window name and choose
QuickWatch. This automatically places the variable into the QuickWatch
dialog box.
Source
The Watch windows don't show anything by default, you need to add things to them to see the values. What might have happened in your case, is that either you deleted what you had by mistake, or you ran into a bug, where something got corrupted in your solution and they were lost.
If you want to see everything that is currently in scope, the Locals window is the way to go.
And if you want a superset of that (which has both current and previous statement), use the Autos window.
The QuickWatch dialog box is similar in concept to the Watch window, but QuickWatch can display only one variable or expression at a time
https://msdn.microsoft.com/en-us/library/bhawk8xd.aspx

How do I view variables values in nsight eclipse edition

I'm using nsight eclipse edition, and I cant figure out how to view variables values in debug mode for now (meaning usual variables in host memory, debugging usual c++ code so far).
"Variables" tab does not contain anything useful for me (nothing I can use now at least), and Memory tab, which should be able to display variables by their addresses and also monitor expressions does not work for me either.
Any suggestions?
The following steps seemed to work for me:
open nsight
create a new project, select CUDA C/C++ project, and select CUDA Runtime project
the project will be populated with a simple "bitreverse" code. The initial configuration will be the debug configuration. Select Project...Build Project to build the sample code (debug version).
Now on the right hand side of the toolbar, press the "Debug" button, to switch to the Debug perspective.
on the left of the first CUDA_CHECK_RETURN(...) line of code, right click and select "Toggle Breakpoint" to set a breakpoint at that line of code.
select Run...Debug The program will then be started in debug mode, stopped at the first line of code, and the host variables will be filled in in the upper right hand corner "Variables" pane.
To the left of the idata variable, select the triangle to expand the sub-menu. The submenu is populated with the values of idata at each index. The data will be garbage, as it has not been initialized yet.
Select Run...Resume to continue program execution. Program execution will halted at the breakpoint previously set.
If we inspect the idata variable in the "Variables" pane, we see that the values have been changed (initialized) to 0, 1, 2, ... etc.
If you attempt to debug a project for which you have built the "Release" configuration instead of "Debug" configuration, you will have a variety of issues, and will get a message "no source available" and there will be no variables displayed in the "Variables" pane.
I was using gcc 4.8, which caused problems.
Now I downgraded to gcc 4.6 and it solved problem.
Robert Crovella, thanks for your effort.

How to view contents of an array while debugging in Code Blocks?

This is probably a silly question and i am posting this Post-Googling,
The question is,
How do i view the contents of an array while debugging, Provided the Breakpoint is in function not Main?
I am using code::blocks 13.12 version and i set a break point in my sample simple c++ code,
and i want to observe how the contents of the array change with the code but all i see is the the address of the array under watch window,
It is however displaying the values of other integer variables correctly,
a is an array
I forgot to mention that i am tracking the array in a function and not in main,and i am aware that main passes the address of the array to the function being called(by reference i meant)
I am relatively new to codeblocks, Am i missing some setting or something?
Right click on the cell, then select "Properties", there you can tell it to "watch as array", and tell it the index range to watch.
i am using 12.11. I select the array variable suppose a, choose "watch a" in the right button down menu, and I can see the values in the array a.
Another thing that I use is watching under cursor.
If you go Settings -> Debugger... -> GDB/CDB debugger -> Default and you enable selection "Evaluate expressions under cursor", every time you leave mouse pointer above a variable in the code, it will be watched.
It's not the same with having it in Watches toolbar, but strangely it will show array's fields.
Debug -> Debugging windows -> Watches
you may watch the variables in this way
in convenience, you can find button "Debugging Windows" near to the debug toolbar, choose "watch", hope you can find it!