eclipse-cdt debugging doesn't work on FreeBSD 7.0 amd64?

Stephane E. Potvin sepotvin at FreeBSD.org
Tue Nov 11 08:46:39 PST 2008


Rick C. Petty wrote:
> On Mon, Nov 10, 2008 at 03:57:57PM -0500, Stephane E. Potvin wrote:
>> Rick C. Petty wrote:
>>> I've been using ganymede and CDT 5.0.1 via the update site
>>> (http://download.eclipse.org/tools/cdt/releases/ganymede/) and was able to
>>> get debugging to work, eventually.  It was painful to set up and I don't
>>> recall my exact steps.  I did use the "Other Toolchain" instead of Linux
>>> Toolchain, but that shouldn't make a difference, right?
>>>
>> It depends, If you want to use a managed Makefile project then you'll 
>> have to select a valid Toolchain (Linux being the one closest to us, so 
>> the more likely to work out of the box). If you provide your own 
>> Makefile then it should not make much of a difference as Eclipse won't 
>> control how the compiler/linker will be called anyway.
> 
> Is the compiler/linker called from Eclipse any faster than run through a
> standard make operation?  I would just like to know what the advantages are
> for using the Linux toolchain, since things seem to be working for the most
> part using the native toolchain.
> 
The Eclipse cdt plugin does not provide any C/C++ compiler, it uses the 
native compiler on the platform. The toolchain selections tells Eclipse 
how to call the compiler on the platform and how to enable/disable 
features of the compiler. If you use the "Other toolchain" then as 
Eclipse doesn't know how to call the compiler on the platform it cannot 
generate the makefile itself. If you use the linux toolchain then it 
will be able to create a makefile and will call the compiler/linker as 
if it were the Linux one. As we use the same compiler/linker as Linux it 
works correctly most of the time. If you use your own makefiles, this 
settings should not have any effects.

>>> - Program I/O does not appear in the console, even though a console is
>>> allocated when the program starts.  I am able to step through code but
>>> nothing appears in the console, even if I use fflush().  Online
>>> investigation revealed few secrets.
>>>
>> stdout and stdin should both work fine. stderr will not work with the 
>> stock cdt plugin. The pty allocation functions are not the same between 
>> Linux and FreeBSD and as such don't really work with the Linux plugin. 
>> The cdt plugin will need to be ported for this to work correctly. Could 
>> you provide me with a small Eclipse project that reproduce this?
> 
> Aha, I just realized all my output was via stderr.
> 
> I assume the difference is the change described in
> ports/java/eclipse-cdt/files/patch-cdt.core-openpty.c which changes a call
> from getpt() to posix_openpt(O_RDWR).  I can't seem to find any reference
> to getpt() anywhere.  I also couldn't find the libpty.so or libspawner.so
> anywhere in the 5.0.1 CDT jars, so they must have changed this drastically.
> About the closest things I could find was located in
> org.eclipse.cdt.core_5.0.1.200809120802.jar:
> 	org/eclipse/cdt/utils/pty/
> 	org/eclipse/cdt/utils/pty/PTY$MasterFD.class
> 	org/eclipse/cdt/utils/pty/PTY.class
> 	org/eclipse/cdt/utils/pty/PTYInputStream.class
> 	org/eclipse/cdt/utils/pty/PTYOutputStream.class
> 	org/eclipse/cdt/utils/spawner/
> 	org/eclipse/cdt/utils/spawner/EnvironmentReader.class
> 	org/eclipse/cdt/utils/spawner/ProcessFactory.class
> 	org/eclipse/cdt/utils/spawner/Spawner$1.class
> 	org/eclipse/cdt/utils/spawner/Spawner$Reaper.class
> 	org/eclipse/cdt/utils/spawner/Spawner.class
> 	org/eclipse/cdt/utils/spawner/SpawnerInputStream.class
> 	org/eclipse/cdt/utils/spawner/SpawnerOutputStream.class
> 
> Is there any chance that we could push a patch upstream to the CDT group?
> I like the idea of using eclipse's software updates over a separate
> FreeBSD port per project.  Also, I'm not sure what to patch at this point
> since much has changed since CDT 3.1.2.
> 
Yes, the call to getpt() should be changed to a call to posix_openpt(). 
The shared library must also be rebuilt to be a native library. The 
libpty.so and libspawner.so libraries are in the linux fragment which is 
not installed as the platform doesn't match. Unfortunately, the building 
process has changed between cdt 4.0 and cdt 5.0 and I was not able to 
use the eclipse-cdt port as it is right now to build cdt 5.0. I have a 
port of cdt 5.0 in progress but it's not ready yet. As whether it will 
be possible to push the changes upstream, I'll try to do it but I don't 
know if they will be accepted.

>>> - Auto-build does not work as expected.  Sometimes when I save files, it
>>> will run a "make build" (I gave it the "build" target for incremental
>>> builds).  Othertimes (more often than not), it fails to do anything when I
>>> save changes.  I had to disable the auto-build for this project and I have
>>> to manually build the project, of which I often forget to do.
>> Hmm... I never enable this function as I don't want a full 
>> buildworld/buildkernel to kick in each time I save a file so I can't 
>> comment. I'll try to setup a small project and see if I can find something.
> 
> I've grown accustomed to the autobuild when working with Java that I'd like
> to see it work here too.
> 
I'll keep you posted if I find something. If you have a small project 
that reproduce this it would probably help a lot.

> Thanks for all your help,
> 

You're welcome!

Steph


More information about the freebsd-eclipse mailing list