Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Can't Debug under Windows?
Can't Debug under Windows? [message #188644] Mon, 02 April 2007 19:47 Go to next message
Eclipse UserFriend
Originally posted by: iain.dot.mccracken.gmail.com

I'm new to Eclipse, and can't get debugging working under Windows.

I'm using MinGW and friends, Sun jre 1.6.0 -- I launch Eclipse from a
batch file that sets the PATH variable to point to these.

No, I cannot use Cygwin -- I'm packaging these things together for a
client, and they refuse to use Cygwin for licensing reasons.



I create a new Managed Make C++ project, and type in a tiny hello-world
oneliner.

It builds fine, producing .\Debug\hello.exe using MinGW's gcc and
friends. A quick poke with objdump reveals that there is debug info in
there -- all well and good.

1)

(defaults: gdb/mi debugger with Cygwin command set)

If I just try to debug (accepting the defaults for the debugger when I
create the run configuration) I get an error box that says: "Failed to
set environment variables, arguements, working directory"

with info:

Failed to set program arguments, environment or working directory.
Unable to set working directory: "C:\\Documents and
Settings\\iain\\workspace\\test1": Invalid argument."

With the working directory whine repeated 3 times.

At this point, Eclipse is permanently in this error mode, no matter what
I change in the debugger settings. I can delete the run config and
create a new one. I can even nuke the \eclipse\configuration directory
and the workspace, still can't get scenario 2 below.

2)

If I go and select "gdb debugger" (before doing ANYTHING else with
Eclipse) then it may or may not work.

If it fails, the app terminates (-1073741819), and gdb says: "You can't
do that without a process to debug."




Question:

How do you get C/C++ debugging to work under Eclipse in Windows using MinGW?

Iain.
Re: Can't Debug under Windows? [message #188687 is a reply to message #188644] Tue, 03 April 2007 14:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jkalinowski.microwavedata.com

Did you install GDB? I installed MinGW maybe in November but it didn't
have GDB included in it, I had to do it seperately.


Iain McCracken wrote:
> I'm new to Eclipse, and can't get debugging working under Windows.
>
> I'm using MinGW and friends, Sun jre 1.6.0 -- I launch Eclipse from a
> batch file that sets the PATH variable to point to these.
>
> No, I cannot use Cygwin -- I'm packaging these things together for a
> client, and they refuse to use Cygwin for licensing reasons.
>
>
>
> I create a new Managed Make C++ project, and type in a tiny hello-world
> oneliner.
>
> It builds fine, producing .\Debug\hello.exe using MinGW's gcc and
> friends. A quick poke with objdump reveals that there is debug info in
> there -- all well and good.
>
> 1)
>
> (defaults: gdb/mi debugger with Cygwin command set)
>
> If I just try to debug (accepting the defaults for the debugger when I
> create the run configuration) I get an error box that says: "Failed to
> set environment variables, arguements, working directory"
>
> with info:
>
> Failed to set program arguments, environment or working directory.
> Unable to set working directory: "C:\\Documents and
> Settings\\iain\\workspace\\test1": Invalid argument."
>
> With the working directory whine repeated 3 times.
>
> At this point, Eclipse is permanently in this error mode, no matter what
> I change in the debugger settings. I can delete the run config and
> create a new one. I can even nuke the \eclipse\configuration directory
> and the workspace, still can't get scenario 2 below.
>
> 2)
>
> If I go and select "gdb debugger" (before doing ANYTHING else with
> Eclipse) then it may or may not work.
>
> If it fails, the app terminates (-1073741819), and gdb says: "You can't
> do that without a process to debug."
>
>
>
>
> Question:
>
> How do you get C/C++ debugging to work under Eclipse in Windows using
> MinGW?
>
> Iain.
Re: Can't Debug under Windows? [message #188757 is a reply to message #188687] Wed, 04 April 2007 03:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: iain.dot.mccracken.gmail.com

Yes, gdb was included in my bundle. gdb can't exit with an error if it's
not installed, can it? :)

I did find two problems:

- having spaces in the workspace's pathname -- it defaults to the user's
home (C:\Documents and Settings\username\workspace in the average
system). The CDT apparently doesn't quote properly under Windows without
Cygwin.

- msys screws things up royally, I don't know how. The application to be
debugged exits abnormally before gdb can even attach to it... But
bundling only MinGW works just fine.

This failure to quote filenames is a major flaw, and I hope that the CDT
developers are fixing it for V4. After all, Windows has had filenames
with spaces for over a decade now. *nix for much longer.


Jerermy wrote:
> Did you install GDB? I installed MinGW maybe in November but it didn't
> have GDB included in it, I had to do it seperately.
>
>
> Iain McCracken wrote:
>> I'm new to Eclipse, and can't get debugging working under Windows.
>>
>> I'm using MinGW and friends, Sun jre 1.6.0 -- I launch Eclipse from a
>> batch file that sets the PATH variable to point to these.
>>
>> No, I cannot use Cygwin -- I'm packaging these things together for a
>> client, and they refuse to use Cygwin for licensing reasons.
>>
>>
>>
>> I create a new Managed Make C++ project, and type in a tiny
>> hello-world oneliner.
>>
>> It builds fine, producing .\Debug\hello.exe using MinGW's gcc and
>> friends. A quick poke with objdump reveals that there is debug info in
>> there -- all well and good.
>>
>> 1)
>>
>> (defaults: gdb/mi debugger with Cygwin command set)
>>
>> If I just try to debug (accepting the defaults for the debugger when I
>> create the run configuration) I get an error box that says: "Failed to
>> set environment variables, arguements, working directory"
>>
>> with info:
>>
>> Failed to set program arguments, environment or working directory.
>> Unable to set working directory: "C:\\Documents and
>> Settings\\iain\\workspace\\test1": Invalid argument."
>>
>> With the working directory whine repeated 3 times.
>>
>> At this point, Eclipse is permanently in this error mode, no matter
>> what I change in the debugger settings. I can delete the run config
>> and create a new one. I can even nuke the \eclipse\configuration
>> directory and the workspace, still can't get scenario 2 below.
>>
>> 2)
>>
>> If I go and select "gdb debugger" (before doing ANYTHING else with
>> Eclipse) then it may or may not work.
>>
>> If it fails, the app terminates (-1073741819), and gdb says: "You
>> can't do that without a process to debug."
>>
>>
>>
>>
>> Question:
>>
>> How do you get C/C++ debugging to work under Eclipse in Windows using
>> MinGW?
>>
>> Iain.
Re: Can't Debug under Windows? [message #188772 is a reply to message #188757] Wed, 04 April 2007 10:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: markus.milleder.generali.at

Iain McCracken wrote:

> - having spaces in the workspace's pathname -- it defaults to the user's
> home (C:Documents and Settings\username\workspace in the average
> system). The CDT apparently doesn't quote properly under Windows without
> Cygwin.

> This failure to quote filenames is a major flaw, and I hope that the CDT
> developers are fixing it for V4.

> After all, Windows has had filenames with spaces for over a decade now.
.. which it does not use. Just look at all the short name paths in the
registry for practically every (especially Microsoft) program.
And don't get me started on quoting rules and their difference depending
on the use of the command string (cmd.exe vs command.com vs registry\Run
vs service definitions vs uninstaller commands vs ...)

> *nix for much longer.
But "nobody" was dumb enough to use them, and so "nobody" writes his
scripts in a way that works with them :-) (e.g. "$@" vs $*)

So don't get your hopes too high - even if CDT does everything right,
chances are the rest of the toolchain may stay unhappy.
Re: Can't Debug under Windows? [message #188801 is a reply to message #188772] Wed, 04 April 2007 15:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: iain.dot.mccracken.gmail.com

Markus Milleder wrote:
> Iain McCracken wrote:
>
>> - having spaces in the workspace's pathname -- it defaults to the
>> user's home (C:Documents and Settings\username\workspace in the
>> average system). The CDT apparently doesn't quote properly under
>> Windows without Cygwin.
>
>> This failure to quote filenames is a major flaw, and I hope that the
>> CDT developers are fixing it for V4.
>
>> After all, Windows has had filenames with spaces for over a decade now.
> . which it does not use. Just look at all the short name paths in the
> registry for practically every (especially Microsoft) program.
> And don't get me started on quoting rules and their difference depending
> on the use of the command string (cmd.exe vs command.com vs registry\Run
> vs service definitions vs uninstaller commands vs ...)
>
>> *nix for much longer.
> But "nobody" was dumb enough to use them, and so "nobody" writes his
> scripts in a way that works with them :-) (e.g. "$@" vs $*)
>
> So don't get your hopes too high - even if CDT does everything right,
> chances are the rest of the toolchain may stay unhappy.

Toolchain unhappy? It helps if you give the tools proper parameters when
you invoke them. CDT got the makefile right (I used managed make mode)
-- and g++ was happy. So happy, in fact, that it actually produced
executables.

CDT got the invocation of gdb wrong. It provided *wrong*parameters* to
gdb. If it had provided *proper*parameters* to gdb, then gdb would have
been happy and happily debugged the executable that g++ happily produced.

A simple little character (number 34 on the ASCII chart) would have made
everyone happy. This character has been known for decades, and obviously
the Linux code in CDT uses it properly, as pathnames with spaces in them
work just fine there. Omitting the quotes causes the same errors as
CDT's incorrect invocation of gdb farts out on Windows.

I don't think my hopes are too high. Just hoping that CDT would have
invoked gdb properly instead of IMproperly.

Or, maybe Eclipse developers don't care about the quality of their product?
Re: Can't Debug under Windows? [message #188817 is a reply to message #188801] Wed, 04 April 2007 18:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jkalinowski.microwavedata.com

Honestly I have seen this problem before with the exact errors you
mentioned before. I reinstalled the toolchain and it worked.


Iain McCracken wrote:
> Markus Milleder wrote:
>> Iain McCracken wrote:
>>
>>> - having spaces in the workspace's pathname -- it defaults to the
>>> user's home (C:Documents and Settings\username\workspace in the
>>> average system). The CDT apparently doesn't quote properly under
>>> Windows without Cygwin.
>>
>>> This failure to quote filenames is a major flaw, and I hope that the
>>> CDT developers are fixing it for V4.
>>
>>> After all, Windows has had filenames with spaces for over a decade now.
>> . which it does not use. Just look at all the short name paths in the
>> registry for practically every (especially Microsoft) program.
>> And don't get me started on quoting rules and their difference
>> depending on the use of the command string (cmd.exe vs command.com vs
>> registry\Run vs service definitions vs uninstaller commands vs ...)
>>
>>> *nix for much longer.
>> But "nobody" was dumb enough to use them, and so "nobody" writes his
>> scripts in a way that works with them :-) (e.g. "$@" vs $*)
>>
>> So don't get your hopes too high - even if CDT does everything right,
>> chances are the rest of the toolchain may stay unhappy.
>
> Toolchain unhappy? It helps if you give the tools proper parameters when
> you invoke them. CDT got the makefile right (I used managed make mode)
> -- and g++ was happy. So happy, in fact, that it actually produced
> executables.
>
> CDT got the invocation of gdb wrong. It provided *wrong*parameters* to
> gdb. If it had provided *proper*parameters* to gdb, then gdb would have
> been happy and happily debugged the executable that g++ happily produced.
>
> A simple little character (number 34 on the ASCII chart) would have made
> everyone happy. This character has been known for decades, and obviously
> the Linux code in CDT uses it properly, as pathnames with spaces in them
> work just fine there. Omitting the quotes causes the same errors as
> CDT's incorrect invocation of gdb farts out on Windows.
>
> I don't think my hopes are too high. Just hoping that CDT would have
> invoked gdb properly instead of IMproperly.
>
> Or, maybe Eclipse developers don't care about the quality of their product?
Re: Can't Debug under Windows? [message #188824 is a reply to message #188817] Wed, 04 April 2007 19:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: iain.dot.mccracken.gmail.com

Jerermy wrote:
> Honestly I have seen this problem before with the exact errors you
> mentioned before. I reinstalled the toolchain and it worked.

I believe you, I do.

Problem is, having a workspace in "C:\Documents and
Settings\iain\workspace" just doesn't work for me, no matter how many
times I play with the toolchain. Do note, however, that gcc and friends
are just fine -- absolutely no problems there, just CDT fails to quote
its arguments to gdb.

Having a workspace in "C:\workspace" works just fine, so I'll be telling
my client to put his workspace on a path with no spaces, and to inspect
CDT V4 when it's released for the same bug.

I just retested this now to make sure I wasn't lying :)

As a quick test, I tried this on a machine with Cywin installed (and
cygwin's /bin directory on the Windows %PATH% when invoking Eclipse),
and everything worked fine for workspace paths with spaces in them.

Clearly this is a CDT bug in the handling of MinGW-only systems.

Unfortunately, my client will be distributing my Eclipse/MinGW/jre
bundle to customers who will be working on commercial applications, and
so Cygwin is not allowed (Cygwin is NOT free for non-personal use, and
anyone shipping a commercial application that relies on the cygwin dll
is required to seek permission from and presumably pay money to Red Hat).
Re: Can't Debug under Windows? [message #188829 is a reply to message #188824] Wed, 04 April 2007 19:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jkalinowski.microwavedata.com

Yes I'm doing the same thing. We just have the workspace a little
different with the toolchain, we don't use the default. The default
anyways is kinda stupid anyways. Plus hopefully it will be fixed by CDT
4.0 if the bug is submitted now, it shouldn't be that big of a fix or
even better make the bug report and submit a patch for it.:) It doesn't
really give much information with project structures within an
organization. I haven't checked the bug database, but if you feel like,
just add this to the bug system. GCC is nice being free and I think
small things like this are not a big deal to me personally because it's
free.

Iain McCracken wrote:
> Jerermy wrote:
>> Honestly I have seen this problem before with the exact errors you
>> mentioned before. I reinstalled the toolchain and it worked.
>
> I believe you, I do.
>
> Problem is, having a workspace in "C:\Documents and
> Settings\iain\workspace" just doesn't work for me, no matter how many
> times I play with the toolchain. Do note, however, that gcc and friends
> are just fine -- absolutely no problems there, just CDT fails to quote
> its arguments to gdb.
>
> Having a workspace in "C:\workspace" works just fine, so I'll be telling
> my client to put his workspace on a path with no spaces, and to inspect
> CDT V4 when it's released for the same bug.
>
> I just retested this now to make sure I wasn't lying :)
>
> As a quick test, I tried this on a machine with Cywin installed (and
> cygwin's /bin directory on the Windows %PATH% when invoking Eclipse),
> and everything worked fine for workspace paths with spaces in them.
>
> Clearly this is a CDT bug in the handling of MinGW-only systems.
>
> Unfortunately, my client will be distributing my Eclipse/MinGW/jre
> bundle to customers who will be working on commercial applications, and
> so Cygwin is not allowed (Cygwin is NOT free for non-personal use, and
> anyone shipping a commercial application that relies on the cygwin dll
> is required to seek permission from and presumably pay money to Red Hat).
>
Re: Can't Debug under Windows? [message #188923 is a reply to message #188801] Fri, 06 April 2007 08:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: markus.milleder.generali.at

Iain McCracken wrote:

> Markus Milleder wrote:
>> So don't get your hopes too high - even if CDT does everything right,
>> chances are the rest of the toolchain may stay unhappy.

> Toolchain unhappy? It helps if you give the tools proper parameters when
> you invoke them. CDT got the makefile right (I used managed make mode)
> -- and g++ was happy. So happy, in fact, that it actually produced
> executables.

So we seem to have made similar experiences - it works, but only most of
the time.

I have seen this for much more than just CDT - just try to guess why
neither Cygwin nor MinGW install under "C:\Program Files" normally :-)

With concrete cases of failures like
> CDT got the invocation of gdb wrong. It provided *wrong*parameters* to
> gdb.
I'd recommend you try to find the place yourself and fix it - it may be a
one liner (it was for me when needing support for '#' in source filenames).

Even if you don't do that, a Bugzilla report (search for existing
beforehand) with such a concrete problem is much more likely to be solved
than a general "Spaces in workspace path don't work" report.

Unless the gdb invocation code is much worse than the make file writer, it
should be easy to find the place of the call. Getting the quoting right
may be harder as it means finding the proper tool method to do it.
Re: Can't Debug under Windows? [message #189178 is a reply to message #188923] Wed, 11 April 2007 17:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: iain.dot.mccracken.gmail.com

Markus Milleder wrote:
> Iain McCracken wrote:
>
>> Markus Milleder wrote:
>>> So don't get your hopes too high - even if CDT does everything right,
>>> chances are the rest of the toolchain may stay unhappy.
>
>> Toolchain unhappy? It helps if you give the tools proper parameters
>> when you invoke them. CDT got the makefile right (I used managed make
>> mode) -- and g++ was happy. So happy, in fact, that it actually
>> produced executables.
>
> So we seem to have made similar experiences - it works, but only most of
> the time.
>
> I have seen this for much more than just CDT - just try to guess why
> neither Cygwin nor MinGW install under "C:\Program Files" normally :-)
>
> With concrete cases of failures like
>> CDT got the invocation of gdb wrong. It provided *wrong*parameters* to
>> gdb.
> I'd recommend you try to find the place yourself and fix it - it may be
> a one liner (it was for me when needing support for '#' in source
> filenames).
>
> Even if you don't do that, a Bugzilla report (search for existing
> beforehand) with such a concrete problem is much more likely to be
> solved than a general "Spaces in workspace path don't work" report.
>
> Unless the gdb invocation code is much worse than the make file writer,
> it should be easy to find the place of the call. Getting the quoting
> right may be harder as it means finding the proper tool method to do it.
>
>

Thanks for the encouragement, Markus. I have too much other stuff to do
right now to actually hunt this one down and fix it for CDT v3. When
things settle for me, I'll look into v4 and see if I can find/fix it
there -- I'd rather submit an actual patch with a bugzilla report. Here
was just a general "anybody having the same problem" question...
Re: Can't Debug under Windows? [message #1553593 is a reply to message #189178] Thu, 08 January 2015 20:06 Go to previous message
Jose Martins is currently offline Jose MartinsFriend
Messages: 2
Registered: January 2015
Junior Member
>> How do you get C/C++ debugging to work under Eclipse in Windows using MinGW?
>> Iain

> Problem is, having a workspace in "C:\Documents and
> Settings\iain\workspace" just doesn't work for me, no matter how many
> times I play with the toolchain. Do note, however, that gcc and friends
> are just fine -- absolutely no problems there, just CDT fails to quote
> its arguments to gdb.
> Having a workspace in "C:\workspace" works just fine

This was in 2007 but I still found this same problem in 2015 using Fortran CDT and MinGW in Windows.
Solution for debugging is using a workspace at c:\etc\workspace, no spaces.

another usefull tip for me: ignore the message
".gdbinit: no such file or directory"

Jose
Previous Topic:How to fix "*** [obj/flash_board_cstartup.o] Error 2"
Next Topic:GTK/GTK.h - No such file or directory
Goto Forum:
  


Current Time: Fri Apr 19 03:44:56 GMT 2024

Powered by FUDForum. Page generated in 0.01984 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top