gdb <value optimized out>

G VM drums_gvm at hotmail.com
Mon Dec 13 00:05:41 GMT 2010


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 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20101213/1d7e31a7/attachment.html>


More information about the KDevelop mailing list