다음을 통해 공유


IDebugHostSymbols::CreateTypeSignature 메서드(dbgmodel.h)

CreateTypeSignature 메서드는 모듈 및 형식 이름을 포함하여 구체적인 형식 집합을 일치시키는 데 사용할 수 있는 서명을 만듭니다. 형식 이름 서명 문자열의 형식은 디버그 중인 언어(및 디버그 호스트)와 관련이 있습니다. C/C++의 경우 서명 문자열은 NatVis 형식 사양과 동일합니다. 즉, 서명 문자열은 템플릿 인수에 와일드카드(*로 지정됨)가 허용되는 형식 이름입니다.

구문

HRESULT CreateTypeSignature(
  PCWSTR                  signatureSpecification,
  IDebugHostModule        *module,
  IDebugHostTypeSignature **typeSignature
);

매개 변수

signatureSpecification

이 서명이 적용되는 형식을 식별하는 서명 문자열입니다. 이 문자열의 형식은 디버그 중인 언어에 따라 다릅니다. C/C++의 경우 NatVis 형식 사양과 동일합니다. 템플릿 인수에 와일드카드가 허용되는 형식 이름입니다(*로 지정됨).

module

지정된 경우 지정된 모듈 내에 포함된 형식만 서명과 일치합니다. 지정하지 않으면 모듈의 형식이 서명과 일치할 수 있습니다.

typeSignature

생성된 형식 서명 개체가 여기에 반환됩니다.

반환 값

이 메서드는 성공 또는 실패를 나타내는 HRESULT를 반환합니다.

설명

예제 코드

ComPtr<IDebugHost> spHost; /* get the host */

ComPtr<IDebugHostSymbols> spSym;
if (SUCCEEDED(spHost.As(&spSym)))
{
    // Create a type signature for MyTemplateType<*>
    ComPtr<IDebugHostTypeSignature> spSig1;
    if (SUCCEEDED(spSym->CreateTypeSignature(L"MyTemplateType<*>", 
                                             nullptr, 
                                             &spSig1)))
    {
        // spSig1 is a type signature which will match any concrete template 
        // type with a base name of MyTemplateType and *ANY* template arguments.
        // This is true regardless of the module in which the type is contained.
    }

    ComPtr<IDebugHostModule> spMyModule;
    if (SUCCEEDED(spSym->FindModuleByName(USE_CURRENT_HOST_CONTEXT, 
                                          L"MyModule.dll", 
                                          &spMyModule)))
    {
        // Create a type signature for MyTemplateType<*> within MyModule.dll.
        ComPtr<IDebugHostTypeSignature> spSig2;
        if (SUCCEEDED(spSym->CreateTypeSignature(L"MyTemplateType<*>", 
                                                 nullptr, 
                                                 &spSig2)))
        {
            // spSig2 is a type signature which will match any concrete 
            // template type with a base name of MyTemplateType and *ANY* 
            // template arguments that is within the particular MyModule.dll 
            // that's in the current UI context (e.g.: process) of the debugger.
            // This means if the host is debugging multiple processes
            // and you switch processes, a MyTemplateType<*> in an identically
            // named and versioned MyModule.dll will *NOT* match this signature.
        }
    }
}

FindModuleByName, CreateTypeSignature 및 CreateTypeSignatureForModuleRange에서 일치하는 기호 모듈의 차이점

FindModuleByName 을 사용하면 전달된 모듈 이름이 모듈의 실제 이미지 이름(예: My Module.dll) 또는 디버거 엔진에서 참조할 수 있는 모듈 이름(예: MyModule 또는 MyModule_<hex_base>)이 될 수 있습니다.

CreateTypeSignatureForModuleRange를 호출하고 이름/nullptr/nullptr을 전달하면 모든 버전의 이름과 일치하는 모듈과 일치하는 서명이 만들어질 수 있습니다.

CreateTypeSignature 함수에 전달된 모듈 이름은 모듈의 실제 이미지 이름(예: MyModule.dll)만 수락합니다.

FindModuleByName을 호출한 다음 해당 모듈을 사용하여 CreateTypeSignature를 호출하면 전달된 모듈의 특정 instance 일치하는 서명이 생성됩니다. 로드된 모듈의 복사본이 두 개 있는 경우(예: 64비트 Windows에서 실행되는 32비트 프로세스의 ntdll) 전달된 특정 instance 일치합니다. DLL이 언로드되고 다시 로드된 경우에도 더 이상 일치하지 않습니다. 서명은 디버거에서 알려진 모듈의 특정 instance 연결됩니다.

요구 사항

요구 사항
헤더 dbgmodel.h

추가 정보

IDebugHostSymbols 인터페이스

FindModuleByName

CreateTypeSignatureForModuleRange