Debugger ---------------------- DEBUGTRACE for Windows

zhaozj2021-02-08  224

First of all, one of the purposes of this post is the Dongdong selling himself, and the purpose of the goal is the technique that is hoping to communicate with you. : P Software Please download http://go6.163.com/spring22/html/debugtrace.htm Specific description in the zip package. In order to track user needs, as well as bug reflection, please download users send a mail to Luon@hotmail.com is really not, let's sign a mail, thank you

As a C / C programmer, what is your biggest distress? How to deal with DEBUG and RELEASE version? How do I debug in the Rease version? How to better debug real-time programs, how to better debug multi-cable city program, how to debug GDI program ...

I want to have an experienced programmer, to deal with such a problem, should have my own way. But can you share these methods to everyone, provide a popular Dongdong? I have been confused. Now, the answer is DebugTrace.

As a C / C programmer, my biggest distress is the problem of array of crossed access, what about you?

Many times, debugging a program is not our usual F9 [Setup Breakpoint], F5 [Run], F10 [Single Step Execution], F11 [Jump] can be resolved. This problem is more prominent, such as the debugging of the GDI program, debugging of the keyboard program. When you press the keyboard, the keyboard message will be triggered, but after you move the mouse, it will cause an invalid area to trigger the call of WM_PAINT. If the debug object is interested in this message, the problem will appear. In this case, it will have a certain impact on your debugging. How do you happen? The common method of debugging GDI is a double display or remote debugging. If the keyboard is debugged, use other input methods to debug. This will have a very poor specific individual method, can we have other generic methods? correct! Someone thinks, we can write the log & trace file. This is definitely a great way. With this method, many programmers have seen a little hope in Debug's bitter sea.

But is there such a method and once? In fact, the problem is far away. It is just the beginning.

For example, want to write some information to the log file, there may be the following code:

Char szbuffer [20];

ZeromeMory (Szbuffer, Sizeof (Szbuffer);

FPRINTF (Pfile, Szbuffer, "[% D] the first log information", 1);

This code is basically correct, and it is also pleasing to the eye, but experienced programmers can see the problems. Did you see it? Where is the problem? The problem is in the length of the character array szbuffer, and the proceedings of the array have occurred. Such a program is placed in the program, and there is a bomb, which will jump out at any time. The method of improved program is to increase the length of the array. But in the actual situation, how big is the buffer needed? This is difficult to grasp, the only answer is to analyze the specific situation. If there is a lot of places to write logs in a program? Will it be full of this statement? Such a code is not only high in operation, not only high development efficiency, but also affects the readability of the program. Some people say that put the buffer into a global, good idea, but how much is this buffer? This is indeed a problem, and the intelligence is that this road is not open. In fact, many people can think of it, we can solve this problem with C string. Of course, this problem is solved, but if you want to do it at the Debug version and the release version? The usual approach is to apply precompiled instructions, such as:

#ifdef debug

Char szbuffer [20];

ZeromeMory (Szbuffer, Sizeof (Szbuffer);

FPRINTF (Pfile, Szbuffer, "[% D] the first log information", 1);

#ENDIF

A large number of such statements appear in the program, not only requires specialized compilers' knowledge, but also affects the readability of the program, and if you accidentally and compile instructions, the error prompt cannot be Correctly indicated. This has increased trouble.

What is the solution? It is highly recommended to use DebugTrace, J

After writing the log file, is there a good thing? The answer is of course negative. Consider the situation in multithreading. What kind of problem occurs when multi-threaded? The first is that we will have a problem when we write files to disk or memeory. Imagine if there are many threads to write again, do you have access conflicts? Fortunately, in most OS in the Windows series, the file I / O is already asynchronous access mode. This is not a problem, but since Buffer is globally, how to ensure that Buffer's access does not conflict? This is necessary to use the technology of the line city communication and synchronization technology, a small write log operation requires such a complex stuff to complete it, do not do it!

There is also a problem. If you write log, you need to wait for the program to run until you have finished the result of writing logs. This is a real-time sexuality. In some systems, you need to know where the current program is running in real time. Write logs for delay, what should I do?

Friends who have used Java know that in Java can have a very Cool's Dongdong Java Virtual Machine JVM, any information that needs to track debugging can be checked by Print to JVM, this is the programmer for debugging. It is so convenient to do things. Do you want to have such a stuff during the debugging of your C / C program?

If you want, you may wish to try DebugTrace!

Inside the Windows system, you have maintained a virtual window called DebugWindow. Use DBGWnd, Softice, or VC or other development tools to bring these stasis. How do you use these stuff to write your own information to you, check in real time when debugging? The answer is in Debugtrace. At the same time, many people also care about how to write my log information to the system's event logger? This is also a feature of DebugTrace.

For programmers, the purpose of debug is to find the bug in the program. Bug's performance is of course the line in that file. How to tell you these also tell you about your clearly? For multi-threaded programs, how to know that message is that the thread is written? Especially when multiple threads use the same thread function at the same time? How to make a subtle analysis if the stack time requires high ......

The answer is in Debugtrace.

The current DebugTrace has taken a lot of actual projects. Performance is always good. Especially in a multi-threaded socket and another COM project is not bad.

There is a saying called "the country's weapon, it is not likely to be people", but I think there is an exchange. So I hope DebugTrace will help you. It is worth trying.

转载请注明原文地址:https://www.9cbs.com/read-2238.html

New Post(0)