Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Bonanza on April 08, 2006, 02:53:22 pm

Title: Debugging "console apps" using stdin with "visual c++ toolkit 2003" as toolchain
Post by: Bonanza on April 08, 2006, 02:53:22 pm
Hi there.

---Intro---
This is my first post, so naturally I have to thank everyone working with codeblocks for the high quality and excelent feature set that was put into this.

I am teaching a c/c++ course with approx 20 students, and codeblocks is the recommeded IDE.

I have been using GCC compiler toolchain untill now, and everything works just fine with the debugger and all.

---Description---
Now I am trying to use "visual c++ toolkit 2003". I have been trying to make it debug one of my apps.

Here is what I did:
1. Installed the "Debugging Tools for Windows" added this path to "Additional Paths" for this specific toolchain
2. Created a small application with cout and cin expressions.
3. I selected the "Produce debugging symbols" in the build options
4. I pointed to the libcpmtd.lib in "Visual studio .NET"

Everything compiles and I am able to single step, and watch variable and so on.

I noticed that this console application did not have its own window, but the stdout was put in the "Debugger (debug)" window, but hey that is okay, I am debugging.

---Question---
Then I came to a stdin ("cin >>") instruction, but since codeblocks is controlling the debugger fully I guess i don't have the possiblity to enter any input for my "console app"?

Any help/comments on this would be appreciated.

Thanks in advance. 
Title: Re: Debugging "console apps" using stdin with "visual c++ toolkit 2003" as toolchain
Post by: mandrav on April 08, 2006, 05:19:59 pm
Quote
---Question---
Then I came to a stdin ("cin >>") instruction, but since codeblocks is controlling the debugger fully I guess i don't have the possiblity to enter any input for my "console app"?

This is a known limitation of C::B's debugger plugin when using cdb (or gdb under linux for that matter).
But maybe "Debug->Send user command to debugger" works? This effectively uses the debugger's stdin which must be shared with the debuggee's. I know it's awkward but it might just work...
Title: Re: Debugging "console apps" using stdin with "visual c++ toolkit 2003" as toolchain
Post by: Bonanza on April 08, 2006, 07:16:30 pm
Thanks for the quick reply, I didn't know about this menu item:)

When running CDB.exe manually (without codeblocks) i cannot(don't know how to) give any input to the console app before I chose step/go to run my "cin >>" expression. Doing this I can enter my input.

Doing the same in codeblocks(step on the "cin >>") makes the "Send user command to debugger" menu appear dimmed. This may be because codeblocks didn't receive the prompt back from CDB.exe after last command (step)?

I cannot both be running and debugging. Am I right?