본문 바로가기
Study/Debugging

- 프로세스 시작시 자동 디버깅 -

by 뿡뿡대마왕 2011. 9. 28.
반응형
 프로세스 시작과 동시에 디버깅을 해보자!!

msdn에 가보면 이런글이 있었다.

You can set up your application to start Visual Studio when you launch the application from Windows. Visual Studio will load your application, ready for debugging, but will not commence debugging until you issue an execution command. Having Visual Studio launch the debugger in this way is useful for debugging services and COM out-of-proc servers.

To setup an application to launch the debugger automatically

  1. Start the Registry Editor (regedit).
  2. In the Registry Editor, open the HKEY_LOCAL_MACHINE folder.
  3. Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\currentversion\image file execution options.
  4. Under the Image File Execution Options folder, locate the name of the application you want to debug (myapp.exe, for example). If you cannot find the application you want to debug:
    1. Right-click the Image File Execution Options folder and choose New Key from the shortcut menu.
    2. Right-click the new key and choose Rename from the shortcut menu.
    3. Edit the key name to the name of your application, for example, myapp.exe.
  5. Right-click the myapp.exe folder and choose New String Value from the shortcut menu.
  6. Right-click the new string value and choose Rename from the shortcut menu.
  7. Change the name to debugger.
  8. Right-click the new string value and choose Modify from the shortcut menu.

    The Edit String dialog box appears.

  9. In the Value data box, type devenv /debugexe.
  10. Click OK.
  11. From the Registry menu, choose Exit.

    The directory containing devenv.exe must be in your system path.

    Now, use any method to start your application. Visual Studio .NET will start and load the application.

뭐 대충 보면 어플리케이션 시작시 자동으로 디버깅을 한다는 내용인데...

위에 내용을 한글화 해서 직접해보자~



우선 윈도우키 + R을 눌러보자..(단지 실행창의 단축키..)

실행창이 나오면 regedit라고 치고 들어가면 레지스트리 편집기 나온다.



경로를 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\currentversion\image file execution options 

이곳으고 가서 Image File Execution Options 폴더에 마우스 우클릭 -> 새로 만들기 -> 키

하면 새로운 폴더가 추가 될 것이다. 난 calc.exe라는 이름을 해서 만들었다(디버깅하고자 하는 이름으로 폴더를 만들자 ㅋ)

그 다음에 다시 새로 만들 폴더..(난 calc.exe) 거기에 대해 다시 마우스 우클릭 - > 새로 만들기 -> 문자열 값(S) 클릭한다.

새로 생성된 놈의 이름을 정하고..난 여기서 Debugger라고 했음..

그리고  Debugger라고 만든 놈을 더블 클릭하면




요렇게 문자열 편집 창이 나올것이다...

그럼 여기 '값 데이터' 부분에 디버그 경로를 넣어주면 된다...



난 windbg로 디버깅을 하니까 저렇게 절대 경로를 넣어주었다.~~ㅎ;;;;

확인을 누르고 레지스트리 편집창을 닫아주고..

한번 계산기를 실행해보니~~




계산기가 실행됨과 동시에 디버깅에 걸린 것을 볼수 있다..ㅋㅋㅋ

오호호..아주 유용할듯 하다..

시작하자마 크래쉬 나는 어플 디버깅에 유용하겠다..;; +.+


출처는..

http://micingamja.egloos.com/5077284

미친감자라는 분의 블로그 글을 읽다가.....좋은 정보 같아서 ..나도 포스팅을......나처럼 왕초보가 그냥 알아볼수 있도록

상세하게 설명되어 있지 않아 한번 테스트 해보고 그 과정을 위와 같이 적어놓았다...ㅋㅋ



반응형

댓글