The use method of afxdump and trace

Source: Internet
Author: User

# Ifdef_debug
Afxdump <"dumpingmyperson:/N ";
Myperson-> dump (afxdump );
Afxdump <"/N ";
# Endif

1) trace ();/trace0 ();/trace1 ();/trace2 ();/trace3 ();: The method is similar to the printf () function in C; tracen () the difference between trace () and trace () is that the former uses less resources, and N in the former indicates the number of parameters included. Make trace available: Tools-mfctracer-enablingtrace.
2) afxdump (); // similar to cout in C ++;
3) afxdump (constcobject * OBJ); the relevant information (attribute value) of obj is output ).
4) MessageBox ();/afxmessagebox ();

# Ifdef_debug
Afxdump <X;
# Endif
The result is displayed in output and cannot be in release state. CTRL + F5 does not seem to be valid. F5 can.

Afxdump. setdepth (1 );
Set the depth, such as maps and arrays. It only has a few elements. We use this function to type out all the content.
# Ifdef_debug
Chartest [] = "0123456789/N ";
Afxdump. hexdump ("--", (byte *) test, 11,6 );
# Endif
Result:
-- 303132333435
- -36373839 0a
The first parameter indicates the starting character of the line.
The second parameter indicates the content to be played.
The third parameter indicates the number of elements to be played.
The fourth parameter indicates the number of rows.

4. Trace (...), trace0, trace1, trace2, and trace3 can only be a string of up to 512 characters including Terminator.

5. In the debug status
After F9 sets the breakpoint, F5 goes to the next breakpoint, and F11 goes into the function (including system functions) in the next line of F10. Shift + F11 goes out.
After F5, the Debug menu has corresponding menu items.
After F5, view-> debugwindow sub-menu items are more useful.
Watch to view your specified variables
Variables: displays the value of auot, local, and this.
Memory displays the storage value of the specified memory address
Callstack displays the function call relationship
Value of the registers register
Disabblemble assembly code

In fact, you can debug F5 in release.
Alt + F7 Project Settings
Select C/C ++ generatebrowseinfo.
Debuginfo select progamedatabaseforeditandcontinue
Linkgeneratedebuginfo selected
Choose linkincrementally

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.