News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

debugging a console application with GDB - no console window

Started by tiwag, April 29, 2005, 12:19:35 PM

Previous topic - Next topic

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

#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

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)
Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil

tiwag

Quote from: ProficFirst 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

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

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

Quotethe 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

Quotewhole 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

mandrav

Hey, nice info Profic :)
I guess, I 'll add a "gdb-init-commands" configuration ;)

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

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.
Be patient!
This bug will be fixed soon...

Profic

Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil

tiwag

Quote from: mandravJust 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

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?

Profic

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