I have been assigned to a project at work and I need to do some old-style debug because the Debug itself doesn't work with the libraries which are being used.
So, since it's a C++ with Qt application, I first tried with qDebug(). Then with cout, and finally with printf (which I hate in comparision to the former ones). NOTHING.
Nothing is written into the output window of Visual Studio 2008, and I'm quite sure it is executing these lines of code (I even tried to put a qDebug at the very beginning of the main.cpp). It is a GUI app by the way, and I've tried Debug output as well as Build output, but nothing is displayed.
I have looked for similar questions, but none of them provided a solution yet. Any help?
Chances are, your Visual Studio environment has been configured to redirect all output from the Output Window to the Immediate Window. I've been bitten by this a couple of times, as this is inexplicably a default setting for certain environment configurations.
To reset the setting, follow these steps:
From the "Tools" menu, select "Options".
Expand the "Debugging" item in the tree to the left, and select "General".
In the list to the right, scroll down to "Redirect all Output Window text to the Immediate Window", and ensure that it is unchecked.
Click OK to return sanity to the world.
It looks like you can't use qDebug directly if it is not a console based application. Sounds weird to me, but sadly it is like that.
Related
I am having problem inspecting specific things in my Debug.WriteLn output in Visual Studio 2015. (Same thing in 2012 and 2013 version too.)
XCode and Eclipse both include a filter-box on top of the Output window. I tried to find a similar extension for Visual Studio but I had no luck. Is there any way to have a similar feature and filter the output window?
I use this method:
Open Debug – Output window, just by right click on the Window.
You can Check / Uncheck as per your need.
One thing I just found in VS 2017 (and I think it's in other versions too) is:
Tools | Options | Debugging | General > Redirect all Output Window text to the Immediate Window
This gives you just the program's Debug.WriteX output in the immediate window and leaves all that other trash in the output window, which you can leave closed.
I can still go look at the trash in the output window if I need to for some reason; it isn't suppressed. It just doesn't make it into the immediate window.
And I just leave the little immediate window docked at the bottom.
I think it's good because with all the trash coming out in the output window, I really wasn't paying any more attention to the output than I would a terms of use agreement (which is to say, just about none), so the baby was getting thrown out with the bath water. But now I actually see some program debug output that lo and behold, needs attention.
IMHO Microsoft should expand the output window dropdown box to include all the categories that FetFrumos pointed out in his answer, so developers can just leave it set to "Program Output". I think this would be a good improvement.
Various services in VS write to the output window so there is an in-built filter based on source. You can often select the source such as "Build Output", "Test discovery", "General", "Debug" etc.
Debug.Write calls are intercepted by VS and the text ends up in the Output window but there is no in built filtering.
I can think of 3 ways around this:
Use DbgView to intercept the Debug.Write messages instead of letting VS intercept them. DbgView has very powerful filtering and coloring features*
Try this extension that colors the output based on regular expressions
Write your own extension (it's not that difficult!)
(*) If you go down this route note that Debug.Write is just a trace and when you attach the VS debugger it will add itself as the trace lister. Same for DbgView. But when you detach it will not remove the listener and the messages will be lost.
I've wanted to filter Visual Studio output for many years. Eventually I decided to write an extension to do it. If you're interested, you can check it out at niahtextfilter.com.
Here's an idea of what it does:
Summary: Is there an easy way to save alternate command arguments used by the Visual Studio debugger?
Details:
Visual Studio has an option to set Command Argument that are used by the debugger. For example in the screenshot shown here I've set them to FOO BAR. Sometimes when debugging a project I want to switch the arguments to test different input sets. And often the arguments are much longer than just FOO BAR. It would be nice if there was a way to save the arguments that I've typed and switch between them quickly. Ideally it would also be possible to change the working directory at the same time. But I haven't found a way to do this yet so that's why I'm asking here. I'm using Visual Studio Professional 2012.
You can just create new configuration(s) for this project. I see that your current active configuration is Debug (top left corner of project settings dialog). You can create new configuration(s), which will be based on this one, and name them like Debug-Test1, Debug-Test2, etc. After you will do this you will have a choice to switch between this configurations in VS Debug Toolbar.
I am using Visual Studio 2010, and because of the amount of debug output I'm producing, and the difficulty of finding the beginning of the output for a new run, I have been manually using the Debug "Clear All" action (from the mouse right-click popup menu on the Debug output window). Plus I have to put some kind of break or dialog box in the beginning, just so I have a chance to do this before the debug output gets going.
Well after a couple of thousand times, this is getting very, very old (seriously, because its come up in almost every programming project I've done in the last five years). But I cannot seem to find any option or simple Debug.{method} to do this automatically for me.
This has been bugging me forever, and though its a simple question, I have never found an easy answer (short of writing my own listener) in any version of the .net VS IDE's.
Anyone know how to do this or have any ideas? thnx..
Right click the middle of the output window and turn off all but Program Output
What I do in cases like this is to use Debug View but to see the debug output in Debug view you need to detach the process from you visual studio debugger. You can do that through the Debug->Processes window.
What debug view provides is extra highlighting and coloring of different kind of debug output so that the relevant things are easily recognizable. Furthermore, you can stop receiving debug output by simply hitting a key on its toolbar.
I know that this might not answer your question but this at least gives you an option to do it otherwise.
The question itself is in the title. See screenshots.
When I'm using those both shortcuts, my Visual Studio 2010 does exactly the same action (debug tests). However, the shortcuts are assigned for different buttons.
What am I missing?
UPDATE:
Here is my keyboard customizations in "Tools" - "Customize" - "Keyboard".
There is no difference, VS treats Ctrl+R,Ctrl+D and Ctrl+R,D as the same command. There's ancient history behind this behavior, going all the way back to an old text editor named Wordstar. Which used control key chords like that. Also adopted by Borland, a company that Microsoft was fiercely competitive with. And by me, I still use it, got a weird left pinky to show for it.
You'll have to assign a different chord for the other command.
The difference is that when using CTRL+R, CTRL+D, the test runner runs the tests with the debugger attached.
This means that you can set breakpoints in the tests and step through the code. It is very useful at times.
EDIT: I think I missed the fact that you probably know about the concept of debugging tests. As Fishermaen points out, the shortcuts might be messed up. Do you have Resharper or any other 3rd party tool that alters these settings perhaps?
Check in "Tools" - "Customize" - "Keyboard" if the shortcuts are wired up correctly.
I believe there is a setting (or combination of settings) in Visual Studio that allow you to see in the Immediate Window (or Output Window, I can't remember which), the timestamp and name of an assembly as it is loaded while debugging. I used to have this switched on as it is very useful for finding performance issue areas. Sadly however, when VS recently decided to undock all my windows for no good reason, I had to reset my VS settings and have now lost this.
I can't find for the life of me which setting it was that I had switched on.
Any help appreciated.
Apart from reading Debug output messages in Output window, you can also use Modules Window (at least in Visual Studio 2013) which gives you a nice searchable list of loaded modules with various additional details:
Debug -> Windows -> Modules
In the Output window, change the "Show output from" combo to Debug if necessary. Right-click the window and tick "Module load messages". And any others you might want to see.