User forums > Help

debugging a console application with GDB - no console window

(1/3) > >>

tiwag:
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;
}

--- End code ---


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

Profic:
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)

tiwag:

--- Quote from: Profic ---First of all, ONE thing which you doing WRONG is disliking to SEARCH using, for example, google.

--- End quote ---

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 :) ...

--- End quote ---


however

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

-tiwag

tiwag:
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

Profic:

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

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
--- End quote ---

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


--- Quote ---whole second post
--- End quote ---

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

Navigation

[0] Message Index

[#] Next page

Go to full version