Author Topic: debugging a console application with GDB - no console window  (Read 12525 times)

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
debugging a console application with GDB - no console window
« on: April 29, 2005, 12:19:35 pm »
Hi all,

thanks for this very nice looking and good to use IDE,
i appreciate to look forward to new bugfixed versions ...

but i have a small problem, maybe some of you had the same
and already found a solution or just the proper config switch.

The problem:
i get no console window, when debugging an ordinary console application
therefore, i can't see, what the debuggee prints out to stdout.

configuration:
MinGW ,
gcc version 3.4.2
gdb version 6.3


How to produce:
1)  i start with
File -> New Project -> Console Application (C++) -> Create
name: new_console -> Save

2) edit main.cpp to

that it looks like
Code

#include <iostream>

int main()
{
     int i = 7;
     i += 28;
     i /= 3;
     std::cout << "Hello world!" << std::endl;
     std::cout << " : " << i << " : " << std::endl;
     std::cout << "done." << std::endl;
     return 0;
}


3) set build options:
Project -> Build options
select Target: default
Compiler options: check "Produce debugging symbols"
Close


4.) build the default target:
Select Build target: default
Rebuild (Ctrl F11)


5.) set a breakpoint at line 7

6) start debugger (  F8  )
everything works perfectly you can step through with Debug -> Next (F7)
watches, Local variables, everything works as expected,

as you can see here



but i can't see a console window anywhere !!


PLEASE HELP me

what i'm doing wrong ???

-tiwag

Offline Profic

  • Multiple posting newcomer
  • *
  • Posts: 56
debugging a console application with GDB - no console window
« Reply #1 on: April 29, 2005, 01:47:41 pm »
First of all, ONE thing which you doing WRONG is disliking to SEARCH using, for example, google.
And stop to cry - it's useless :)

Just return to gdb 5.2.1 and you'll have no problems.

Or read carefully this link (all anonymous posts there are mine)
Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
debugging a console application with GDB - no console window
« Reply #2 on: April 29, 2005, 02:15:12 pm »
Quote from: Profic
First of all, ONE thing which you doing WRONG is disliking to SEARCH using, for example, google.

i did, especially here in the codeblocks forum,
but i missed this one in the dev-cpp sf forum.

thanks for the info, it's working now

but:

the gdb-6.3 was introduced by the
+ wx-DevCpp beta6.7 package and there it works without problems, also with
+ MinGWStudio (V2.05) and
+ Chinook(0.8.8 ) it works without problems,

only with
- Code::Blocks (1.0 beta 7)   i got this behaviour, so i really thought,
i've missed some checkboxes and the failure lies on my side.

Quote from: Profic

And stop to cry - it's useless :) ...


however

:D :D :D :D :D
THANKS !  
:D :D :D :D :D

-tiwag

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
debugging a console application with GDB - no console window
« Reply #3 on: April 29, 2005, 03:42:26 pm »
for windows user:
if one needs a general accessible .gdbinit file, do the following:

create an environment variable
set HOME=%HOMEDRIVE%%HOMEPATH%
copy .gdbinit %HOME%

the HOME variable must existing during execution time of gdb,
so put it in autoexec.bat or environment settings under XP


quick summary of solution for
no-console window while debugging with dgb-6.3

create file ".gdbinit"
--------.gdbinit-------------------START-------
set new-console on
--------.gdbinit--------------------END--------


store this file in user directory:  "%HOMEDRIVE%%HOMEPATH%"

complete filepath: "%HOMEDRIVE%%HOMEPATH%\.gdbinit"

environment setting :
set HOME=%HOMEDRIVE%%HOMEPATH%


enjoy
-tiwag

Offline Profic

  • Multiple posting newcomer
  • *
  • Posts: 56
debugging a console application with GDB - no console window
« Reply #4 on: April 29, 2005, 04:32:56 pm »
Quote
i did, especially here in the codeblocks forum,
but i missed this one in the dev-cpp sf forum

All (ok, most) free IDE use mingw so they all may have same troubles :)

Quote
the gdb-6.3 was introduced by the
+ wx-DevCpp beta6.7 package and there it works without problems, also with
+ MinGWStudio (V2.05) and
+ Chinook(0.8.8 ) it works without problems

At least it didn't work with plain Dev-C++ where I first found this behaviour

Quote
whole second post

This is good solution for peoples using IDE while debuging.
I prefer to debug from console and have local-to-project .gdbinit for setting project specific options, thus I even didn't try to make any investigations more
Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
debugging a console application with GDB - no console window
« Reply #5 on: April 29, 2005, 05:39:33 pm »
Hey, nice info Profic :)
I guess, I 'll add a "gdb-init-commands" configuration ;)

Thanks,
Yiannis.
Be patient!
This bug will be fixed soon...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
debugging a console application with GDB - no console window
« Reply #6 on: April 29, 2005, 06:08:25 pm »
Just added in CVS:
Quote
* Added "gdb-initial-commands" in debugger's configuration (useful for new users to avoid creating .gdbinit)
* By default, for console projects, debugger is configured with "set new-console on"


Yiannis.
Be patient!
This bug will be fixed soon...

Offline Profic

  • Multiple posting newcomer
  • *
  • Posts: 56
debugging a console application with GDB - no console window
« Reply #7 on: April 29, 2005, 08:36:17 pm »
Yep, it's great :)
Thanks a lot!
Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
debugging a console application with GDB - no console window
« Reply #8 on: May 01, 2005, 12:01:03 pm »
Quote from: mandrav
Just added in CVS:
Quote
* Added "gdb-initial-commands" in debugger's configuration (useful for new users to avoid creating .gdbinit)
* By default, for console projects, debugger is configured with "set new-console on"


Yiannis.


i have also switched to CVS-version now !
it's really great, thanks

tiwag

Anonymous

  • Guest
debugging a console application with GDB - no console window
« Reply #9 on: May 06, 2005, 01:41:20 am »
I followed the instructions above (create %HOME% environment variable in Windows XP) but when I try to debug I still don't get a console window of any sort. I am building a wxWidgets application, not a console application, so perhaps this isn't even possible?

Offline Profic

  • Multiple posting newcomer
  • *
  • Posts: 56
debugging a console application with GDB - no console window
« Reply #10 on: May 06, 2005, 08:21:30 am »
When you start in windows any GUI application (say c::b) by double clicking exe or shortcut, do you see any console window?
Then, why you expect to see it with GUI application (is it?) build with wWidgets?

If you application is console, but use wxBase, then instructions abobe must help. If not - please provide more info about what you exactly do
Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil