Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
janwilmans is currently offline  janwilmans
Messages: 51
Registered: January 2007
Member

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 #21855 is a reply to message #21853] Mon, 08 June 2009 13:43 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello skyhawk

Which is the OS and compiler that you are using?

Best regards
Koldo


Best regards
IƱaki
Re: Debugging console app? [message #21856 is a reply to message #21855] Mon, 08 June 2009 14:14 Go to previous messageGo to next message
janwilmans is currently offline  janwilmans
Messages: 51
Registered: January 2007
Member

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 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
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 #21955 is a reply to message #21935] Fri, 12 June 2009 10:33 Go to previous messageGo to next message
janwilmans is currently offline  janwilmans
Messages: 51
Registered: January 2007
Member

Mirek,

maybe if you could help me understand the problem, I could help creating a solution? What do you mean with 'gdb uses single console' ?

Greetings,

Jan


Jan (skyhawk)
Re: Debugging console app? [message #21958 is a reply to message #21955] Fri, 12 June 2009 10:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
skyhawk wrote on Fri, 12 June 2009 04:33

Mirek,

maybe if you could help me understand the problem, I could help creating a solution? What do you mean with 'gdb uses single console' ?

Greetings,

Jan


Well, the output of your console app is mixed with outputs from gdb... And as ide depends on dbg console output to know what is going it, it makes things a little bit difficult...

I would say that using --pid or --tty or some other options might solve this problem.

Mirek
Re: Debugging console app? [message #21963 is a reply to message #21958] Fri, 12 June 2009 17:07 Go to previous messageGo to next message
janwilmans is currently offline  janwilmans
Messages: 51
Registered: January 2007
Member

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 Go to previous messageGo to next message
Goodwin is currently offline  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 #22364 is a reply to message #22336] Wed, 08 July 2009 13:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Goodwin wrote on Sat, 04 July 2009 19:04

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.


Is it Linux/console app?
Re: Debugging console app? [message #22365 is a reply to message #21853] Wed, 08 July 2009 13:42 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
Goodwin: how long did you wait after pressing F10?
At WinXP + Mingw it can take well over minute (actually couple of them) to get into the code. And it's very prone to get into unstable state after a while of debugging anyway.
Re: Debugging console app? [message #26926 is a reply to message #21853] Wed, 09 June 2010 21:03 Go to previous messageGo to next message
avpavp is currently offline  avpavp
Messages: 19
Registered: September 2009
Promising Member
I have same problem, cannot debug linux console app.

Is there a workaround for this? This seems rather serious to me?

Thanks
Re: Debugging console app? [message #29019 is a reply to message #26926] Sat, 02 October 2010 12:48 Go to previous messageGo to next message
kattle87 is currently offline  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. Razz
Re: Debugging console app? [message #29021 is a reply to message #29019] Sat, 02 October 2010 14:01 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

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. Razz

Hi Francesco

Welcome to U++ and to the forum! Just a word of warning: U++ is highly addictive Wink

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 Sad 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 Go to previous messageGo to next message
kattle87 is currently offline  kattle87
Messages: 3
Registered: October 2010
Location: Italy
Junior Member
I see... However, cin is important for me, too Razz
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 Smile
Re: Debugging console app? [message #29025 is a reply to message #29023] Sat, 02 October 2010 16:59 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

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 Go to previous messageGo to next message
kattle87 is currently offline  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 Go to previous message
mr_ped is currently offline  mr_ped
Messages: 825
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.
Previous Topic: Alternate "Copy as declaration/definition"
Next Topic: Compiling and linking problems
Goto Forum:
  


Current Time: Thu Mar 28 14:55:53 CET 2024

Total time taken to generate the page: 0.01693 seconds