Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Visual C++] Hold console window open after program termination #1004

Open
colemickens opened this issue Aug 29, 2017 · 7 comments
Open

[Visual C++] Hold console window open after program termination #1004

colemickens opened this issue Aug 29, 2017 · 7 comments

Comments

@colemickens
Copy link

I want to debug my application, but it takes a lot of flags. I'm missing one of those flags in launch.json. However, when I start debugging with cppvsdbg, then I can't see the error message when debugging because it just terminates before I can see the error message. Some helper function in a library down inside is calling os exit, so it's not easy for me to just set a breakpoint at the bottom of my program.

Would it be possible to have the debugger launch myapplication & pause or something so that I can see stdout?

@pieandcakes
Copy link
Contributor

If you want us to launch your app and then pause, you can enable stopAtEntry to be true and we will stop at the first line of the main() method.

Otherwise this will be a feature request.

@pieandcakes pieandcakes changed the title Hold console window open after program termination [Visual C++Hold console window open after program termination Aug 30, 2017
@pieandcakes pieandcakes changed the title [Visual C++Hold console window open after program termination [Visual C++] Hold console window open after program termination Aug 30, 2017
@colemickens
Copy link
Author

colemickens commented Aug 30, 2017 via email

@colemickens
Copy link
Author

colemickens commented Aug 30, 2017 via email

@pieandcakes
Copy link
Contributor

For Visual C++ we can look at doing it but since the console showing the output is child process of the debugger and when you stop debugging, the debugger exits, this might not be something we can solve.

One of the items on our backlog is to output the text to the debug console in VSCode.

Alternatively, if it's an easy contribution here I could try to add it.

Unfortunately the Visual C++ debugger itself is not open source but thanks for the offer!

@Anandesh-Sharma
Copy link

I have also the same problem but using cin.get() i was able to pause the console output screen and press ctrl + C to exit the output screen. But there should be a way to attach this command to launch.json

@colemickens
Copy link
Author

colemickens commented Sep 11, 2017

I'm not debugging C and I need to be able to debug exceptional program exits, so the various tricks all over StackOverflow are not applicable. All I've found are confusing, unexplained answers that involve what look to be a VS specific switch (that I wouldn't know how to use otherwise).

Is there no other workaround? Even if I could just get it redirected to a file, I would at least not be blocked. How are people using the C++ debugger effectively with this serious of a limitation?

(edited briefly to fix a couple of minor typos)

@liudonghua123
Copy link

I have the same problem, need features like Ctrl+F5 run features like Visual studio.

asialasr pushed a commit to asialasr/vscode-cpptools that referenced this issue Mar 12, 2021
* Add placeholder AdapterArgs for OpenDebugAD7 in VS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants