Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Visual Studio Debugger cannot view objects at fixed addresses


View products that this article applies to.

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:

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;
}

↑ Back to the top


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.

↑ Back to the top


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.

Virus-scan claim

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.

↑ Back to the top


Keywords: kbqfe, kbfix, kbdownload, kbsurveynew, kb

↑ Back to the top

Article Info
Article ID : 4103795
Revision : 15
Created on : 5/7/2018
Published on : 5/25/2018
Exists online : False
Views : 208