Yesterday, I found that there was a problem with the server communication concurrency, so I hope to add the write debugging information output at the communication layer. At that time, I first thought of codesite, which is commonly used. However, after I added the debugging code to the communication unit, the compilation failed, and it was discovered after a trace, it turns out that codesite actually reports an address error. Let's take a closer look... My mom... The codesite object is actually nil. Originally, this object was supposed to be made during csintf unit initialization. It was used well before. Why can't I initialize the codesite object this time ???? That's strange. I went to study this damn codesite most of the afternoon... Fruitless ....
Get up in the morning... I suddenly thought of using an outputdebugstring function that I used earlier. This is a WIN32API function in a Windows Unit. It is green, pollution-free, and no residue. In the debugging status, you can use various debuggers to capture the output information of outputdebugstring in the program. In fact, outputdebugstring writes a piece of data to a shared image memory and creates two enevts, indicating that the data write event is triggered. The output information of outputdebugstring in Delphi is displayed in the event log window. If it is run outside the debugging environment, you can also use debugging tools such as debugview and aqtime to view the output information. If you use the debugview tool, you can also remotely view the output information, so that you can easily capture and process the output of debugging information in the Code. It is actually a developer who travels at home and kills people, essential Medicine ...... Pretty cool ~~~~~ In the afternoon, I went to test the communication layer of the Department to debug the server. It turned a lot of credit to find the cause ~~~ I made up my mind to abandon codesite in the future and return to outputdebugstring. I also considered how to organically integrate outputdebugstring into the log module of the platform when appropriate, added platform debuggable!
Outputdebugstring (pchar (syserrormessage (getlasterror )));
You can also encapsulate layer functions for outputdebugstring to make it easier to use:
Procedure outputdebugstr (const adebuginfo: string );
Begin
Outputdebugstring (pchar (adebuginfo ));
End;
Debugview:
Http://download.sysinternals.com/Files/DebugView.zip