증상
Visual Studio 디버거의 조사식 창에서 고정 된 주소에 있는 개체의 개체 이름을 입력할 때 다음과 유사한 메시지가 나타납니다.
object_name 식별자 정의 되어 있지 않습니다.
예를 들어, 컴파일 및 x86 기반 시스템에서 다음 코드를 실행 하 여이 문제를 재현할 수 있습니다.
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;
}
원인
이전 버전의 Visual Studio에서는 디버거에서 모든 변수에 대 한 절대 주소 대신 상대 주소를 사용합니다. 이것 때문에 고정된 주소를 현재 스택 프레임에 대 한 라이브 범위에서 찾을 수 있는 변수입니다.
해결 방법
이 수정 프로그램이 Visual Studio 2015 업데이트 3에만 적용 됩니다. 절대 주소를 확인 하려면 Visual Studio 2015 업데이트 3 또는 이후 버전을 사용 해야 합니다.
이 수정 프로그램은 Microsoft 다운로드 센터에서 다운로드할 수 있습니다.
Microsoft는 파일이 게시된 날짜에 사용할 수 있었던 최신 바이러스 검색 소프트웨어를 사용하여 이 파일에서 바이러스를 스캔했습니다. 파일은 무단으로 변경할 수 없도록 보안이 강화된 서버에 저장됩니다.