This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 197053

Summary: Changed variable value is set to variable with the same name in another frame
Product: cnd Reporter: Egor Ushakov <gorrus>
Component: DebuggerAssignee: Egor Ushakov <gorrus>
Status: VERIFIED FIXED    
Severity: normal CC: apepin, mmirilovic, vv159170
Priority: P1    
Version: 7.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Egor Ushakov 2011-03-24 17:37:13 UTC
Code:
struct A {
    int b;
};

void foo() {
   A a;
   a.b = 17;
   a.b = 18;
}

int main(int argc, char**argv) {
   A a;
   a.b = 1;
   foo();
   return 0;
}

Steps to reproduce:
- step into
- expand a value so that b is visible
- do a step
a.b value will become 1
- do step into foo
a.b value remains 1
- do another step (a.b = 17;)
a.b value still remains 1
Comment 1 Egor Ushakov 2011-03-24 17:40:29 UTC
could be reproduced only if we have structure variables named the same in different frames
Comment 2 Egor Ushakov 2011-03-24 17:48:23 UTC
there is a consequence for simple types:
void foo() {
   int x = 5;
   x++;
   x--;
}

int main(int argc, char**argv) {
   int x = 2;
   foo();
   return 0;
}

here if we change value of x inside foo it will be changed in main
Comment 3 Alexander Pepin 2011-03-25 10:57:20 UTC
This is a showstopper as a debugger breaks the expected way of execution. Does this bug has the same root cause as #196846 ?
Comment 4 Egor Ushakov 2011-03-25 11:12:41 UTC
no, they are different
Comment 5 Egor Ushakov 2011-03-28 09:31:55 UTC
fixed in trunk:
http://hg.netbeans.org/cnd-main/rev/1333130a00c1
Comment 6 Egor Ushakov 2011-03-28 09:32:10 UTC
Vladimir, please review
Comment 7 Vladimir Voskresensky 2011-03-28 09:35:34 UTC
Fix reviewed. If there are no performance penalties, I'm fine with it.
Comment 8 Alexander Pepin 2011-03-28 12:05:32 UTC
verified in dev build #5040
Comment 9 Egor Ushakov 2011-03-28 12:57:48 UTC
integrated into release70:
http://hg.netbeans.org/releases/rev/115b91ffb1a3
Comment 10 Quality Engineering 2011-03-29 08:41:20 UTC
Integrated into 'main-golden', will be available in build *201103290400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/1333130a00c1
User: Egor Ushakov <gorrus@netbeans.org>
Log: fixed #197053 (Changed variable value is set to variable with the same name in another frame)
Comment 11 Alexander Pepin 2011-03-31 13:29:38 UTC
Verified in RC2 build 20110331