'VC'에 해당되는 글 2건
VC Debugger가 쓰레드 디버깅 시에 hang되는 문제에 대한 설명 자료 :: 2007/02/05 11:14
어디서 이 글을 발견하게 된 것인지는 모르지만, 개발자에게는 꽤 유용한 글이라 생각된다. 디버거를 사용해서 개발하게 되다보면, 그 외 다른 유틸을 사용하면서 개발하게 되면, 생산속도는 올라가지만, 의존도가 올라가 가끔 곤혹스러운 경우를 경험하게 된다. 아래의 경우도 마찬가지 일것이다. 멀티쓰레드 프로그램 개발하는데.. 에러나서 디버깅하는데.. 디버거가 종종 다운된다. 아주 환장한 일이기도 하다.
해당 글은 VC 에서만 이야기 하고 있는데 내 경험상 볼랜드 개발툴도 멀티스레드 개발시 Hang 되는 현상이 종종 있었다. 아마도 같은 이유라 추측이 된다.
잘 읽어보니.. Window 너무 허접하게 짠거 아닌가 하는 생각이 좀 든다.ㅋㅋ 내가 짠 거 보다는 훨신 잘 만든 거긴 한데..ㅋㅋ
XP에서 VC6(가끔은 2003,2005)를 써서 멀티쓰레드 프로그램을 디버그 하는 중에 hang 된다는 얘기를 종종 들을 수 있다. 이건 CTFMON.EXE의 문제이고 고급 텍스트 서비스를 끄면 대부분 해결된다.
나는 여태까지 이렇게만 알고 있었는데, 이번에 더 상세하게 이 문제를 파헤쳐 놓은 사람의 글을 발견해서 이 링크를 올린다.
http://www.virtualdub.org/blog/pivot/entry.php?id=118
요컨데(제대로 해석했는지 모르겠지만 ^^)
"CTF.LBES.MutexDefaultS-1-5-21-790525478-1715562821-839522115-1003 "와 비슷한 이름의 Mutex가 텍스트 서비스 프레임워크(Office와 XP) 에 존재하는데, 텍스트를 찍는데에 있어 이 뮤텍스가 필요한 모양이다.
그런데 어느 순간 디버그 당하는 프로세스의 어떤 쓰레드가 화면에 텍스트를 찍기 위해 이 뮤텍스를 소유하고, 다른 쓰레드들 또한 이 뮤텍스의 소유권을 얻기 위해 기다리는 경우가 발생할 수 있다. 이 때 VC 디버거에서 이 뮤텍스를 소유하려고 달려들면(예를 들면 소스를 찍으려고...) 당연히 이것도 기다리게 되므로 결국 hang이 되버린다. 그런데 hang이 왜 풀리지 않는가 하면 디버거가 쓰레드를 다 잡고 있기 때문이다. 그럼 뮤텍스를 릴리즈 않게 되는 것이니 hang이 되는 것이다. 결국 데드락이다.
이러다보면 차례차례 거의 모든 프로세스가 이 뮤텍스 하나에 다 매달리는 문제가 생기고 결국 시스템 자체가 hang 되는 경우가 발생한다. 단 커맨드 프롬프트(콘솔창)에 경우에는 완전히 다른 체계(csrss.exe)를 쓰므로 문제가 발생하지 않는데, 그래서 그런지 예전에 이런 문제가 발생했을 때 콘솔창을 띄어서 문제생기면 재빠르게 Alt-Tab 으로 전환해서 킬시키면 이상하게 문제없었던 기억이 있는데 이런 상황 때문이었던 거 같다.
결론은 이런데 그 외에도 상황이 좀 있다. 이거에 대해서는 자세하게 링크에서 읽어보시고, 그 설명의 결론은 Disable Text Services Framework in Regional and Language Settings 이거란다. ^^: 댓글에도 적혀있지만 전역 뮤텍스로 저렇게 중요한 거를 제어하는건 정말 위험한 생각이다 ㅡㅡ; 특히나 UI를 저런식으로는 좀...
글고 댓글 보니 이 외에도 SendMessage(HWMD_TOPMOST) 이거를 보내면 비슷한 상황이있나보다. 아직 저걸 쓸 일이 없어서 이 상황을 겪어보진 못했지만 조심해야 겠다.
뭐 여튼 예전에 어렴풋이 MS 기술문서에서도 본 거 같은데 찾을 수 없어 뒤지다 발견했는데, 의외로 수확이다. 앞으로 좋은 참고가 될 듯 싶다.
VC IDE 단축키 및 아이디어 :: 2007/02/02 13:42
Save time and impress co-workers with these great keyboard
shortcuts
Over
many months of using VC 6, I've come up with a few keyboard shortcuts that are
really handy, save a few seconds here and there, and really impress co-workers.
Many of the commands aren't apparent, and you wouldn't even know some of them
existed unless you went through the entire command list on the Keyboard tab in
the Tools-Customize dialog.
VC
6을
수개월
넘도록
사용하면서,
필자는
정말
편리한
키보드
단축키를
몇
개
사용하여,
여기저기서
시간을
절약하고,
동료
작업자들에게
깊은
인상을
주었다.
많은
명령들이
명백하지
않아서,
여러분은
이것들
중
몇몇은
존재하는지
조차도
알지
못했을
수
있다.
Tools-Customize 대화상자에
있는
키보드
탭에서
모든
명령리스트를
살펴보았다면
모르지만.
The
first table lists the commands that I can't live without and use all the time.
The second table lists commands I don't use quite as often, but which I still
find handy. Commands marked as "built-in" already have the listed keyboard
assignment. For the other commands, you'll need to map the keys
yourself.
첫
번째
표는
필자가
항상
사용하며,
이것들
없이는
못사는
명령들의
리스트이다.
두
번째
표는
필자가
아주
자주
사용하지는
않지만,
여전히
편리하다고
생각하는
명령들의
리스트이다.
“built-in”이라고
표시된
명령들은
이미
키보드가
할당되어
있는
것들이다.
그렇지
않은
명령들을
사용하기
위해서는,
여러분이
직접
키를
매핑해주어야
한다.
Must-Have
Commands
|
Key
|
Command
|
Description
|
|
Ctrl+Shift+up
arrow |
WBGoToPrevious |
Moves
to the previous function in the current file. 현재
파일에서
이전
함수로
이동 |
|
Ctrl+Shift+down
arrow |
WBGoToNext |
Moves
to the next function in the current file. 현재
파일에서
다음
함수로
이동 |
|
Ctrl+Shift+G |
FileGoTo
(built-in) |
If
the cursor is over a filename, opens that file. Usually you move the cursor up
to an #include line and then use this command. 커서가
파일
이름
위에
있다면
그
파일을
연다.
커서를
#include 라인에
놓은
후
이
명령을
사용하라. |
|
Ctrl+Shift+H |
WBOpenInclude |
Brings
up a dialog listing all headers #include'd in the current file. Select a header
and it will be opened. 현재
파일에
#include되어있는
모든
헤더파일의
리스트를
가지는
대화상자를
연다.
헤더를
선택하면,
열릴
것이다. |
|
Ctrl+I |
SearchIncremental
(built-in) |
Begins
an incremental search. Press these keys and then start typing the text to search
for. The caret will move through the file as you type. Hit Enter to leave search
mode. You can then use the other search keys (like F3) to continue searching for
the same text. 점진적인
검색,
이
키를
누르고
검색할
텍스트를
타이핑하기
시작하라.
캐럿이
여러분이
타이핑하는
대로
파일
내에서
움직일
것이다.
검색
모드를
끝내려면
엔터를
눌러라.
여러분은
다른
검색
키(F3
같은)를
사용하여
같은
텍스트에
대해
검색을
계속할
수
있다. |
|
Ctrl+Shift+F7 |
BuildRebuildAll |
Rebuilds
all files in the current project. 현재
프로젝트의
모든
파일을
리빌드한다. |
|
Ctrl+F3 |
FindNextWord
(built-in) |
Finds
the next occurrence of the word that the caret is currently
over. 캐럿이
현재
위치한
곳의
단어가
다시
나타나는
곳으로
이동한다. |
|
Ctrl+Shift+F3 |
FindPrevWord
(built-in) |
Same
as Ctrl+F3, but searches backwards. Ctrl+F3과
같지만,
뒤쪽으로
검색한다. |
|
Alt+F7 |
ProjectSettings
(built-in) |
Opens
the project settings dialog. 프로젝트
세팅
다이얼로그를
연다. |
|
Alt+Num
* |
DebugShowNextStatement
(built-in) |
Moves
the caret to the next statement to be executed (only when broken in debug
mode). 캐럿을
실행될
다음
문장으로
이동한다.
(디버그
모드에서
멈췄을
때에만
사용가능) |
|
Shift+Num
* |
DebugShowNextStatement |
I
add this key mapping because it's possible to type with one hand, while the
previous one isn't. Yes, I'm lazy. :) 필자는
이
키를
매핑했다.
왜냐하면
한손으로
타이핑할
수
있기
때문이다.
원래
것은
그럴
수
없다.
그래
나
게으르당. |
|
Ctrl+Shift+F9 |
DebugRemoveAllBreakpoints
(built-in) |
Deletes
all breakpoints. 모든
중지점을
삭제한다. |
|
Ctrl+Alt+Shift+F9 |
DebugDisableAllBreakpoints |
Disables
all breakpoints. 모든
중지점을
사용
불가능하게
한다. |
|
Ctrl+M |
CheckMnemonicKeys
(built-in) |
Checks
for duplicate shortcut keys in a dialog or menu. 다이얼로그나
메뉴에서
중복되는
단축키를
체크한다. |
Other
Time-Savers
|
Key
|
Command
|
Description
|
|
Ctrl+Enter |
LineOpenBelow |
Opens
a blank line below the current line and moves the caret to the new
line. 현재
라인
아래에
빈
라인을
만들고
새
라인으로
캐럿을
이동시킨다. |
|
Ctrl+Shift+F8 |
SelectColumn
(built-in) |
Begins
a selection - move the caret to select columns of text. Easier than
Alt-dragging. 선택을
시작한다.
– 텍스트
컬럼을
선택하려면
캐럿을
이동하라.
Alt-드래깅
보다
쉽다. |
|
Ctrl+Shift+S |
FileSaveAll |
Saves
all open files. 열려있는
모든
파일
저장 |
|
Alt+F8 |
SelectionFormat
(built-in) |
Formats
the selected text according to your indentation preferences. Great for when you
cut & paste code out of MSDN and the code loses its
indentation. 여러분의
들여쓰기
설정에
따라
선택된
텍스트의
포맷을
바꾼다.
MSDN에서
코드를
복사해
붙여넣을
때
매우
좋다.
코드는
원래의
들여쓰기를
잃어버릴
것이다. |
|
Ctrl+Alt+up
arrow |
LevelUp |
Moves
to the previous occurrence of a start of a block (for instance, the next left
brace). 블록
시작의
처음으로
이동한다.
(예를
들어,
다음
왼쪽
중괄호로
이동) |
|
Ctrl+Alt+down
arrow |
LevelDown |
Moves
to the next occurrence of an end of a block (for instance, the next right
brace). 블록의
끝으로
이동한다.
(예를
들어
다음
오른쪽
중괄호로
이동) |
|
Ctrl+Shift+X |
CutAppendNext |
Press
these keys right before a cut (Ctrl+X) to append the cut text to the end of the
clipboard. 잘라내기(Ctrl+X)하기
바로
전에
이
키를
사용하여
잘라낸
텍스트를
클립보드의
끝에
추가한다. |
|
Ctrl+E |
GoToMatchBrace
(built-in) |
If
the caret is over a parenthesis, bracket, or brace, moves the caret to the
matching character. 캐럿이
괄호,
꺽쇠괄호,
중괄호에
있을
때,
매칭되는
문자로
캐럿을
이동한다. |
|
Ctrl+Shift+E |
GoToMatchBraceExtend
(built-in) |
Same
as Ctrl+E, but selects the text between the matching characters as
well. Ctrl+E와
같다.
하지만
매칭되는
문자
사이에
있는
텍스트를
선택한다. |
|
Ctrl+Shift+T |
WindowScrollToTop |
Scrolls
the window so the current line is at the top of the
window. 현재
라인이
윈도우의
상단에
위치하도록
윈도우를
스크롤한다. |
|
Ctrl+Shift+C |
WindowScrollToCenter |
Scrolls
the window so the current line is at the center of the
window. 현재
라인이
윈도우의
중앙에
오도록
윈도우를
스크롤한다. |
|
Ctrl+Shift+B |
WindowScrollToBottom |
Scrolls
the window so the current line is at the bottom of the
window. 현재
라인이
윈도우의
바닥에
위치하도록
윈도우를
스크롤한다. |
|
Ctrl+J |
ConditionalUp
(built-in) |
Moves
back to an enclosing #if. 감싸고
있는
#if로
이동한다. |
|
Ctrl+K |
ConditionalDown
(built-in) |
Moves
forward to an enclosing #else or #endif. 감싸고
있는
#else나
#endif로
이동한다. |
|
Ctrl+Alt+S |
WindowSplitHorizontal |
Splits
a text editor window into two panes (with the split running
horizontally). 텍스트
에디터
윈도우를
두개의
영역으로
나눈다.
(수평으로
나눔) |
|
Alt+Up
arrow |
WindowSwitchPaneUp |
Moves
one pane up in a split window. 나누어진
윈도우의
위쪽
영역으로
이동한다. |
|
Alt+Down
arrow |
WindowSwitchPaneDown |
Moves
one pane down in a split window 나누어진
윈도우의
아래쪽
영역으로
이동한다. |
|
Alt+Left
arrow |
WindowSwitchPaneLeft |
Moves
one pane left in a split window 나누어진
윈도우의
왼쪽
영역으로
이동한다. |
|
Alt+Right
arrow |
WindowSwitchPaneRight |
Moves
one pane right in a split window 나누어진
윈도우의
오른쪽
영역으로
이동한다. |
You
can get the latest updates to this and my other articles at http://home.inreach.com/mdunn/code/
이
글의
최신
업데이트와
필자의
다른
글들을
http://home.inreach.com/mdunn/code/
에서
볼
수
있다.
About
Michael Dunn
Michael
lives in sunny
Mike now works as a developer at Napster, an online subscription
music service. He also developed UltraBar, an IE toolbar plugin
that makes web searching easy and trounces the Google toolbar; the CodeProject SearchBar; and has
co-founded Zabersoft, a
development company with offices in
He
also enjoys his hobbies of playing pinball, bike riding, and the occasional
PlayStation, Dreamcast, or MAME game. He is also sad that he's forgotten the
languages he's studied: French, Mandarin Chinese, and Japanese.
Click
here to view
Michael Dunn's online profile.



