CodeLite Debug -- unable to show variables' values.

General questions regarding the usage of CodeLite
jiapei100
CodeLite Expert
Posts: 115
Joined: Wed Dec 30, 2009 8:29 am
Genuine User: Yes
IDE Question: C++
Location: Surrey, BC, Canada
Contact:

Re: CodeLite Debug -- unable to show variables' values.

Post by jiapei100 »

Did you mean I input "print m_iFrames" and send it in the Debug tab?

Yes, I tried. still the same:

Code: Select all

DEBUG>>print m_iFrames
DEBUG>>&"print m_iFrames\n"
DEBUG>>&"No symbol \"m_iFrames\" in current context.\n"
DEBUG>>^error,msg="No symbol \"m_iFrames\" in current context."
^error,msg="No symbol \"m_iFrames\" in current context."

It could be a gdb error I guess because there are loads of such errors "msg="mi_cmd_var_create: unable to create variable object"" by googling.

I tried to register GNU GDB mailing list, but it seems I'm not able to submit questions.

Where else can I drop question for GDB issue?
How about on your computer? Is CodeLite(GDB) able to watch member variables in a class on your computer?


Best Regards
JIA Pei
Welcome to Vision Open
http://www.visionopen.com
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeLite Debug -- unable to show variables' values.

Post by eranif »

jiapei100 wrote:How about on your computer? Is CodeLite(GDB) able to watch member variables in a class on your computer?
Yes it can (depends on the scenario) - but there are cases where it fails to do so, it really depends on the context. You should ask in gdb mailing list, I am not sure why you cant post there...

Did you register to that mailing list?

Eran
Make sure you have read the HOW TO POST thread
jiapei100
CodeLite Expert
Posts: 115
Joined: Wed Dec 30, 2009 8:29 am
Genuine User: Yes
IDE Question: C++
Location: Surrey, BC, Canada
Contact:

Re: CodeLite Debug -- unable to show variables' values.

Post by jiapei100 »

I was wondering if it is a QT compilation environmental setting problem?

Because, for my wxWidget project, I have the following compilation configrations.

Code: Select all

-g;$(shell wx-config --cxxflags --unicode=yes --debug=yes)
However, for QT related project, I only have

Code: Select all

-g
up there.

BTW, I didn't install all packages related to QT3 (except libqt3-mt ).
All what's related to QT4 have been installed (including libqt4-dbg ).


So, do I need to specify "--debug = yes", in order to debug with member variable values able to be displayed ??

Cheers
JIA
Welcome to Vision Open
http://www.visionopen.com
jiapei100
CodeLite Expert
Posts: 115
Joined: Wed Dec 30, 2009 8:29 am
Genuine User: Yes
IDE Question: C++
Location: Surrey, BC, Canada
Contact:

Re: CodeLite Debug -- unable to show variables' values.

Post by jiapei100 »

By the way, is it possible that it's codelite QMake plugin project which built a "non-debug" version of executable binary ?

Because I was using this executable when I GDB it.
It's for sure that GDB won't be able to find the debug information if the executable is not compiled with debug option?

Cheers
JIA
Welcome to Vision Open
http://www.visionopen.com
jiapei100
CodeLite Expert
Posts: 115
Joined: Wed Dec 30, 2009 8:29 am
Genuine User: Yes
IDE Question: C++
Location: Surrey, BC, Canada
Contact:

Re: CodeLite Debug -- unable to show variables' values.

Post by jiapei100 »

Fantastic !!! I found it.
Please, Eran, do help !!

It is just because default QMake plugin project will build a release version of project. The following are the key segment in my .pro file.

Code: Select all

QMAKE_CFLAGS_RELEASE   = -g $(shell --cxxflags --unicode=yes --debug=yes)
QMAKE_CXXFLAGS_RELEASE = -g $(shell --cxxflags --unicode=yes --debug=yes)
DEFINES                = 
QMAKE_LFLAGS_RELEASE   = 
I attached this .pro file as .txt here.

So, it seems there are still quite a lot of limitations for QT Project support in CodeLite.
I think there should be

Code: Select all

QMAKE_CXXFLAGS_DEBUG
defined if I'd love to debug it, right?


Hope all QT projects in CodeLite can be debugable ASAP.

Best Regards
JIA
You do not have the required permissions to view the files attached to this post.
Welcome to Vision Open
http://www.visionopen.com
jiapei100
CodeLite Expert
Posts: 115
Joined: Wed Dec 30, 2009 8:29 am
Genuine User: Yes
IDE Question: C++
Location: Surrey, BC, Canada
Contact:

Re: CodeLite Debug -- unable to show variables' values.

Post by jiapei100 »

Tried again.

In
Project->Settings->QMake , I added the following

Code: Select all

CONFIG -= release
CONFIG += console debug
Still, the same, in .pro file, there is nothing related to "QMAKE_*****_DEBUG", but only "QMAKE_*****_RELEASE"

Code: Select all

QMAKE_CFLAGS_RELEASE   = -g $(shell --cxxflags --unicode=yes --debug=yes)
QMAKE_CXXFLAGS_RELEASE = -g $(shell --cxxflags --unicode=yes --debug=yes)
DEFINES                = 
QMAKE_LFLAGS_RELEASE   = 

It seems no matter how I specify "debug", including
1) Compiler -> Compiler Options

Code: Select all

 -g $(shell --cxxflags --unicode=yes --debug=yes)
2) QMake

Code: Select all

CONFIG -= release
CONFIG += console debug
Nothing can affect those staffs in .pro file.

Is this a drawback of current CodeLite?
Is it possible to make CodeLite clever enough to intelligently define its own variables for RELEASE and DEBUG version respectively?

Urgent. Please do help.

Best Regards
JIA
Welcome to Vision Open
http://www.visionopen.com
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeLite Debug -- unable to show variables' values.

Post by eranif »

jiapei100 wrote:QMAKE_CFLAGS_RELEASE = -g $(shell --cxxflags --unicode=yes --debug=yes)
QMAKE_CXXFLAGS_RELEASE = -g $(shell --cxxflags --unicode=yes --debug=yes)
The lines above, are making no sense. It has NOTHING to do with QT

this has nothing to do CXX**DEBUG**.

The .pro file is just an intermediate phase to generate the makefile. If you get a -g option in the compilation (and you DO have it, according to the output you posted it earlier) you should be able to debug your code. If you can't - it is a gdb problem
jiapei100 wrote:It seems no matter how I specify "debug", including
the $shell command is a Makefile command and it is NOTHING to do with your failure to debug

Code: Select all

----------Build Started--------
C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "QtConsole_wsp.mk""
----------Building project:[ QtConsole - Debug ]----------
mingw32-make.exe[1]: Entering directory `C:/TestArea/QtConsole'
g++ -c -g -Wall -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\Qt\4.5.1\include\QtCore" -I"..\..\Qt\4.5.1\include" -I"." -I"." -I"..\..\Qt\4.5.1\include\ActiveQt" -I"." -I"..\..\Qt\4.5.1\mkspecs\win32-g++" -o Debug\main.o main.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -o Debug\QtConsole.exe Debug/main.o  -L"c:\Qt\4.5.1\lib" -lQtCored4
mingw32-make.exe[1]: Leaving directory `C:/TestArea/QtConsole'
----------Build Ended----------
0 errors, 0 warnings
This is the output of the 'Debug' compilation of the Qt project created by codelite. I can debug it no problems here. The problem is somewhere else.
jiapei100 wrote: Hope all QT projects in CodeLite can be debugable ASAP.
They are, only your cant be debugged (for a reason not related to codelite)

I posted the answer on my first post: the problem is in gdb, not in codelite, but you refuse to accept it.
Please search google for Makefile and learn about it.
Please search google for compilation, compilers, and debugging - and learn about it.

In short: to be able to debug a program, all you need is to have '-g' in the compilation line (and I recommend to NOT having any optimization level) THATS IT.
The Makefile generated by codelite generating a proper makefile for you. The fact that you can debug a local variables, means that the Makefile is OK.

You should post your question in gdb mailing list or try google for the answer, since the problem is not within codelite

Attached is screenshot which shows that members *can* be viewed (the project was created by codeite's qt plugin)
qt-dbg.png
Eran
You do not have the required permissions to view the files attached to this post.
Make sure you have read the HOW TO POST thread
jiapei100
CodeLite Expert
Posts: 115
Joined: Wed Dec 30, 2009 8:29 am
Genuine User: Yes
IDE Question: C++
Location: Surrey, BC, Canada
Contact:

Re: CodeLite Debug -- unable to show variables' values.

Post by jiapei100 »

Hi, Eran:

I got it.
It's not Codelite's fault. Neither of GDB.

I hovered my mouse on the member viable "m_iFrames" directly, which won't be able to tell me the correct value.
I should check the tab "Locals", which will bring me "this.m_iFrames". This shows me the value.

But, will it be better if I hover my mouse on any variables and the value will be shown automatically?

Cheers
JIA
Welcome to Vision Open
http://www.visionopen.com
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeLite Debug -- unable to show variables' values.

Post by eranif »

Still sounds like a gdb bug to me. If you are inside your class scope, gdb should know about m_iFrames even without 'this'

Eran
Make sure you have read the HOW TO POST thread
Post Reply