[Debugging Toolbox]Special Command—Execute Commands from a Customized User Interface with .cmdtree

"이 문서는 https://blogs.msdn.com/debuggingtoolbox blog 의 번역이며 원래의 자료가 통보 없이 변경될 수 있습니다. 이 자료는 법률적 보증이 없으며 의견을 주시기 위해 원래의 blog 를 방문하실 수 있습니다. (https://blogs.msdn.com/debuggingtoolbox/archive/2008/09/17/special-command-execute-commands-from-a-customized-user-interface-with-cmdtree.aspx)"
 

Special Command—Execute Commands from a Customized User Interface with .cmdtree

몇 주전 OCS (Office Communications Server) Team 의 Support Escalation Engineer 인 Brad Wilson의 메일을 받았습니다. Brad 는 .cmdtree 라는 명령에 대해 물어 보았고 저는 사용해 본 적이 없다고 하였습니다. 몇 일전 그가 이 명령을 어떻게 사용하는지 설명하는 메일을 보내왔습니다. 그리고 이 명령을 실행해 보니 와! 정말 대단했습니다.

이것을 사용해서 Window를 만들어서 여러분이 많이 사용하는 명령을 넣거나 다른 방법으로 사용할 수 있습니다. 공유를 해준 Brad 에게 감사합니다. 다시 한번 여러분께 이야기 하는데 여러분은 이것을 분명 좋아하실 것 입니다

 

여기 방법이 있습니다.

a) CMDTREE.TXT 라는 이름의 text 파일을 만들어 여러분이 사용하는 명령을 넣습니다. 아래 예제가 있습니다. {} 부분을 여러분이 원하는 것으로 변경할 수 있습니다.

windbg ANSI Command Tree 1.0

title {"Common Commands"}

body

{"Common Commands"}

{"Information"}

{"Time of dump"} {".time"}

{"Process being debugged"} {"|"}

{"Dump Location"} {"||"}

{"Create server on port 9999"} {".server tcp:port=9999"}

{"Show remote connections"} {".clients"}

{"Process Environment Block"} {"!peb"}

{"Logging"}

{"Open Log"} {".logopen /t /u /d"}

{"Close Log"} {".logclose"}

{"Modules"}

{"All Modules"} {"lm D sm"}

{"Loaded Modules"} {"lmo D sm"}

{"Loaded Modules (verbose)"} {"lmvo D sm"}

{"Modules w/o symbols"} {"lme D sm"}

{"Stacks"}

{"Set frame length to 2000"} {".kframes 2000"}

{"Dump current stack w/ DML"} {"kpM 1000"}

{"Dump stacks without private info"} {"knL 1000"}

{"Dump stacks with all parameters"} {"kPn 1000"}

{"Dump stacks (distance from last frame)"} {"kf 1000"}

{"Dump stacks with Frame Pointer Omission"} {"kvn 1000"}

{"Dump all stack"} {"~*kbn 1000"}

{"Dump unique stacks"} {"!uniqstack -pn"}

{"Thread environment block"} {"!teb"}

{"Move to next frame"} {".f+"}

{"Move to previous frame"} {".f-"}

{"Memory"}

{"Dump heaps"} {"!heap -a"}

{"Automated Task"}

{"!analyze"} {"!analyze -v"}

{"Locks"} {"!ntsdexts.locks"}

{"CPU time for User and Kernel Mode"} {"!runaway 7"}

{"Managed"}

{"Load sos"} {".loadby sos mscorwks"}

{"clrstack"} {"!clrstack"}

{"Threads"} {"!threads"}

{"Stack Objects"} {"!dso"}

{"Exceptions"} {"!dae"}

b) Text 파일을 WinDbg 가 설치되어 있는 폴더에 저장합니다. 저는  c:\debuggers 입니다.

c) Dump 파일을 열고 symbol 을 load 한 후 아래 명령을 실행 합니다.

.cmdtree CMDTREE.TXT

d) 위의 명령은 WinDbg 내에 여러분의 명령을 가진 새로운 Window 를 만들 것입니다. Tree 안의 명령을 더블클릭하여 실행할 수 있습니다.

 

다음 문서에서 뵙겠습니다.

역자주) Volker von Einem 에 의하면 WinDbg 6.6.7.5 부터 사용 가능한 기능이라고 합니다. John Robbins 에 의하면 txt 파일을 만들때 공백 같은 것에 신경써야 한다고 하는군요. 파일 끝쪽이나 명령 끝쪽에 공백이 없도록 하세요 ^^