Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Symptoms

When you type the object name of an object that is located at a fixed address in the Watch window in the Visual Studio Debugger, you receive a message that resembles the following:

identifier object_name is undefined

For example, this issue can be reproduced by compiling and running the following code on an x86-based system:

Relocate.asm
      .586
      .MODEL FLAT
      PUBLIC _fixed_struct
      _fixed_struct = 04000000h
      END

Main.cpp
#include <Windows.h>

#define SHM_ADDRESS 0x04000000
#define SHM_SIZE_BYTES 1024
#define SHM_NAME L"TEST_NAME"

extern "C"
{
   extern struct fixed_struct_type {
      int a;
      int b;
      int c;
   } fixed_struct;
}

void AttachShm()
{
   HANDLE mapfile = CreateFileMapping(
      INVALID_HANDLE_VALUE,  // current file handle (use System page file)
      NULL,                  // default security (not inheritable)
      PAGE_READWRITE,        // read/write permission
      0,                     // size of File (high-order doubleword)
      SHM_SIZE_BYTES,        // size of File (low-order doubleword)
      SHM_NAME);             // name of mapping object

   MapViewOfFileEx(
      mapfile,               // handle to mapping object
      FILE_MAP_ALL_ACCESS,   // read/write permission
      0,                     // address offset (high-order doubleword)
      0,                     // address offset (low-order doubleword)
      SHM_SIZE_BYTES,        // size of common block
      (LPVOID)SHM_ADDRESS);  // suggested starting address
}

int main(int argc, char* argv[])
{
   AttachShm();

   fixed_struct.a = 30;
   
   // Put a breakpoint on the next line, view fixed_struct.a in watch window
   return 0;
}

Cause

In earlier versions of Visual Studio, the debugger used relative addresses instead of absolute addresses for all variables. This caused variables that are located at fixed addresses to not be found in the live ranges for the current stack frame.

Resolution

This fix applies only to Visual Studio 2015 Update 3. If you want to view absolute addresses, you must use Visual Studio 2015 Update 3 or a later version.

The fix is available for download from the Microsoft Download Center:

 Download the fix package now.

Microsoft scanned this file for viruses, using the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to it.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×