This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using Memory Window in Debugger...

I'm trying to debug a problem where the value of a pointer is being changed when I don't expect it to. I was having trouble getting the debugger to display the value of the pointer in files other than where it was declared, even after I made it a global variable (just to debug the problem). I kept getting a message that it was out of scope.

So... I tried a different approach, and that's what this question's about.

I looked in the map file and saw that the value of this pointer was 0x002000A8, the class was DATA, and the type was '---' (whatever that means). I then started the debugger and entered the value of 0x002000A8 into the Address field of the Memory #1 window. When the code stopped on the breakpoint on the line where I assigned a value to that pointer, the data at the associated memory location did not change. However, the same variable displayed in a watch window did change, and to what I expected.

Is there some trick to getting the memory window to update, to show that the data at that location has indeed changed? Or, am I not understanding how to read the map file and use the memory window to show changing data in RAM?

HELP... (thanks).


  • I looked in the map file and saw that the value of this pointer was 0x002000A8...


    Actually, the address of the pointer is 0x002000A8, not the *value* of the pointer.

    Am I correct in thinking that I should be able to see RAM location 0x002000A8 change in a memory window when I assign a value to the pointer as shown below?

    char *ptr; // map file shows this var @ 0x002000A8
    const char string[] = "testing 123";
    ...
    ptr = string;
    

  • I did see a reference in the help file to enabling the memory window to be updated periodically via the 'View - Periodic Window Update' menuitem, but that menuitem appears to be permanently disabled. I can't find any way to enable that menuitem.

  • Okay, now I'm really confuzed !!

    I decided to add one more thing to the watch window, the address of the pointer, as shown below.

    &ptr

    The value that shows up for '&ptr' does not match what's in the map file, however... I can use the 'D' command in the debugger to display the memory at that location, and it appears to be the location in memory that's getting written to when I write to that pointer (as in the previous example posted to this thread)! And... the value in the memory window appears to track these assignments perfectly too.

    So... why does using the debugger to show the address of a pointer not match what's in the map file...?

  • YIKES!

    Too dumb!

    I didn't realize that due to an earlier cut/paste I had inadvertently renamed a param passed to the function to the same name as my global var. After fixing that all is well!

    The learning is that whenever the address of a pointer doesn't match what's in the map file, it's probably due to another var with the same name that due to scope rules is being used instead.

    Sigh... (embarrassed)

  • Is this a record for the longest thread with only a single contributor...? ;-)