Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging: Locals not updating when stepping through code #1301

Closed
lkamp opened this issue May 30, 2016 · 2 comments
Closed

Debugging: Locals not updating when stepping through code #1301

lkamp opened this issue May 30, 2016 · 2 comments

Comments

@lkamp
Copy link

lkamp commented May 30, 2016

I use CodeLite to compile the C++ code below. When debugging and stepping through the code line by line, the values in the "Locals" view do not change. When examining variables in the "Watches" view they are updated after every executed line.

I compiled the code with both clang++ and g++ with no effect. I use gdb as a debugger.

Used versions:

  • clang++ 3.5.0
  • g++ 4.8.4
  • gdb 7.7.1
  • CodeLite 9.1.5
class testclass {
public:
    int a;
    int b;
    int c;

    testclass();
    int foo(int a);
    int bar(int a);

private:
    int pa;
    int pb;
    int pc;
};

testclass::testclass()
{
    a = 0;
    b = 0;
    c = 0;
    pa = 0;
    pb = 0;
    pc = 0;
}

int testclass::foo(int a)
{
    pa = a;
    pc = pa + pb;

    return a;
}

int testclass::bar(int a)
{
    pb = a;
    pc = pa + pb;

    return a;
}

int main(void)
{
    testclass t;

    t.foo(1);
    t.bar(2);

    return 0;
}
@eranif
Copy link
Owner

eranif commented Jun 21, 2016

For clarification: the local variables are being updated.
The ones that are not being updated are the class members (pa, pb, pc)

If you will change testclass::foo to:

int testclass::foo(int a)
{
    int aa, bb, cc;
    aa = 0;
    bb = 0;
    cc = 0;

    ++aa;
    ++bb;
    ++cc;

    pb = a;
    pc = pa + pb;

    return a;
}

You will notice that aa bb and cc and being updated

(CodeLite issues the command: -stack-list-variables 2 to gdb to get their new value, and apparently, it does not include the class members...

@AJenbo AJenbo added the C++ label May 31, 2017
@stale
Copy link

stale bot commented Sep 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 29, 2019
@stale stale bot closed this as completed Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants