다음을 통해 공유


.scriptdebug(JavaScript 디버그)

.scriptdebug 명령을 사용하여 JavaScript 스크립트를 디버그합니다.

.scriptdebug FileName

매개 변수

FileName

디버그할 디버거 JavaScript 스크립트의 이름을 지정합니다.

환경

모드

all

대상

all

Platforms

all

추가 정보

JavaScript 디버깅에 대한 개요는 JavaScript 디버거 스크립팅 - JavaScript 디버깅을 참조 하세요.

참고 항목

WinDbg에서 JavaScript 디버깅을 사용하려면 디버거를 관리istrator로 실행합니다.

설명

JavaScript를 디버그하기 전에 다음 단계를 완료했습니다.

  1. 샘플 스크립트를 로드합니다.

    0:000> .scriptload C:\MyScripts\DebuggableSample.js
    

스크립트를 적극적으로 디버깅하려면 .scriptdebug 명령을 사용합니다.

0:000> .scriptdebug C:\MyScripts\DebuggableSample.js
>>> ****** DEBUGGER ENTRY DebuggableSample ******
           No active debug event!

>>> Debug [DebuggableSample <No Position>] >

프롬프트 >>> Debug [DebuggableSample <No Position>] > 와 입력 요청이 표시되면 스크립트 디버거 내에 있습니다.

.help 명령 또는 ?을 사용하여 JavaScript 디버깅 환경에서 명령 목록을 표시합니다.

>>> Debug [DebuggableSample <No Position>] >.help
Script Debugger Commands (*NOTE* IDs are **PER SCRIPT**):
    ? .................................. Get help
    ? <expr>  .......................... Evaluate expression <expr> and display result
    ?? <expr>  ......................... Evaluate expression <expr> and display result
    |  ................................. List available scripts
    |<scriptid>s  ...................... Switch context to the given script
    bc \<bpid\>  ......................... Clear breakpoint by specified \<bpid\>
    bd \<bpid\>  ......................... Disable breakpoint by specified \<bpid\>
    be \<bpid\>  ......................... Enable breakpoint by specified \<bpid\>
    bl  ................................ List breakpoints
    bp <line>:<column>  ................ Set breakpoint at the specified line and column
    bp <function-name>  ................ Set breakpoint at the (global) function specified by the given name
    bpc  ............................... Set breakpoint at current location
    dv  ................................ Display local variables of current frame
    g  ................................. Continue script
    gu   ............................... Step out
    k  ................................. Get stack trace
    p  ................................. Step over
    q  ................................. Exit script debugger (resume execution)
    sx  ................................ Display available events/exceptions to break on
    sxe <event>  ....................... Enable break on <event>
    sxd <event>  ....................... Disable break on <event>
    t  ................................. Step in
    .attach <scriptId>  ................ Attach debugger to the script specified by <scriptId>
    .detach [<scriptId>]  .............. Detach debugger from the script specified by <scriptId>
    .frame <index>  .................... Switch to frame number <index>
    .f+  ............................... Switch to next stack frame
    .f-  ............................... Switch to previous stack frame
    .help  ............................. Get help

이벤트

sx 스크립트 디버거 명령을 사용하여 트래핑할 수 있는 이벤트 목록을 확인합니다.

>>> Debug [DebuggableSample <No Position>] >sx              
sx                                                          
    ab  [   inactive] .... Break on script abort            
    eh  [   inactive] .... Break on any thrown exception    
    en  [   inactive] .... Break on entry to the script     
    uh  [     active] .... Break on unhandled exception     

sxe 스크립트 디버거 명령을 사용하여 중단 동작을 사용하도록 설정합니다. 예를 들어 스크립트가 실행되는 즉시 스크립트 디버거에 트래핑되도록 항목 중단을 켜려면 이 명령을 사용합니다.

>>> Debug [DebuggableSample <No Position>] >sxe en          
sxe en                                                      
Event filter 'en' is now active                             

sxd 스크립트 디버거 명령을 사용하여 중단점 동작을 사용하지 않도록 설정합니다.

>>> Debug [DebuggableSample 34:5] >sxd en                                                                              
sxd en                                                                                                                 
Event filter 'en' is now inactive                                                                                      

스택 추적

k 명령을 사용하여 스택 추적을 표시합니다.

>>> Debug [DebuggableSample 34:5] >k                                                  
k                                                                                     
    ##  Function                         Pos    Source Snippet                        
-> [00] throwAndCatch                    034:05 (var curProc = host.currentProcess)   
   [01] outer                            066:05 (var foo = throwAndCatch())           
   [02] outermost                        074:05 (var result = outer())                

변수 열거

??을 사용하여 JavaScript 변수의 값을 열거합니다.

>>> Debug [DebuggableSample 34:5] >??someObj                
??someObj                                                   
someObj          : {...}                                    
    __proto__        : {...}                                
    a                : 0x63                                 
    b                : {...}                                

중단점

다음 중단점 명령을 사용하여 추가 중단점 작업을 수행합니다.

bp <bpid>: 중단점 설정

bd <bpid>: 중단점 사용 안 함

be <bpid>: 중단점 사용

bc <bpid>: 중단점 지우기

bpc: 현재 줄에 중단점 설정

bl: 중단점 나열

흐름 제어 - 탐색

스크립트에서 앞으로 이동하려면 다음 명령을 사용합니다.

p: 단계별 실행

t: 단계별 실행

g: 스크립트 계속

gu: 나가기

프레임

프레임을 사용하려면 다음 명령을 사용합니다.

.frame <인덱스>: 프레임 번호 <인덱스로 전환>

.f+: 다음 스택 프레임으로 전환

.f+: 이전 스택 프레임으로 전환

종료 중

.detach 명령을 사용하여 JavaScript 디버거를 분리합니다.

>>> Debug [DebuggableSample 34:5] >.detach                  
.detach                                                     
Debugger has been detached from script!                     

q 명령을 사용하여 JavaScript 디버거를 종료합니다.

>>> Debug [<NONE> ] >q                                      
q