Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » Debugging console app?
Debugging console app? [message #21853] |
Mon, 08 June 2009 13:22  |
|
When I run my console application from TheIde (Ctrl-F5) it works fine. But when running it in the debugger (F5) the window doesn't show, and when I press 'stop debugging' (Shift-F5) TheIde hangs and there is nothing I can do except kill -9 <theide-pid>.
I'll try to strip my app into a basic reproduction-example and post back here soon.
Gr,
Jan
Jan (skyhawk)
|
|
|
|
Re: Debugging console app? [message #21856 is a reply to message #21855] |
Mon, 08 June 2009 14:14   |
|
I'm using the SVN head revision TheIde on Ubuntu 8.04 and ofcourse gdb.
This simple console program will reproduce the problem:
#include <stdio.h>
#include <unistd.h>
int main( int argc, const char* argv[] )
{
fprintf(stderr, "start\n");
usleep(20000*1000);
fprintf(stderr, "stop\n");
}
when running in the debugger (F5), the console doesn't show and pressing shift-F5 to stop debugging within the 20 seconds of the sleep will hang TheIde until the programs ends by itself.
However, when I use ctrl-F5 the console shows fine, and I can see the printf's.
Greetings,
Jan
Jan (skyhawk)
[Updated on: Mon, 08 June 2009 16:55] Report message to a moderator
|
|
|
Re: Debugging console app? [message #21935 is a reply to message #21856] |
Thu, 11 June 2009 19:23   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
skyhawk wrote on Mon, 08 June 2009 08:14 | I'm using the SVN head revision TheIde on Ubuntu 8.04 and ofcourse gdb.
This simple console program will reproduce the problem:
#include <stdio.h>
#include <unistd.h>
int main( int argc, const char* argv[] )
{
fprintf(stderr, "start\n");
usleep(20000*1000);
fprintf(stderr, "stop\n");
}
when running in the debugger (F5), the console doesn't show and pressing shift-F5 to stop debugging within the 20 seconds of the sleep will hang TheIde until the programs ends by itself.
However, when I use ctrl-F5 the console shows fine, and I can see the printf's.
Greetings,
Jan
|
Well, it is perhaps sad, be we cannot do this yet. The problem is that gdb uses single console, at least in mode we are using.
Hopefuly, we will find a way around soon.
Mirek
|
|
|
|
|
Re: Debugging console app? [message #21963 is a reply to message #21958] |
Fri, 12 June 2009 17:07   |
|
Oh, I see, I think you are right, couldn't you open console window and attach the process to that console using --tty?
Also: understand why we're not seeing the output from the console-app but, why does TheIde hang when trying to stop de debugger? is the output from the program also messing up the communication between TheIde <> gdb ?
Greetings,
Jan
Jan (skyhawk)
|
|
|
Re: Debugging console app? [message #22336 is a reply to message #21853] |
Sun, 05 July 2009 01:04   |
Goodwin
Messages: 1 Registered: July 2009
|
Junior Member |
|
|
It seems to be I've got the same problem. I was trying to debug the project from "Getting started with TheIDE" by Jan Wilmans and fall in trouble. Building process has been completed successfully but debugging didn't even start.
Well, theIDE's appearance changes, additional panel (watches\locals\autos) appears on the bottom of IDE and message "running" is on opposite. But F10 (step over) does nothing. 'Stop debugging' command causes hang in theIDE so system monitor is only the way to kill theIDE or tested app.
I couldn't find a way how to get over it. It would be great if anyone could solve this annoying bug.
[Updated on: Sun, 05 July 2009 01:05] Report message to a moderator
|
|
|
|
|
|
Re: Debugging console app? [message #29019 is a reply to message #26926] |
Sat, 02 October 2010 12:48   |
kattle87
Messages: 3 Registered: October 2010 Location: Italy
|
Junior Member |
|
|
hello here, new user reporting in! I just found this tool like 2 days ago, and I already love it.
I'm posting here because I think this bug is strictly related to the one discussed in this thread.
I'm trying to debug a C++ (windows) console application: everything looks like working, including locals, watches, and whatever, but the console is not shown (EG: no "cmd" windows is opened, so input and output are not possible). I tried both creating an empty project and "core console app", but had no luck.
Of course, running program by ctrl+F5 works flawlessly. Is there anything that can be done about that? I don't care too much seing gdb lines around, but the "std::cout" of my code is somewhat important to me.
|
|
|
Re: Debugging console app? [message #29021 is a reply to message #29019] |
Sat, 02 October 2010 14:01   |
|
kattle87 wrote on Sat, 02 October 2010 12:48 | hello here, new user reporting in! I just found this tool like 2 days ago, and I already love it.
I'm posting here because I think this bug is strictly related to the one discussed in this thread.
I'm trying to debug a C++ (windows) console application: everything looks like working, including locals, watches, and whatever, but the console is not shown (EG: no "cmd" windows is opened, so input and output are not possible). I tried both creating an empty project and "core console app", but had no luck.
Of course, running program by ctrl+F5 works flawlessly. Is there anything that can be done about that? I don't care too much seing gdb lines around, but the "std::cout" of my code is somewhat important to me. 
|
Hi Francesco
Welcome to U++ and to the forum! Just a word of warning: U++ is highly addictive 
It is not a bug, strictly speaking, more of a design problem. Not sure if there is some solution, but I can offer you a workaround.
If you need to see only output, you can redirect it to a file and watch that. This can be done in Debug > Runtime options ... Than you can open the specified file and watch it during the debugging. Unfortunately there is no such workaround for stdin Actually attempt to read from stdin while running in debugger makes the app hang, if I am not mistaken...
Best regards,
Honza
|
|
|
Re: Debugging console app? [message #29023 is a reply to message #21853] |
Sat, 02 October 2010 15:22   |
kattle87
Messages: 3 Registered: October 2010 Location: Italy
|
Junior Member |
|
|
I see... However, cin is important for me, too 
Now I'm gonna try to see what happens on linux, and what in windows using Visual C++.
I know my opinion is worth nothing, but a little thing like this could unset C++ newbies. EG: I study math, and everyone in my class uses either dev-c++ or eclipse, but I sort of hate both of them. When looking for alternatives, some people will just disregard U++ if they can't debug their programs easily (and external debugging with gdb by pressing Alt+F5 is NOT easy for me or my friends!)
Also, concerning newbies, MinGW included in the windows package (2008.1 style) was nice, too
|
|
|
Re: Debugging console app? [message #29025 is a reply to message #29023] |
Sat, 02 October 2010 16:59   |
|
I understand you very well... I run into this obstacle myself quite a few times. It would be possible to use few tricks and feed the input to the program from prepared file (e.g. defining macro that would change ReadStdIn() behavior when run in debugger), but that is not the proper solution. The situation on Linux is exactly the same. I'll try to have a look at the code and see if we can do something about it.
As for the installer with mingw included: There are talks and plans to revive it lately. But I can't promise you any exact date when it reappears...
Honza
|
|
|
Re: Debugging console app? [message #29029 is a reply to message #29025] |
Sat, 02 October 2010 19:38   |
kattle87
Messages: 3 Registered: October 2010 Location: Italy
|
Junior Member |
|
|
Thank you very much! You know, I tried MS Visual C, LCC, devcpp, wxdevcpp, code::blocks, kdevelop, NetBeans, QT Creator, and I guess something else, too! But at first glance I just like U++ much more than everything else to give up on it and go back to the other ones =)
I would love to help but I honestly have NO idea about where to start...
|
|
|
Re: Debugging console app? [message #29033 is a reply to message #21853] |
Sun, 03 October 2010 01:05  |
mr_ped
Messages: 826 Registered: November 2005 Location: Czech Republic - Praha
|
Experienced Contributor |
|
|
kattle87: I would suggest firstly to try Bazaar/UnitTest++, so you can forget about debugging with cin/cout.
For console applications it should be perfect fit on low (unit testing) and medium (basic components integration) level, and even at highest level some tests may make sense (although last time I did console app this way, I simply put all the components together in final main, compiled it, run, and everything worked, so I didn't bother to do high level tests).
If you are unsure what I'm talking about, try to read something about TDD (Test Driven Development).
That way you can debug the code inside test, where you have already input defined, so you don't need cin, but usually if you build the code this way you don't debug. It either does pass the test soon, or when you are stuck, you revert it and start from scratch. Debugging can be much slower.
|
|
|
Goto Forum:
Current Time: Sat Apr 26 21:52:50 CEST 2025
Total time taken to generate the page: 0.03404 seconds
|