사용자 도구

사이트 도구


kb:visualcppdebugger

Visual C++ Debugger

VisualCpp 디버거 관련 팁

1. 메모리 할당 번호에 중단점 설정

방법: 메모리 할당 번호에 중단점 설정

(int*){,,msvcr100d.dll}_crtBreakAlloc

2. 의사 변수 (Pseudo-variables)

와치 창에서 볼 수 있는 값들. Pseudovariables

Pseudovariable Function
$err Displays the last error value set with the function SetLastError. The value that is displayed represents what would be returned by the GetLastError function.
Use $err,hr to see the decoded form of this value. For example, if the last error was 3, the $err,hr would display ERROR_PATH_NOT_FOUND : The system cannot find the path specified.
$handles Displays the number of handles allocated in your application.
$vframe Displays the address of the current stack frame.
$tid Displays the thread ID for the current thread.
$env Displays the environment block in the string viewer.
$cmdline Displays the command line string that launched the program.
$pid Displays the process id.
$registername or @registername Displays the contents of the register registername.
Normally, you can display register contents just by entering the register name. The only time you need to use this syntax is when the register name overloads a variable name. If the register name is the same as a variable name in the current scope, the debugger interprets the name as a variable name. That's when $registername or @registername comes in handy.
$clk Displays the time in clock cycles.
$user Displays a structure with account information for the account running the application. For security reasons, the password information is not displayed.
$exceptionstack Displays the stack trace of the current Windows Runtime exception. $ exceptionstack works only in Store apps that are running on Windows 8.1 or later. $ exceptionstack is not supported for C++ and SHE exceptions
$ReturnValue Displays the return value of a .NET Framework method. See Examine return values of method calls

3. 와치 포맷 지정자

와치 윈도우에서 변수 포맷 바꿔서 보기. Format Specifiers in C++

왜 b가 없지… b를 쓰면 2진수로 변수를 표시해준다.

Specifier Format Expression Value Displayed
d decimal integer 0xF000F065, d -268373915
o unsigned octal integer 0xF065, o 0170145
x
h
Hexadecimal integer 61546, x
61541, h
0x0000f06a
X
H
Hexadecimal integer 61541, X
61546, H
0x0000F06A
c Single character 0x0065, c 101 'e'
s ASCII string 0x0012fde8, s “Hello world”
sb ASCII string 0x0012fde8, sb Hello world
su Unicode string 0x0012fde8, su L”Hello world”
sub Unicode string 0x0012fde8, sub Hello world
s8 UTF-8 string 0x0012fde8, s8 “Hello world”
s8b UTF-8 string 0x0012fde8, s8b Hello world
bstr BSTR string 0x0032fe8, bstr Hi there
, na &myGlobal, n
winmain, na
The address of the pointer is not displayed.
nd pb,nd Displays only the base class info of pb, ignoring derived classes
hr HRESULT or Win32 error code. (The debugger now decodes HRESULTs automatically, so this specifier is not required in those cases. 0x00000000L, hr S_OK
wc Window class flag. 0x00000040, wc WC_DEFAULTCHAR
wm Windows message numbers 0x0010, wm WM_CLOSE
! raw format, ignoring any data type views customizations i ! 4
kb/visualcppdebugger.txt · 마지막으로 수정됨: 2014/11/14 11:06 저자 excel96