Author Topic: Local Variables does not show all variables when I step into a function  (Read 6115 times)

Offline const451

  • Multiple posting newcomer
  • *
  • Posts: 37
Hi All,

While debugging, Local Variables window does not show all variables when I step into a function. e.g. in the code below it will only show variable "status", that's it, but I want to see s and m_sock.

1) How do I set debugger to show all variables that are in the scope of the function I am stepping into?

2) How can I hover over the variable and see its value?

bool Socket::send ( const std::string s ) const
{
    int status = ::send ( m_sock, s.c_str(), s.size(), MSG_NOSIGNAL );
    if ( status == -1 )
    {
        return false;
    }
    else
    {
        return true;
    }
}


THX!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Hm, you're missing the definition of local variables....

s is a function argument, not a local var
m_sock is member of the class, not a local var again...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline const451

  • Multiple posting newcomer
  • *
  • Posts: 37
I am not missing anything, my function is fully legitimate. It's true that those are not local variables, however my questions are:

1) How do I set up Codeblocks to show all variables that are in the scope (not only local variables) of the function I am stepping into?

2) How can I hover over the variable and see its value?

« Last Edit: June 10, 2011, 05:56:49 pm by const451 »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
1. You can't, as far as I know, GDB doesn't support such feature.
2. See the debugger settings for the second question. The option is called 'Evaluate expression under cursor'
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ouch

  • Almost regular
  • **
  • Posts: 223
keep in mind you can add any variables to the watch list and see them whether they are in scope or not.

Offline const451

  • Multiple posting newcomer
  • *
  • Posts: 37
1. You can't, as far as I know, GDB doesn't support such feature.
2. See the debugger settings for the second question. The option is called 'Evaluate expression under cursor'



2) Works - Thank you!

Concerning 1): since #2 works - I can hover over any variable, including local, global, and class members and I can see the value while I am inside a function, then such feature is supported by gdb. It's just a matter of Codeblocks having a window to display the values of all those variables.

I think I'll post another thread.