dx(디스플레이 디버거 개체 모델 식)

dx 명령은 NatVis 확장 모델을 사용하여 C++ 식을 표시합니다. NatVis에 대한 자세한 내용은 네이 티브 개체의 사용자 지정 보기 만들기를 참조하세요.

dx [-g|-gc #][-c #][-n|-v]-r[#] Expression[,<FormatSpecifier> ]
dx [{-?}|{-h}]

매개 변수

표시할 C++ 식입니다.

-g

반복 가능한 데이터 그리드 개체로 표시합니다. 반복된 각 요소는 그리드의 행이며 해당 요소의 각 표시 자식은 열입니다. 이렇게 하면 각 배열 요소가 행에 표시되고 구조체의 각 필드가 열에 표시되는 구조체 배열과 같은 항목을 볼 수 있습니다.

사용 가능한 DML 링크가 있는 열 이름을 선택하면 해당 열이 정렬됩니다. 해당 열을 기준으로 이미 정렬된 경우 정렬 순서가 반전됩니다.

반복 가능한 모든 개체에는 '눈금으로 표시'라는 DML을 통해 추가된 선택 및 보류(또는 마우스 오른쪽 클릭) 상황에 맞는 메뉴 항목이 있습니다. 출력 창에서 개체를 선택하고 유지(또는 마우스 오른쪽 단추로 클릭)하고 이를 선택하면 표준 트리 뷰 대신 그리드 보기에 개체가 표시됩니다.

열 이름으로 표시되는 (+)는 select-and-hold(또는 마우스 오른쪽 단추 클릭)와 선택 동작을 모두 제공합니다.

  • Select는 해당 열을 가져와서 자체 테이블로 분해합니다. 원래 행과 확장된 열의 자식이 표시됩니다.
  • 열을 선택하고 길게 누르거나 마우스 오른쪽 단추로 클릭하면 열을 가져와 현재 테이블에 대부분의 열로 다시 추가하는 "눈금으로 확장"이 제공됩니다.

-Gc #

그리드로 표시하고 그리드 셀 크기를 지정된 수(#) 문자로 제한합니다.

-c # 컨테이너 연속(컨테이너의 # 요소 건너뛰기)을 표시합니다. 이 옵션은 일반적으로 사용자 지정 출력 자동화 시나리오에서 사용되며 "..."를 제공합니다. 목록의 맨 아래에 있는 continuation 요소입니다.

-N 데이터를 렌더링할 수 있는 두 가지 방법이 있습니다. NatVis 시각화(기본값)를 사용하거나 기본 네이티브 C/C++ 구조를 사용합니다. -n 매개 변수를 지정하여 NatVis 시각화가 아닌 네이티브 C/C++ 구조만 사용하여 출력을 렌더링합니다.

-v

메서드 및 기타 일반적이지 않은 개체를 포함하는 자세한 정보를 표시합니다.

-R#

하위 형식(필드)을 수준까지 # 재귀적으로 표시합니다. 를 지정하지 않으면 # 재귀 수준이 기본값입니다.

[<,FormatSpecifier>]

다음 형식 지정자를 사용하여 기본 렌더링을 수정합니다.

서식 지정자 Description
X 서수(16진수)로 표시
D 서수를 10진수로 표시
O 8진수로 서수 표시
B 이진으로 서수 표시
En 이름으로만 열거형 표시(값 없음)
C 문자열이 아닌 단일 문자로 표시
,s 8비트 문자열을 ASCII 따옴표로 표시
Sb 8비트 문자열을 ASCII의 따옴표가 없는 문자열로 표시
,s8 8비트 문자열을 UTF-8 따옴표로 표시
,s8b 8비트 문자열을 UTF-8의 따옴표가 없는 문자열로 표시
수호 16비트 문자열을 UTF-16 따옴표로 표시
하위 16비트 문자열을 UTF-16 unqouted로 표시
,! 원시 모드로만 개체 표시(예: NatVis 없음)
,# 포인터/배열/컨테이너의 길이를 리터럴 값 #(숫자로 바꾸기)으로 지정합니다.
,[<expression>] 포인터/배열/컨테이너의 길이를 식 <식으로 지정합니다.>
Nd 개체의 파생(runtype) 형식을 찾을 수 없습니다. 정적 값만 표시

dx-?

명령줄 도움말을 표시합니다.

dx-h 디버거에서 사용할 수 있는 개체에 대한 도움말을 표시합니다.

dx-id

Microsoft 내부에서만 사용합니다. 명령 출력에서 데이터 모델 링크를 따르는 데 사용됩니다.

명령줄 사용 예제

.dx 설정 명령을 사용하여 디버그 설정 개체에 대한 정보를 표시할 수 있습니다. 디버그 설정 개체에 대한 자세한 내용은 .settings를 참조하세요.

kd> dx -r1 Debugger.Settings
Debugger.Settings  
    Debug            
    Display           
    EngineInitialization 
    Extensions       
    Input             
    Sources           
    Symbols           
    AutoSaveSettings : false

-r1 재귀 옵션을 사용하여 세션, 설정 및 상태와 같은 다른 디버거 개체를 볼 수 있습니다.

kd> dx -r1 Debugger
Debugger  
  Sessions  
  Settings 
  State    
  Utility
  LastEvent 

개체 체인 아래로 더 이동하려면 -r3 재귀 옵션을 사용하여 Debugger.Sessions 개체를 지정합니다.

kd> dx -r3 Debugger.Sessions
Debugger.Sessions  
  [0]              : Remote KD: KdSrv:Server=@{<Local>},Trans=@{1394:Channel=0}
    Processes  
      [0]              : <Unknown Image>
      [4]              : <Unknown Image>
      [304]            : smss.exe
      [388]            : csrss.exe
      [456]            : wininit.exe
      [468]            : csrss.exe
      [528]            : services.exe
      [536]            : lsass.exe
      [544]            : winlogon.exe
      [620]            : svchost.exe
       ...               ...

x 형식 지정자를 추가하여 서수 값을 16진수로 표시합니다.

kd> dx -r3 Debugger.Sessions,x
Debugger.Sessions,x  
  [0x0]            : Remote KD: KdSrv:Server=@{<Local>},Trans=@{1394:Channel=0}
    Processes  
      [0x0]            : <Unknown Image>
      [0x4]            : <Unknown Image>
      [0x130]          : smss.exe
      [0x184]          : csrss.exe
      [0x1c8]          : wininit.exe
      [0x1d4]          : csrss.exe
      [0x210]          : services.exe
      [0x218]          : lsass.exe
      [0x220]          : winlogon.exe
      [0x26c]          : svchost.exe
      [0x298]          : svchost.exe
      [0x308]          : dwm.exe
      [0x34c]          : nvvsvc.exe
      [0x37c]          : nvvsvc.exe
      [0x384]          : svchost.exe
       ...               ...

다음은 활성 디버그 세션을 사용하여 첫 번째 프로세스에서 첫 번째 스레드의 호출 스택을 나열하는 예제입니다.

kd> dx -r1 Debugger.Sessions.First().Processes.First().Threads.First().Stack.Frames
Debugger.Sessions.First().Processes.First().Threads.First().Stack.Frames 
    [0x0]            : nt!RtlpBreakWithStatusInstruction
    [0x1]            : nt!KdCheckForDebugBreak + 0x7a006
    [0x2]            : nt!KiUpdateRunTime + 0x42
    [0x3]            : nt!KiUpdateTime + 0x129
    [0x4]            : nt!KeClockInterruptNotify + 0x1c3
    [0x5]            : hal!HalpTimerClockInterruptEpilogCommon + 0xa
    [0x6]            : hal!HalpTimerClockInterruptCommon + 0x3e
    [0x7]            : hal!HalpTimerClockInterrupt + 0x1cb
    [0x8]            : nt!KiIdleLoop + 0x1a

-g 옵션을 사용하여 출력을 데이터 그리드로 표시합니다. 정렬할 열을 선택합니다.

kd> dx -g @$curprocess.Modules

열 형식 그리드 출력을 표시하는 dx -g @$curprocess.modules 명령의 출력 스크린샷

-h 옵션을 사용하여 개체에 대한 정보를 표시합니다.

kd>  dx -h Debugger.State
Debugger.State   [State pertaining to the current execution of the debugger (e.g.: user variables)]
    DebuggerVariables [Debugger variables which are owned by the debugger and can be referenced by a pseudo-register prefix of @$]
    PseudoRegisters   [Categorizied debugger managed pseudo-registers which can be referenced by a pseudo-register prefix of @$]
    UserVariables     [User variables which are maintained by the debugger and can be referenced by a pseudo-register prefix of @$]

Environment 개체를 사용하여 TEB 및 PEB 정보 표시

Environment 개체를 사용하여 스레드 및 프로세스와 연결된 TEB 및 PEB 정보를 표시합니다.

현재 스레드와 연결된 TEB를 표시하려면 이 명령을 사용합니다.

0: kd> dx -r2 @$curthread.Environment
@$curthread.Environment                
    EnvironmentBlock [Type: _TEB]
        [+0x000] NtTib            [Type: _NT_TIB]
        [+0x038] EnvironmentPointer : Unable to read memory at Address 0x38
        [+0x040] ClientId         [Type: _CLIENT_ID]
        [+0x050] ActiveRpcHandle  : Unable to read memory at Address 0x50
        [+0x058] ThreadLocalStoragePointer : Unable to read memory at Address 0x58
        [+0x060] ProcessEnvironmentBlock : Unable to read memory at Address 0x60
        [+0x068] LastErrorValue   : Unable to read memory at Address 0x68
        [+0x06c] CountOfOwnedCriticalSections : Unable to read memory at Address 0x6c
        [+0x070] CsrClientThread  : Unable to read memory at Address 0x70
        [+0x078] Win32ThreadInfo  : Unable to read memory at Address 0x78
        [+0x080] User32Reserved   [Type: unsigned long [26]]
        [+0x0e8] UserReserved     [Type: unsigned long [5]]
        [+0x100] WOW32Reserved    : Unable to read memory at Address 0x100
        [+0x108] CurrentLocale    : Unable to read memory at Address 0x108
        [+0x10c] FpSoftwareStatusRegister : Unable to read memory at Address 0x10c
         ...

현재 프로세스와 연결된 PEB를 표시하려면 이 명령을 사용합니다.

0: kd> dx -r2 @$curprocess.Environment
@$curprocess.Environment                
    EnvironmentBlock [Type: _PEB]
        [+0x000] InheritedAddressSpace : Unable to read memory at Address 0x0
        [+0x001] ReadImageFileExecOptions : Unable to read memory at Address 0x1
        [+0x002] BeingDebugged    : Unable to read memory at Address 0x2
        [+0x003] BitField         : Unable to read memory at Address 0x3
        [+0x003 ( 0: 0)] ImageUsesLargePages : Unable to read memory at Address 0x3
        [+0x003 ( 1: 1)] IsProtectedProcess : Unable to read memory at Address 0x3
        [+0x003 ( 2: 2)] IsImageDynamicallyRelocated : Unable to read memory at Address 0x3
        [+0x003 ( 3: 3)] SkipPatchingUser32Forwarders : Unable to read memory at Address 0x3
        [+0x003 ( 4: 4)] IsPackagedProcess : Unable to read memory at Address 0x3
        [+0x003 ( 5: 5)] IsAppContainer   : Unable to read memory at Address 0x3
        [+0x003 ( 6: 6)] IsProtectedProcessLight : Unable to read memory at Address 0x3
        [+0x003 ( 7: 7)] IsLongPathAwareProcess : Unable to read memory at Address 0x3
        [+0x004] Padding0         [Type: unsigned char [4]]
        [+0x008] Mutant           : Unable to read memory at Address 0x8
        [+0x010] ImageBaseAddress : Unable to read memory at Address 0x10
        [+0x018] Ldr              : Unable to read memory at Address 0x18
        [+0x020] ProcessParameters : Unable to read memory at Address 0x20
        ...

커널 Io.Handles 개체

현재 프로세스 Io.Handles 개체를 사용하여 커널 핸들 정보를 표시합니다.

0: kd> dx -r1 @$curprocess.Io.Handles
@$curprocess.Io.Handles                
    [0x8]           
    [0xc]           
    [0x10]          
    [0x14]          
    [0x18]       
    ...

를 사용합니다. 첫 번째 핸들에 대한 정보를 표시하는 first() 함수입니다.

0: kd> dx -r2 @$curprocess.Io.Handles.First()
@$curprocess.Io.Handles.First()                
    Handle           : 0x8
    Type             : Unexpected failure to dereference object
    GrantedAccess    : Unexpected failure to dereference object
    Object           [Type: _OBJECT_HEADER]
        [+0x000] PointerCount     : 228806 [Type: __int64]
        [+0x008] HandleCount      : 6 [Type: __int64]
        [+0x008] NextToFree       : 0x6 [Type: void *]
        [+0x010] Lock             [Type: _EX_PUSH_LOCK]
        [+0x018] TypeIndex        : 0xf2 [Type: unsigned char]
        [+0x019] TraceFlags       : 0x0 [Type: unsigned char]
        [+0x019 ( 0: 0)] DbgRefTrace      : 0x0 [Type: unsigned char]
        [+0x019 ( 1: 1)] DbgTracePermanent : 0x0 [Type: unsigned char]
        [+0x01a] InfoMask         : 0x0 [Type: unsigned char]
        [+0x01b] Flags            : 0x2 [Type: unsigned char]
        [+0x01b ( 0: 0)] NewObject        : 0x0 [Type: unsigned char]
        [+0x01b ( 1: 1)] KernelObject     : 0x1 [Type: unsigned char]
        [+0x01b ( 2: 2)] KernelOnlyAccess : 0x0 [Type: unsigned char]
        [+0x01b ( 3: 3)] ExclusiveObject  : 0x0 [Type: unsigned char]
        [+0x01b ( 4: 4)] PermanentObject  : 0x0 [Type: unsigned char]
        [+0x01b ( 5: 5)] DefaultSecurityQuota : 0x0 [Type: unsigned char]
        [+0x01b ( 6: 6)] SingleHandleEntry : 0x0 [Type: unsigned char]
        [+0x01b ( 7: 7)] DeletedInline    : 0x0 [Type: unsigned char]
        [+0x01c] Reserved         : 0x0 [Type: unsigned long]
        [+0x020] ObjectCreateInfo : 0xfffff801f6d9c6c0 [Type: _OBJECT_CREATE_INFORMATION *]
        [+0x020] QuotaBlockCharged : 0xfffff801f6d9c6c0 [Type: void *]
        [+0x028] SecurityDescriptor : 0xffffb984aa815d06 [Type: void *]
        [+0x030] Body             [Type: _QUAD]
        ObjectType       : Unexpected failure to dereference object
        UnderlyingObject : Unexpected failure to dereference object

Io.Handles 개체는 커널 전용 개체입니다.

캐스팅을 사용하여 기호 파일 제한 사항 해결

다양한 Windows 시스템 변수에 대한 정보를 표시할 때 모든 형식 정보를 공용 기호에서 사용할 수 없는 경우가 있습니다. 이 예제에서는 이러한 상황을 보여 줍니다.

0: kd> dx nt!PsIdleProcess
Error: No type (or void) for object at Address 0xfffff800e1d50128

dx 명령은 형식 정보가 없는 변수의 주소를 참조하는 기능을 지원합니다. 이러한 "주소" 참조는 "void *"로 처리되며 이와 같이 캐스팅할 수 있습니다. 즉, 데이터 형식이 알려진 경우 다음 구문을 사용하여 변수에 대한 형식 정보를 표시할 수 있습니다.

dx (Datatype *)&VariableName

예를 들어 nt! 데이터 형식이 nt!_EPROCESS PsIdleProcess인 경우 이 명령을 사용합니다.

dx (nt!_EPROCESS *)&nt!PsIdleProcess
(nt!_EPROCESS *)&nt!PsIdleProcess                 : 0xfffff800e1d50128 [Type: _EPROCESS *]
    [+0x000] Pcb              [Type: _KPROCESS]
    [+0x2c8] ProcessLock      [Type: _EX_PUSH_LOCK]
    [+0x2d0] CreateTime       : {4160749568} [Type: _LARGE_INTEGER]
    [+0x2d8] RundownProtect   [Type: _EX_RUNDOWN_REF]
    [+0x2e0] UniqueProcessId  : 0x1000 [Type: void *]
    [+0x2e8] ActiveProcessLinks [Type: _LIST_ENTRY]
    [+0x2f8] Flags2           : 0x218230 [Type: unsigned long]
    [+0x2f8 ( 0: 0)] JobNotReallyActive : 0x0 [Type: unsigned long]

dx 명령은 @@ MASM 구문을 사용하여 식 계산기 전환을 지원하지 않습니다. 식 계산기에 대한 자세한 내용은 식 평가를 참조하세요.

LINQ 디버거 개체 사용

LINQ 구문을 디버거 개체와 함께 사용하여 데이터를 검색하고 조작할 수 있습니다. LINQ는 개념적으로 데이터베이스를 쿼리하는 데 사용되는 SQL(구조적 쿼리 언어)과 비슷합니다. 여러 LINQ 메서드를 사용하여 디버그 데이터를 검색, 필터링 및 구문 분석할 수 있습니다. 디버거 개체와 함께 LINQ를 사용하는 방법에 대한 자세한 내용은 디버거 개체에서 LINQ 사용을 참조하세요.

NatVis 및 JavaScript에서 디버거 개체 사용

NatVis에서 디버거 개체를 사용하는 방법에 대한 자세한 내용은 NatVis의 네이티브 디버거 개체를 참조하세요.

JavaScript에서 디버거 개체를 사용하는 방법에 대한 자세한 내용은 JavaScript 확장의 네이티브 디버거 개체를 참조하세요.

추가 정보

LINQ 디버거 개체 사용

NatVis의 네이티브 디버거 개체

JavaScript 확장의 네이티브 디버거 개체