views:

1246

answers:

1

I am using Ubuntu for one of the first times and eclipse's debugger has given me more trouble than I can deal with. For the moment I just want to try to figure out how to get the "Cannot find bounds of current function" to stop so I can see where my flow of control goes awry.

I know this is a vague question, but I'm willing to quickly supply any sort of information necessary. I've been googling info for about 2 hours and switching on and off different things to no avail.

I'm using Version: 3.4.1 (I believe the newest one)

Also, my breakpoints won't always works (probably about a 25% success rate) even when I set them before the build. My cout<< or printf also can't print before the programs blows up. This makes me think it's some sort of concurrent process that is outpacing the debugger, but I have no idea how to fix this.

I would greatly appreciate any help. I'll be around.

+1  A: 

Not an unheard-of problem

I suppose you can confirm that:

  • all the shared libraries are compiled with -g flag (debug) ?
  • and the output application binary file seems to be ok because it runs correctly in command line ?
  • you are not compiling with some framwework (like Qt4) which would require qmake to be run to generate the project file to which you add "CONFIG += qt debug" ?
  • you have no warning of any kind during the build ? (like this "Clock skew detected" message)


The point of all this is:

Somewhere, one of the libs or your own program do not have "debug" information in it.

The -g flag can be set directly in the makefile (and is not particularly dependent of the OS in this instance).

Example (not targeted for Linux)

CXX = g++
CXXFLAGS =  -O2 -Wno-deprecated -g
DEFINES = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DLITTLE_ENDIAN

##########################

COMPILE=$(CXX) $(CXXFLAGS) $(DEFINES)
LINK=$(CXX)

UNRAR_OBJ=filestr.o recvol.o rs.o scantree.o

OBJECTS=rar.o strlist.o strfn.o pathfn.o

.cpp.o:
    $(COMPILE) -D$(WHAT) -c -g $<

all:    unrar

clean:
    @rm -f *.o *.bak *~

unrar:    WHAT=UNRAR
unrar:    $(OBJECTS) $(UNRAR_OBJ)
    @rm -f makeunrar
    $(LINK) -Wl,-s -g -o unrar $(LDFLAGS) $(OBJECTS)
$(UNRAR_OBJ) $(LIBS)   

sfx:    WHAT=SFX_MODULE
sfx:    $(OBJECTS)
    @rm -f default.sfx
    $(LINK) -Wl,-s -g -o default.sfx $(LDFLAGS)
$(OBJECTS) -DSFX_MODULE

g++ -O2 -Wno-deprecated -g  -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -DLITTLE_ENDIAN -DUNRAR -c -g
rar.cpp
[...]
g++ -Wl,-s -g -o unrar  rar.o strlist.o ...

Here, that makefile contains a huge trap:

g++ -Wl,-s -o unrar  rar.o strlist.o ...

-s stands for "strip" meaning all the debug informations generated before are lost in the final output. So do check also your link options.

VonC
I'm pretty ignorant when it comes to linux so bear with me (never had anyone explain something to me in person).-g flag - I've definitely heard of it, but I looked everywhere in my directories/properties and could find it.
Chad
Maybe gdb is a subsitute? No warnings on build. I don't think I'm compiling with some special framework. I believe I'm using gcc (I downloaded it from the package explorer. I tried following some instruction like these:
Chad
http://www.scribd.com/doc/3243248/eclipse-debugThey looked more familiar but as for a server I don't really have one and I don't think I need to set it up (right?). I did everything else the document said and nothing changed (except having to fix the server errors)
Chad