Jump to content

  • Log In with Google      Sign In   
  • Create Account

Strange VS2012 Debug Problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Endemoniada   Members   -  Reputation: 312

Like
0Likes
Like

Posted 14 July 2014 - 05:32 PM

Hi guys,

 

I don't think this has ever happened before and it's really weird.

 

struct Joint{

char name[32];

int count;

};

 

In my program:

 

Joint* joint=getJoint(...); // i get a good Joint pointer back

if(joint){...

 

Normally when I debug and hover over a struct variable it has a little popup with the member variables. If I hover the variable 'joint' above I now get this:

 

cb=1970235507

ver=1919247468

offszCwd=3435973868

offszCommand=3435973836

ichOutfile=3435973836

offszLibs=3435973836

 

...and when I put it in the watch window it says:

 

joint->count     : class "Joint" has no member 'count'

 

And it doesn't just happen with Joint. I made sure I'm running the debug build, What's going on ?

 

Thanks.

 



Sponsor:

#2 frob   Moderators   -  Reputation: 22736

Like
6Likes
Like

Posted 14 July 2014 - 05:54 PM

Those specific values are useful to memorize. For fun, convert your display to hex. You'll see 3435973836 turn to 0xcccccccc.

That is one of many bit patterns used by the debugging libraries to help you know what happened. That one specifically is uninitialized stack values.

Some common bit patterns in Windows development:

0xCCCCCCCC Uninitialized locals (on the stack)
0xCDCDCDCD Uninitialized (allocated on the heap but not initialized by your program)
0xDDDDDDDD Freed memory (released by delete or free, but remains allocated to the program for debug tracking purposes)
0xBAADFOOD Allocated by heap management functions rather than new or *alloc, uninitialized memory your program owns
0xDEADBEEF Deallocated heap memory your program no longer owns
0xABABABAB and 0xBDBDBDBD Guard memory located outside (before and after) an allocated memory block
0xFDFDFDFD No man's land (normally outside of a process, but also used for certain guard blocks)


So with your value, the debug library is telling you that you never initialized the value. In release mode the value will not be initialized to anything, it will just contain whatever value it had earlier.

If you thought you initialized it with something, you will need to track down inside that code to see why it is returning an uninitialized value instead of a valid (or NULL) pointer.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#3 Pink Horror   Members   -  Reputation: 1230

Like
0Likes
Like

Posted 14 July 2014 - 09:03 PM

Joint* joint=getJoint(...); // i get a good Joint pointer back


How do you know it's a "good" Joint pointer?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS