성태의 닷넷 이야기
홈 주인
모아 놓은 자료
프로그래밍
질문/답변
사용자 관리
사용자
메뉴
아티클
외부 아티클
유용한 코드
온라인 기능
MathJax 입력기
최근 덧글
[정성태] 그냥 RSS Reader 기능과 약간의 UI 편의성 때문에 사용...
[이종효] 오래된 소프트웨어는 보안 위협이 되기도 합니다. 혹시 어떤 기능...
[정성태] @Keystroke IEEE의 문서를 소개해 주시다니... +_...
[손민수 (Keystroke)] 괜히 듀얼채널 구성할 때 한번에 같은 제품 사라고 하는 것이 아...
[정성태] 전각(Full-width)/반각(Half-width) 기능을 토...
[정성태] Vector에 대한 내용은 없습니다. Vector가 닷넷 BCL...
[orion] 글 읽고 찾아보니 디자인 타임에는 InitializeCompon...
[orion] 연휴 전에 재현 프로젝트 올리자 생각해 놓고 여의치 않아서 못 ...
[정성태] 아래의 글에 정리했으니 참고하세요. C# - Typed D...
[정성태] 간단한 재현 프로젝트라도 있을까요? 저런 식으로 설명만 해...
글쓰기
제목
이름
암호
전자우편
HTML
홈페이지
유형
제니퍼 .NET
닷넷
COM 개체 관련
스크립트
VC++
VS.NET IDE
Windows
Team Foundation Server
디버깅 기술
오류 유형
개발 환경 구성
웹
기타
Linux
Java
DDK
Math
Phone
Graphics
사물인터넷
부모글 보이기/감추기
내용
<div style='display: inline'> <div style='font-family: 맑은 고딕, Consolas; font-size: 20pt; color: #006699; text-align: center; font-weight: bold'>Windbg - Hyper-V 윈도우 7 원격 디버깅 구성</div> <br /> 예전에 Virtual Server에서 호스팅하고 있는 가상 PC에 windbg를 연결하는 방법을 설명했었는데요.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; width: 800px; background-color: #fbedbb; overflow-x: scroll; font-family: Consolas, Verdana;' > 원격 컴퓨터 디버깅 - VPC 설정 ; <a target='_tab' href='http://www.sysnet.pe.kr/2/0/265'>http://www.sysnet.pe.kr/2/0/265</a> </pre> <br /> 방법은 Hyper-V에서도 유사합니다. 단지, 윈도우 7에서의 boot.ini가 제거되는 바람에 약간 추가적인 작업이 필요한 정도인데요. <br /> <br /> 가상 머신의 COM 포트와 호스트 운영체제 측의 로컬 Named pipe 자원을 연결하는 설정은 이전과 다름없이 아래에서처럼 비슷하게 설정 방법이 제공됩니다. (<a target='tab' href='https://www.sysnet.pe.kr/2/0/11720'>Generation 2 VM의 경우 PowerShell 명령어로 설정</a>)<br /> <br /> <img alt='windbg_hyperv_win7_1.png' src='/SysWebRes/bbs/windbg_hyperv_win7_1.png' /><br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; width: 800px; background-color: #fbedbb; overflow-x: scroll; font-family: Consolas, Verdana;' > Named pipe 경로: <b style='COLOR: blue'>\\.\pipe\se2</b> </pre> <br /> 이제, 대상이 되는 VM 운영체제에서 다음과 같은 명령을 관리자 권한으로 실행한 후, "재부팅" 해줍니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; width: 800px; background-color: #fbedbb; overflow-x: scroll; font-family: Consolas, Verdana;' > // COM1 포트에 \\.\pipe\se2를 연결한 경우 C:\Windows\system32> <b style='COLOR: blue'>bcdedit /dbgsettings SERIAL DEBUGPORT:1 BAUDRATE:115200 </b> The operation completed successfully. C:\Windows\system32> <b style='COLOR: blue'>bcdedit /dbgsettings</b> debugtype Serial debugport 1 baudrate 115200 The operation completed successfully. C:\Windows\system32> <b style='COLOR: blue'>bcdedit /set debug on</b> The operation completed successfully. C:\Windows\system32> <b style='COLOR: blue'>bcdedit /set testsigning on</b> The operation completed successfully. C:\Windows\system32> bcdedit ...[생략]... Windows Boot Loader ------------------- identifier {current} device partition=C: ...[생략]... testsigning Yes isolatedcontext Yes ...[생략]... debug Yes </pre> <a name='host_windbg'></a> <br /> 끝났군요. ^^ (Hyper-V를 호스팅하는 측에서) 마지막으로 windbg를 명령행에 다음과 같이 실행해 대기하거나,<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; width: 800px; background-color: #fbedbb; overflow-x: scroll; font-family: Consolas, Verdana;' > ...[설치경로]...\windbg.exe <b style='COLOR: blue'>-k com:pipe,port=\\.\pipe\se2 -b</b> // 또는, "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\windbg" -Q -k "com:port=\\.\pipe\se2,baud=115200,pipe,reconnect" </pre> <br /> 또는 windbg 실행 후, "File" / "Kernel Debug..." 메뉴를 이용하여 다음과 같이 설정해서 연결을 대기할 수 있습니다.<br /> <br /> <img alt='windbg_hyperv_win7_2.png' src='/SysWebRes/bbs/windbg_hyperv_win7_2.png' /><br /> <br /> 명령행에서 "-b" 옵션을 주지 않거나, 대화 상자에서 "Reconnect" 옵션을 끄고 실행한다면, 다음과 같이 "Waiting to reconnect..." / "Debuggee not connected" 메시지로 계속 대기를 하게 되는데요.<br /> <br /> <img alt='windbg_hyperv_win7_3.png' src='/SysWebRes/bbs/windbg_hyperv_win7_3.png' /><br /> <br /> 잘못된 것이 아니고 ^^ "Debug" / " Break" 메뉴 (단축키: Ctrl+Break)를 실행해 주면 대상이 되는 가상 PC의 실행을 완전히 멈추게 되고 다음과 같이 프롬프트가 떨어지게 됩니다.<br /> <br /> <img onclick='toggle_img(this)' class='imgView' alt='windbg_hyperv_win7_4.png' src='/SysWebRes/bbs/windbg_hyperv_win7_4.png' /><br /> <br /> 만약, 명령행에서 "-b" 옵션을 주거나 대화 상자에서 "Reconnect" 옵션을 체크했다면 Windbg.exe는 원격 컴퓨터에 연결하자마자 "Break"를 하게 됩니다.<br /> <br /> 다시 가상 PC를 실행상태로 만들려면 "g" 명령어를 주면 됩니다. ^^<br /> <br /> <hr style='width: 50%' /><br /> <br /> 참고로, 원격 디버깅의 경우 반드시 관리자 권한으로 실행해 주어야 하는데, 그렇지 않으면 다음과 같은 오류가 발생합니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; width: 800px; background-color: #fbedbb; overflow-x: scroll; font-family: Consolas, Verdana;' > Could not start kernel debugging using com:pipe,port=\\.\pipe\se2 parameters, Win32 error 0n5 Access is denied. </pre> <br /> <hr style='width: 50%' /><br /> <br /> 참고로 /dbgsettings만 해서는 안 되고 debug on을 해야만 원격 디버깅이 동작합니다.<br /> <br /> <pre style='margin: 10px 0px 10px 10px; padding: 10px 0px 10px 10px; background-color: #fbedbb; overflow: auto; font-family: Consolas, Verdana;' > // 관리자 권한으로 실행 // 이 옵션을 설정해야만 원격 디버깅도 가능 (<a target='tab' href='https://www.sysnet.pe.kr/2/0/2904#secure_boot'>Secure Boot가 꺼져 있어야 함</a>) c:\temp> <span style='color: blue; font-weight: bold'>bcdedit /set debug on</span> // 기왕이면, <a target='tab' href='https://www.sysnet.pe.kr/2/0/13866'>테스트 서명을 허용하는 옵션도 설정</a> c:\temp> <span style='color: blue; font-weight: bold'>bcdedit /set testsigning on</span> </pre> <a name='cpu100'></a> <br /> 그리고 주의해야 할 사항!<br /> <br /> 반드시 windbg 종료할 때 "g" 명령어로 시스템을 활성화시켜주어야 합니다. 그렇지 않으면 계속 스케쥴링이 멈춘 체로 VM이 유지되고 풀어주려면 다시 windbg 실행해서 "g" 명령어를 내려야 합니다. ^^<br /> <br /> 예전에 Virtual Server 이야기 하면서 VM이 멈춰진 상태에서 CPU 부하가 심하다는 이야기를 한 적이 있는데요. 다행히 Hyper-V에서는 이런 현상이 없습니다. 테스트 삼아서, "Windows Virtual PC" 환경은 어떨까 싶어서 호스팅 되고 있는 "XP Mode" 가상 PC에 windbg를 걸어보았는데 이건 여전히 CPU를 13% 소비하는 현상이 있습니다. (8-core에서 13%는 단일 CPU에서의 100% 현상입니다.)<br /> <br /> 음... CPU 소비를 고려한다면, windbg로 원격 디버깅하는 환경은 Hyper-V가 이상적일 수 있다는 거군요. ^^<br /> <br /><br /><hr /><span style='color: Maroon'>[이 토픽에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]</span> </div>
첨부파일
스팸 방지용 인증 번호
1987
(왼쪽의 숫자를 입력해야 합니다.)