Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: idhan on March 29, 2009, 08:46:44 pm

Title: problem watching variables in debug mode
Post by: idhan on March 29, 2009, 08:46:44 pm
Hi,

I have some problems to watch the value of variables in debug mode, I only can see globlal variables values,
but if a variable has been declare inside of a method or function, I always get:

Not simbol "myvariable" in the current context

Any idea why?

[Edit] Kubunt 8.10 - Codeblocks 8.02 - gcc (Ubuntu 4.3.2-1ubuntu12) 4.3.2
Title: Re: problem watching variables in debug mode
Post by: ollydbg on March 30, 2009, 05:11:51 am
A simple test case is need. If you want further help. :D
Title: Re: problem watching variables in debug mode
Post by: idhan on March 30, 2009, 04:23:51 pm
Here is an example, I want to see the value of the variable sStringHandle declare at the beginning and watch it trought the process.

Code
        Ogre::String sStringHandle; <----------- BREAK POINT

        #ifdef _WINDOW
sStringHandle = Ogre::StringConverter::toString((unsigned long)mpOgreCanvas->GetHandle())
#elif defined(__WXGTK__)
// TODO: Someone test this. you might to use "parentWindowHandle" if this
// does not work.  Ogre 1.2 + Linux + GLX platform wants a string of the
// format display:screen:window, which has variable types ulong:uint:ulong.
GtkWidget* widget = (GtkWidget*)mpOgreCanvas->wxWindow::GetHandle();
gtk_widget_realize( widget ); // Mandatory. Otherwise, a segfault happens.
std::stringstream handleStream;
Display* display = GDK_WINDOW_XDISPLAY( widget->window );
Window wid = GDK_WINDOW_XWINDOW( widget->window ); // Window is a typedef for XID, which is a typedef for unsigned int
/* Get the right display (DisplayString() returns ":display.screen") */
std::string displayStr = DisplayString( display );
displayStr = displayStr.substr( 1, ( displayStr.find( ".", 0 ) - 1 ) );
/* Put all together */
handleStream << displayStr << ':' << DefaultScreen( display ) << ':' << wid;
sStringHandle = handleStream.str();   <----------- AFTER THIS LINE I SHOULD  SEE THE VALUE
#else
#error Not supported on this platform.

        #endif

        Ogre::NameValuePairList tdParams;
        tdParams["externalWindowHandle"] = sStringHandle;

I am in linux so the GTK part is running. The break point is at the sStringHandle's declaration and I debug trough each line but I always get: "Not simbol "sStringHandle" in the current context". I use namespaces in my project, should that be a problem??, here is the configuration for my cbp codeblocks project.

Code
<Build>
<Target title="Debug">
<Option platforms="Unix;" />
<Option output="VisualApp" prefix_auto="1" extension_auto="1" />
<Option object_output="Debug" />
<Option type="0" />
<Option compiler="gcc" />
<Option projectLinkerOptionsRelation="2" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add option="`wx-config --cflags --debug=yes`" />
<Add option="`pkg-config OGRE --cflags`" />
<Add option="-Wno-deprecated" />
<Add option="-I ./Include" />
<Add option="-I ./Source" />
<Add option="-I /usr/include/gtk-2.0" />
<Add option="-I /usr/include/glib-2.0" />
<Add option="-I /usr/include/pango-1.0" />
<Add option="-I /usr/lib/glib-2.0/include" />
<Add option="-I /usr/lib/gtk-2.0/include" />
<Add option="-I /usr/include/atk-1.0/" />
<Add option="-I /usr/include/cairo/" />
<Add option="-D_DEBUG" />
</Compiler>
<Linker>
<Add option="`wx-config --libs`" />
<Add option="`pkg-config OGRE --libs`" />
<Add library="/usr/lib/libGL.so" />
</Linker>
</Target>
<Target title="Release">
<Option output="VisualApp" prefix_auto="1" extension_auto="1" />
<Option object_output="Release" />
<Option type="0" />
<Option compiler="gcc" />
</Target>
</Build>
Title: Re: problem watching variables in debug mode
Post by: idhan on March 31, 2009, 01:43:57 pm
I have found a strange behavior using ogre and codeblocks in debug mode... the following pictures shows two examples of this issue:

(http://g.imagehost.org/0038/snapshot2.png) (http://g.imagehost.org/view/0038/snapshot2)
(http://g.imagehost.org/0583/snapshot1.png) (http://g.imagehost.org/view/0583/snapshot1)

I have test wxWidgets and I don't have the problem, after I combine Ogre with wxWidgets the issue appears. The wrong information display concerns the ogre-log system. I don't know if this is the problem why i cann't see any local variables correctly. I'm moving my project now to Netbeans for more testing.

Thanks for any advice in this matter...