|
-
September 13th, 2006, 11:06 AM
#1
I can not explain this, can you?
strange behavier during debuging.
class xxx
{
...
private a;
private b;
private function()
{
...
b = false;
...
}
...
}
I searched the whole project for variable a and put a break point at each place. then when I debut and step through the "b=false;", the value of a got changed in the watch window. I mean just before the statement, a is empty and right after the statement a got some value. program never break else where.
can anybody explain?
-
September 13th, 2006, 11:22 AM
#2
Re: I can not explain this, can you?
Sounds like you overrite 'a' from somwhere in your code.
Since you didn't provide enouph information about your class xxx member variables/methods, nor showed your actual code there is impossible to answer you more...
-
September 13th, 2006, 11:23 AM
#3
Re: I can not explain this, can you?
 Originally Posted by tangjun
can anybody explain?
1) You are running a different executable than the one you believe you're debugging (i.e. the source code does not match what you're actually running).
OR
2) You have optimizations turned on. Since optimizations can eliminate or move code around, your source code does not match what the final optimized code would perform.
OR
3) Your code has a serious bug.
Those are three of your possibilities.
Regards,
Paul McKenzie
-
September 13th, 2006, 11:27 AM
#4
Re: I can not explain this, can you?
Add one more to it (since actual code is not provided) :
a is a reference to b.
Can you help me with my homework assignment?, Before you post!, Use code tags, How to post!, Codeguru technical FAQs, C++ FAQ Lite, Stroustrup: C++ Style and Technique FAQ, Guru of the Week, Comeau C and C++ FAQs, Comeau C++ Templates FAQs, CUJ @ DDJ, Spam threshold
My Blogs : Learning C++ is fun | Abnegator's reflections
Open Threads : C++ Aha! Moments | Nature of work in C++?
-
September 13th, 2006, 01:35 PM
#5
Re: I can not explain this, can you?
Paul's point make some sence, I will try explore a little bit, although I don't believe that's the reason.
for all others, I'v pointed out that I searched all my project where a is ever get assigned/modified, and I am sure I covered everything, and those break point never got reached during that call.
BTW, this is c# code.
Last edited by tangjun; September 13th, 2006 at 01:37 PM.
-
September 13th, 2006, 02:49 PM
#6
Re: I can not explain this, can you?
post the project and we can stop guessing on what might be the cause.
-
September 14th, 2006, 09:44 AM
#7
Re: I can not explain this, can you?
not possible, this is a 800MB project.
-
September 14th, 2006, 09:51 AM
#8
Re: I can not explain this, can you?
1. If the option "Rebuild All" exists for the c# - try it.
2. Try to remove parts of the project until this strange behaviour goes away - then try to understand what could cause this...
-
September 14th, 2006, 01:09 PM
#9
Re: I can not explain this, can you?
Victor,
Does "a" become the value of "b"? Or just some random value?
-Greg Dolley
-
September 15th, 2006, 02:34 AM
#10
Re: I can not explain this, can you?
 Originally Posted by greg_dolley
Victor,
Does "a" become the value of "b"? Or just some random value?
-Greg Dolley
Why are you asking me?
Ask OP!
-
September 15th, 2006, 11:16 AM
#11
Re: I can not explain this, can you?
a has no relationship whatsoever with b.
-
September 15th, 2006, 11:19 AM
#12
Re: I can not explain this, can you?
Have you tried my suggestions from yesterday?
-
September 15th, 2006, 11:39 AM
#13
Re: I can not explain this, can you?
It sounds like memory is getting trounced.
Put a breakpoint on the MEMORY for A, not the variable A. Put the condition on the break point, whenever it changes.
Whenever any code, anywhere, alters that memory, the compiler will stop on it and you can see where its all happening.
-
September 15th, 2006, 12:00 PM
#14
Re: I can not explain this, can you?
 Originally Posted by tangjun
a has no relationship whatsoever with b.
Would you mind showing a cut down version of the code that depicts this behaviour? Without that, it no more than you are asking us to blind-guess.
Can you help me with my homework assignment?, Before you post!, Use code tags, How to post!, Codeguru technical FAQs, C++ FAQ Lite, Stroustrup: C++ Style and Technique FAQ, Guru of the Week, Comeau C and C++ FAQs, Comeau C++ Templates FAQs, CUJ @ DDJ, Spam threshold
My Blogs : Learning C++ is fun | Abnegator's reflections
Open Threads : C++ Aha! Moments | Nature of work in C++?
-
September 18th, 2006, 02:55 AM
#15
Re: I can not explain this, can you?
 Originally Posted by VictorN
Why are you asking me?
Ask OP! 
Oh! Sorry Victor, my mistake. 
Greg Dolley
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|