gdb <value optimized out>

Radu Benea radub82 at gmail.com
Mon Dec 13 09:56:03 GMT 2010


Milian Wolf has a blog post about building and running kdevplatform/kdevelop 
as a user without root access (as in from your directory)... it uses some 
scripts and other stuff to modify multiple kde related environment variables... 
Make sure to modify the variables in the script to be the ones you wish to use 
and not to accidentally overwrite anything...
take a look at http://milianw.de/blog/building-kdevplatform-kdevelop-and-the-
php-plugin-from-svn ... the article changed quite a bit since I used it but I 
trust it to be the same quality as it was back than, Milian is quite good at 
this stuff. Obviously you'll have to ignore the aptitude related stuff on gentoo 
since emerging already gives you the equivalent of -dev packages.

I use those as I have kdevelop/kdevplatform built from source on my machine, 
should work just as well with your project since it's also a kde project. I 
had to make some changes to the .bashrc config though (I don't know if they are 
gentoo specific or not) - I'll attach my version.

Also note that gentoo does not read ~/.bashrc by default so I added the 
following line to my ~/.bash_profile:
[[ -f ~/.bashrc ]] && . ~/.bashrc

Let me know if that helps.
Best wishes

On Monday, December 13, 2010 10:56:26 G VM wrote:
> I tried using LD_LIBRARY_PATH. However it was not yet set.
> It failed in using the compiled library.
> 
> I also tried using /etc/ld.so.conf and ldconfig. Which did not work. I
> uninstalled the installed krdc package. Do note that this is a plugin for
> this project. So ldd krdc does not show that the library is not found. I
> am going to check if I can select the plugin through the gui.
> 
> Gonna take a further look at this.
> 
> Thanks already for your help!
> 
> > From: radub82 at gmail.com
> > To: kdevelop at kdevelop.org
> > Subject: Re: gdb <value optimized out>
> > Date: Mon, 13 Dec 2010 03:05:42 +0200
> > 
> > On Monday, December 13, 2010 02:25:39 G VM wrote:
> > > I just tried compiling using the CMAKE_CXX_FLAGS_DEBUG -ggdb -O0.
> > > However I still get <value optimized out>.
> > > 
> > > I want to debug the krdc project.
> > > 
> > > CMAKE_BUILD_TYPE is set to Debug ;) (I selected it when importing the
> > > sources).
> > > 
> > > This is really frustrating :S
> > > 
> > > As an off topic question: I compiled modified source files to .so files
> > > and I want those to be used when I execute the main executable. Now
> > > the installed ones are used :S
> > 
> > I don't know if there's a better way for it or not, I have
> > $LD_LIBRARY_PATH set to the directories of the libraries I wanna use in
> > my environment. This is kinda set up upon me logging in.
> > 
> > I guess you could set it on the run command to be different for each
> > project... Hope I made it clear and simple.
> > 
> > > Thanks for your answers though! I appreciate your efforts!
> > > 
> > > > From: radub82 at gmail.com
> > > > To: kdevelop at kdevelop.org
> > > > Subject: Re: gdb <value optimized out>
> > > > Date: Mon, 13 Dec 2010 02:17:13 +0200
> > > > 
> > > > Oh and you could try another way. If you right click your project and
> > > > select configuration, under CMake you can find CMAKE_BUILD_TYPE.
> > > > you can change between Release and Debug or RelWithDebugInfo there.
> > > > 
> > > > On Monday, December 13, 2010 02:05:41 G VM wrote:
> > > > > I got a step further.
> > > > > It seems that both -g3 -O0 and -g -O2 are in the c++ compilation
> > > > > lines (make -n). So the second take priority over the first.
> > > > > 
> > > > > However I still can't understand were those -g and -O2 are
> > > > > configured. The CMAKE_CXX_FLAGS_DEBUG and CMAKE_CXX_FLAGS don't
> > > > > have these.
> > > > > 
> > > > > If I do a grep for -O2 and remove those, and then do make all works
> > > > > as it should.
> > > > > 
> > > > > touch rdp/rdpview.cpp
> > > > > cd build
> > > > > make -p | grep rdpview
> > > > > 
> > > > >    1.
> > > > >    
> > > > >       rdp/CMakeFiles/krdc_rdpplugin.dir/rdpview.o:
> > > > >       ../rdp/rdpview.cpp
> > > > > 
> > > > > ../core/hostpreferences.h ../core/remoteview.h
> > > > > ../rdp/rdphostpreferences.h ../rdp/rdpview.cpp ../rdp/rdpview.h
> > > > > /usr/include/KDE/../kdialog.h /usr/include/KDE/../kinputdialog.h
> > > > > /usr/include/KDE/../kmessagebox.h
> > > > > /usr/include/KDE/../kpassworddialog.h /usr/include/KDE/../kshell.h
> > > > > /usr/include/KDE/../kurl.h /usr/include/KDE/KDialog
> > > > > /usr/include/KDE/KInputDialog /usr/include/KDE/KMessageBox
> > > > > /usr/include/KDE/KPasswordDialog /usr/include/KDE/KShell
> > > > > /usr/include/KDE/KUrl /usr/include/KDE/KWallet/../../kwallet.h
> > > > > /usr/include/KDE/KWallet/Wallet
> > > > > /usr/include/qt4/Gentoo/gentoo-qconfig.h
> > > > > /usr/include/qt4/Qt3Support/q3cstring.h
> > > > > /usr/include/qt4/Qt3Support/q3valuelist.h
> > > > > /usr/include/qt4/QtCore/QEvent /usr/include/qt4/QtCore/QFlags
> > > > > /usr/include/qt4/QtCore/QMap
> > > > > /usr/include/qt4/QtCore/QObject /usr/include/qt4/QtCore/QPoint
> > > > > /usr/include/qt4/QtCore/QPointF /usr/include/qt4/QtCore/QProcess
> > > > > /usr/include/qt4/QtCore/QSize /usr/include/qt4/QtCore/QStringList
> > > > > /usr/include/qt4/QtCore/QUrl /usr/include/qt4/QtCore/QVariant
> > > > > /usr/include/qt4/QtCore/qabstractitemmodel.h
> > > > > /usr/include/qt4/QtCore/qalgorithms.h
> > > > > /usr/include/qt4/QtCore/qatomic.h
> > > > > /usr/include/qt4/QtCore/qatomic_alpha.h
> > > > > /usr/include/qt4/QtCore/qatomic_arch.h
> > > > > /usr/include/qt4/QtCore/qatomic_arm.h
> > > > > /usr/include/qt4/QtCore/qatomic_armv6.h
> > > > > /usr/include/qt4/QtCore/qatomic_avr32.h
> > > > > /usr/include/qt4/QtCore/qatomic_bfin.h
> > > > > /usr/include/qt4/QtCore/qatomic_bootstrap.h
> > > > > /usr/include/qt4/QtCore/qatomic_generic.h
> > > > > /usr/include/qt4/QtCore/qatomic_i386.h
> > > > > /usr/include/qt4/QtCore/qatomic_ia64.h
> > > > > /usr/include/qt4/QtCore/qatomic_macosx.h
> > > > > /usr/include/qt4/QtCore/qatomic_mips.h
> > > > > /usr/include/qt4/QtCore/qatomic_parisc.h
> > > > > /usr/include/qt4/QtCore/qatomic_powerpc.h
> > > > > /usr/include/qt4/QtCore/qatomic_s390.h
> > > > > /usr/include/qt4/QtCore/qatomic_sh.h
> > > > > /usr/include/qt4/QtCore/qatomic_sh4a.h
> > > > > /usr/include/qt4/QtCore/qatomic_sparc.h
> > > > > /usr/include/qt4/QtCore/qatomic_symbian.h
> > > > > /usr/include/qt4/QtCore/qatomic_vxworks.h
> > > > > /usr/include/qt4/QtCore/qatomic_x86_64.h
> > > > > /usr/include/qt4/QtCore/qbasicatomic.h
> > > > > /usr/include/qt4/QtCore/qbuffer.h
> > > > > /usr/include/qt4/QtCore/qbytearray.h
> > > > > /usr/include/qt4/QtCore/qchar.h /usr/include/qt4/QtCore/qconfig.h
> > > > > /usr/include/qt4/QtCore/qcoreapplication.h
> > > > > /usr/include/qt4/QtCore/qcoreevent.h
> > > > > /usr/include/qt4/QtCore/qdatastream.h
> > > > > /usr/include/qt4/QtCore/qeventloop.h
> > > > > /usr/include/qt4/QtCore/qfeatures.h
> > > > > /usr/include/qt4/QtCore/qglobal.h /usr/include/qt4/QtCore/qhash.h
> > > > > /usr/include/qt4/QtCore/qiodevice.h
> > > > > /usr/include/qt4/QtCore/qiterator.h
> > > > > /usr/include/qt4/QtCore/qline.h
> > > > > /usr/include/qt4/QtCore/qlinkedlist.h
> > > > > /usr/include/qt4/QtCore/qlist.h /usr/include/qt4/QtCore/qlocale.h
> > > > > /usr/include/qt4/QtCore/qmap.h /usr/include/qt4/QtCore/qmargins.h
> > > > > /usr/include/qt4/QtCore/qmetatype.h
> > > > > /usr/include/qt4/QtCore/qmimedata.h
> > > > > /usr/include/qt4/QtCore/qnamespace.h
> > > > > /usr/include/qt4/QtCore/qobject.h
> > > > > /usr/include/qt4/QtCore/qobjectdefs.h
> > > > > /usr/include/qt4/QtCore/qpair.h /usr/include/qt4/QtCore/qpoint.h
> > > > > /usr/include/qt4/QtCore/qpointer.h
> > > > > /usr/include/qt4/QtCore/qprocess.h /usr/include/qt4/QtCore/qrect.h
> > > > > /usr/include/qt4/QtCore/qregexp.h
> > > > > /usr/include/qt4/QtCore/qscopedpointer.h
> > > > > /usr/include/qt4/QtCore/qset.h
> > > > > /usr/include/qt4/QtCore/qshareddata.h
> > > > > /usr/include/qt4/QtCore/qsharedpointer.h
> > > > > /usr/include/qt4/QtCore/qsharedpointer_impl.h
> > > > > /usr/include/qt4/QtCore/qsize.h /usr/include/qt4/QtCore/qstring.h
> > > > > /usr/include/qt4/QtCore/qstringbuilder.h
> > > > > /usr/include/qt4/QtCore/qstringlist.h
> > > > > /usr/include/qt4/QtCore/qstringmatcher.h
> > > > > /usr/include/qt4/QtCore/qurl.h /usr/include/qt4/QtCore/qvariant.h
> > > > > /usr/include/qt4/QtCore/qvector.h /usr/include/qt4/QtGui/QAction
> > > > > /usr/include/qt4/QtGui/QApplication
> > > > > /usr/include/qt4/QtGui/QButtonGroup
> > > > > /usr/include/qt4/QtGui/QCheckBox /usr/include/qt4/QtGui/QDialog
> > > > > /usr/include/qt4/QtGui/QFormLayout
> > > > > /usr/include/qt4/QtGui/QGroupBox
> > > > > /usr/include/qt4/QtGui/QHBoxLayout
> > > > > /usr/include/qt4/QtGui/QHeaderView /usr/include/qt4/QtGui/QLabel
> > > > > /usr/include/qt4/QtGui/QLayout /usr/include/qt4/QtGui/QMessageBox
> > > > > /usr/include/qt4/QtGui/QSpacerItem /usr/include/qt4/QtGui/QSpinBox
> > > > > /usr/include/qt4/QtGui/QVBoxLayout /usr/include/qt4/QtGui/QWidget
> > > > > /usr/include/qt4/QtGui/QX11EmbedContainer
> > > > > /usr/include/qt4/QtGui/qabstractbutton.h
> > > > > /usr/include/qt4/QtGui/qabstractitemdelegate.h
> > > > > /usr/include/qt4/QtGui/qabstractitemview.h
> > > > > /usr/include/qt4/QtGui/qabstractscrollarea.h
> > > > > /usr/include/qt4/QtGui/qabstractslider.h
> > > > > /usr/include/qt4/QtGui/qabstractspinbox.h
> > > > > /usr/include/qt4/QtGui/qaction.h
> > > > > /usr/include/qt4/QtGui/qactiongroup.h
> > > > > /usr/include/qt4/QtGui/qapplication.h
> > > > > /usr/include/qt4/QtGui/qboxlayout.h /usr/include/qt4/QtGui/qbrush.h
> > > > > /usr/include/qt4/QtGui/qbuttongroup.h
> > > > > /usr/include/qt4/QtGui/qcheckbox.h /usr/include/qt4/QtGui/qcolor.h
> > > > > /usr/include/qt4/QtGui/qcursor.h
> > > > > /usr/include/qt4/QtGui/qdesktopwidget.h
> > > > > /usr/include/qt4/QtGui/qdialog.h /usr/include/qt4/QtGui/qdrag.h
> > > > > /usr/include/qt4/QtGui/qevent.h /usr/include/qt4/QtGui/qfont.h
> > > > > /usr/include/qt4/QtGui/qfontinfo.h
> > > > > /usr/include/qt4/QtGui/qfontmetrics.h
> > > > > /usr/include/qt4/QtGui/qformlayout.h
> > > > > /usr/include/qt4/QtGui/qframe.h
> > > > > /usr/include/qt4/QtGui/qgridlayout.h
> > > > > /usr/include/qt4/QtGui/qgroupbox.h
> > > > > /usr/include/qt4/QtGui/qheaderview.h /usr/include/qt4/QtGui/qicon.h
> > > > > /usr/include/qt4/QtGui/qimage.h
> > > > > /usr/include/qt4/QtGui/qitemselectionmodel.h
> > > > > /usr/include/qt4/QtGui/qkeysequence.h
> > > > > /usr/include/qt4/QtGui/qlabel.h /usr/include/qt4/QtGui/qlayout.h
> > > > > /usr/include/qt4/QtGui/qlayoutitem.h
> > > > > /usr/include/qt4/QtGui/qmacdefines_mac.h
> > > > > /usr/include/qt4/QtGui/qmatrix.h
> > > > > /usr/include/qt4/QtGui/qmessagebox.h
> > > > > /usr/include/qt4/QtGui/qmime.h
> > > > > /usr/include/qt4/QtGui/qpaintdevice.h
> > > > > /usr/include/qt4/QtGui/qpainterpath.h
> > > > > /usr/include/qt4/QtGui/qpalette.h /usr/include/qt4/QtGui/qpixmap.h
> > > > > /usr/include/qt4/QtGui/qpolygon.h /usr/include/qt4/QtGui/qregion.h
> > > > > /usr/include/qt4/QtGui/qrgb.h /usr/include/qt4/QtGui/qrubberband.h
> > > > > /usr/include/qt4/QtGui/qsizepolicy.h
> > > > > /usr/include/qt4/QtGui/qslider.h /usr/include/qt4/QtGui/qspinbox.h
> > > > > /usr/include/qt4/QtGui/qstyle.h
> > > > > /usr/include/qt4/QtGui/qstyleoption.h
> > > > > /usr/include/qt4/QtGui/qtabbar.h
> > > > > /usr/include/qt4/QtGui/qtabwidget.h
> > > > > /usr/include/qt4/QtGui/qtransform.h
> > > > > /usr/include/qt4/QtGui/qtransportauth_qws.h
> > > > > /usr/include/qt4/QtGui/qvalidator.h
> > > > > /usr/include/qt4/QtGui/qwidget.h
> > > > > /usr/include/qt4/QtGui/qwindowdefs.h
> > > > > /usr/include/qt4/QtGui/qwindowdefs_win.h
> > > > > /usr/include/qt4/QtGui/qwmatrix.h
> > > > > /usr/include/qt4/QtGui/qx11embed_x11.h
> > > > > /usr/include/qt4/QtXml/QDomDocument /usr/include/qt4/QtXml/qdom.h
> > > > > core/settings.h rdp/../../rdp/rdpview.h rdp/rdpview.moc
> > > > > rdp/ui_rdppreferences.h
> > > > > rdp/CMakeFiles/krdc_rdpplugin.dir/flags.make 2.
> > > > > 
> > > > >       #  Implicit rule search has not been done.
> > > > >    
> > > > >    3.
> > > > >    
> > > > >       #  Modification time never checked.
> > > > >    
> > > > >    4.
> > > > >    
> > > > >       #  File has not been updated.
> > > > >    
> > > > >    5.
> > > > >    
> > > > >       #  commands to execute (from
> > > > > 
> > > > > `rdp/CMakeFiles/krdc_rdpplugin.dir/build.make', line 126): 6.
> > > > > 
> > > > >               $(CMAKE_COMMAND) -E cmake_progress_report
> > > > > 
> > > > > /home/xxx/kdenetwork-4.4.5/krdc/build/CMakeFiles
> > > > > $(CMAKE_PROGRESS_4) 7.
> > > > > 
> > > > >               @$(CMAKE_COMMAND) -E cmake_echo_color
> > > > >               --switch=$(COLOR)
> > > > > 
> > > > > --green "Building CXX object
> > > > > rdp/CMakeFiles/krdc_rdpplugin.dir/rdpview.o" 8.
> > > > > 
> > > > >               cd /home/xxx/kdenetwork-4.4.5/krdc/build/rdp &&
> > > > >               /usr/bin/c++
> > > > >  
> > > > >  $(CXX_DEFINES) $(CXX_FLAGS) -o
> > > > >  CMakeFiles/krdc_rdpplugin.dir/rdpview.o -c
> > > > > 
> > > > > /home/xxx/kdenetwork-4.4.5/krdc/rdp/rdpview.cpp
> > > > > 
> > > > > 
> > > > > Vi rdp/CMakeFiles/krdc_rdpplugin.dir/flags.make
> > > > > # CMAKE generated file: DO NOT EDIT!
> > > > > # Generated by "Unix Makefiles" Generator, CMake Version 2.8
> > > > > 
> > > > > # compile CXX with /usr/bin/c++
> > > > > CXX_FLAGS =  -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef
> > > > > -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith
> > > > > -Wformat-security
> > > > > -fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new -fno-common
> > > > > -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden
> > > > > -fvisibility-inlines-hidden -g -O2 -fno-reorder-blocks
> > > > > -fno-schedule-insns -fno-inline -fPIC
> > > > > -I/home/xxx/kdenetwork-4.4.5/krdc/build/rdp
> > > > > -I/home/xxx/kdenetwork-4.4.5/krdc/rdp
> > > > > -I/home/xxx/kdenetwork-4.4.5/krdc
> > > > > -I/home/xxx/kdenetwork-4.4.5/krdc/build
> > > > > -I/home/xxx/kdenetwork-4.4.5/krdc/core
> > > > > -I/home/xxx/kdenetwork-4.4.5/krdc/build/core -I/usr/include/KDE
> > > > > -I/usr/include/qt4/QtXmlPatterns -I/usr/include/qt4/QtXml
> > > > > -I/usr/include/qt4/QtWebKit -I/usr/include/qt4/QtUiTools
> > > > > -I/usr/include/qt4/QtTest -I/usr/include/qt4/QtSvg
> > > > > -I/usr/include/qt4/QtSql -I/usr/include/qt4/QtScriptTools
> > > > > -I/usr/include/qt4/QtScript -I/usr/include/qt4/QtOpenGL
> > > > > -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtHelp
> > > > > -I/usr/include/qt4/QtDesigner -I/usr/include/qt4/QtDBus
> > > > > -I/usr/include/qt4/QtAssistant -I/usr/include/qt4/Qt3Support
> > > > > -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore
> > > > > -I/usr/include/qt4/Qt -I/usr/share/qt4/mkspecs/default
> > > > > -I/usr/include/qt4   -D_GNU_SOURCE -D_LARGEFILE64_SOURCE
> > > > > 
> > > > > CXX_DEFINES = -DMAKE_KRDC_RDPPLUGIN_LIB -D_BSD_SOURCE
> > > > > -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -DQT_NO_STL -DQT_NO_CAST_TO_ASCII
> > > > > -D_REENTRANT
> > > > > -DKDE_DEPRECATED_WARNINGS -DKDE_DEFAULT_DEBUG_AREA=5012
> > > > > 
> > > > > So here it is already set.
> > > > > 
> > > > > Hopefuly this helps finding the cause.
> > > > > 
> > > > > From: drums_gvm at hotmail.com
> > > > > To: kdevelop at kdevelop.org
> > > > > Subject: gdb <value optimized out>
> > > > > Date: Sat, 11 Dec 2010 16:59:27 +0100
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Hi all,
> > > > > 
> > > > > I have been searching for a solution for my problem but
> > > > > unfortunately I didn't find a solution.
> > > > > 
> > > > > Problem:
> > > > > When I start my compiled program with gdb and want to print the
> > > > > value of an integer (probably other data types as well) I get the
> > > > > message <value optimized out>. I am a gentoo user so I am aware
> > > > > that -O exists. So I went searching in KDevelop on how to
> > > > > configure this.
> > > > > 
> > > > > I changed some flags in the "Open Options", "Advanced settings" to
> > > > > use -O0.
> > > > > 
> > > > > CMAKE_CXX_FLAGS
> > > > > 
> > > > > CMAKE_CXX_FLAGS_DEBUG
> > > > > 
> > > > > CMAKE_C_FLAGS
> > > > > 
> > > > > CMAKE_C_FLAGS_DEBUG
> > > > > ...
> > > > > 
> > > > > And on the kdevelop forum I found a thread which mentioned using
> > > > > -g3 as well. I did this, cleaned and recompiled the program. But
> > > > > still I have the same result.
> > > > > 
> > > > > I really have no clue anymore what I am doing wrong.
> > > > > Anyone has an idea about this?
> > > > > 
> > > > > I use:
> > > > > 
> > > > > 
> > > > > Version 4.0.2 (using KDevPlatform 1.0.2)
> > > > > Using KDE Development Platform 4.4.5 (KDE 4.4.5)
> > > > > Program I want to compile to debug is Krdc.
> > > > > 
> > > > > Thanks in advance for your help!
> > > > > 
> > > > > 
> > > > > _______________________________________________
> > > > > kdevelop mailing list
> > > > > kdevelop at kdevelop.org
> > > > > https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop
> > > > 
> > > > _______________________________________________
> > > > kdevelop mailing list
> > > > kdevelop at kdevelop.org
> > > > https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop
> > 
> > _______________________________________________
> > kdevelop mailing list
> > kdevelop at kdevelop.org
> > https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .bashrc
Type: text/x-matlab
Size: 8225 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20101213/2ef2e63f/attachment.bin>


More information about the KDevelop mailing list