Author Topic: Debugging console doesn't open up (Ubuntu)  (Read 4911 times)

Offline candide

  • Single posting newcomer
  • *
  • Posts: 8
Debugging console doesn't open up (Ubuntu)
« on: August 30, 2006, 01:06:25 am »
I have recently installed the nightly builds on Ubuntu and XP. The debugger works fine on Windows but I have a little bit of trouble in using it under Linux. What's wrong ? For instance, suppose i'm debugging an hello word file. I put the cursor at the end of the printf line and start debugging : under XP, the debugger opens up a console to display the hello world message but under Ubuntu, it doesn't. A friend of mine encountered the same problem.

Thanks for any help


Candide

matthieu

  • Guest
Re: Debugging console doesn't open up (Ubuntu)
« Reply #1 on: October 16, 2006, 09:13:39 am »
I have exactly the same problem and it's really a problem : i can't see any ouput of my program while debuging!
I use kubuntu and codeblocks and 22sept2006 revision
Thank you in advance

GuZ4217

  • Guest
Re: Debugging console doesn't open up (Ubuntu)
« Reply #2 on: December 04, 2006, 11:21:35 am »
I've got  the same problem under Ubuntu and found a solution for console programs.
(I didnt yet have to debug a GUI program, so i do not know if the the same debug error happens there.)

My workaround solution:
1. start a terminal like "xterm", "gterm", "konsole"
2. start codeblocks and do all you need to make a compilable console program (like "hello world")
3. be sure to have all these settings in your project:

http://forums.codeblocks.org/index.php?topic=4296.0

4. Build and run the program (F9)
5. use the terminal and type:  ps -a
this will show running processes, for example:

  PID TTY          TIME CMD
 5586 pts/2    00:00:00 my-running-codeblocks-program
 5587 pts/1    00:00:00 ps

the number under "PID" in the line of my-running-codeblocks-program is the one we want.
(It is the Process ID and will each time be another one you start your program)
Remember it and finally under

6. Codeblocks menu "Debug" choose "Attach to process..." and enter the PID of my-running-codeblocks-program

Now debug like you want to  8)

Now, hello world and such short programs will be terminated already by the time you got to enter "ps -a", but if you have at least one thing to type into your program (or it sleeps for a long time) it will be possible to attach the debugger at this point (first attach, then type in ;) ).
It does not affect the program flow whether or not you have set a breakpoint BEFORE attaching the debugger because it's not attached  :shock: