CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    May 2002
    Posts
    171

    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?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    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...

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: I can not explain this, can you?

    Quote 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

  4. #4
    Join Date
    Feb 2005
    Location
    "The Capital"
    Posts
    5,306

  5. #5
    Join Date
    May 2002
    Posts
    171

    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.

  6. #6
    Join Date
    Aug 2001
    Location
    Texas
    Posts
    645

    Re: I can not explain this, can you?

    post the project and we can stop guessing on what might be the cause.

  7. #7
    Join Date
    May 2002
    Posts
    171

    Re: I can not explain this, can you?

    not possible, this is a 800MB project.

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    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...

  9. #9
    Join Date
    May 2005
    Location
    United States
    Posts
    263

    Re: I can not explain this, can you?

    Victor,

    Does "a" become the value of "b"? Or just some random value?

    -Greg Dolley

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: I can not explain this, can you?

    Quote 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!

  11. #11
    Join Date
    May 2002
    Posts
    171

    Re: I can not explain this, can you?

    a has no relationship whatsoever with b.

  12. #12
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: I can not explain this, can you?

    Have you tried my suggestions from yesterday?

  13. #13
    Join Date
    Sep 2004
    Posts
    1,361

    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.

  14. #14
    Join Date
    Feb 2005
    Location
    "The Capital"
    Posts
    5,306

    Re: I can not explain this, can you?

    Quote 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.

  15. #15
    Join Date
    May 2005
    Location
    United States
    Posts
    263

    Re: I can not explain this, can you?

    Quote Originally Posted by VictorN
    Why are you asking me?
    Ask OP!
    Oh! Sorry Victor, my mistake.

    Greg Dolley

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured