Mysql UDF debugging method - DebugView

zhaozj2021-02-16  62

Mysql UDF debugging method

MySQL's UDF essence is a dynamic connection library that does not need to set the entry point (* NIX is called shared library). For DLL debugging, there is an individual. I now introduce a very simple and easy-to-use debugging method. This method directly uses Windows API, language-independent, development tools, and has nothing to do with the project type, typical three-free debugging methods. And, we support remote debugging from the debugging methods discussed here. For friends who are unable to master the development tool originally debuggers, this method is very practical!

First we need to download the receiving end, of course, someone can write one yourself. At http://www.sysinternals.com/ntw2k/freeware/debugview.shtml. Through the debugview manual we can know this tool supports the Win9x / NT series and supports kernel debugging! Since the APIs they call can only receive a char * type parameter, sometimes we need to use other function organic combinations to generate humanity readable prompts.

In order to reduce complexity, discussions from http://delphi.ktop.com.tw/topic.asp?topic_id=35166, how I use this tool for debugging.

1 Simply output a line of information, output a simple message when debugging start, easy us to understand what Debug is going. In the program code, you will join the following line OutputDebugstringa ("- udf: my_name () is called"); I will know that my defined my_name is used by the customer, then I want to pay attention to the return value.

2 Output return value Output Return value method, you can freely combine. The ultimate goal of free combination is to pass an effective char * type parameter to the Windows API. It is simple here as an example of the C language character control function.

example:

#include / * function - sprintf * / # include / * Mounting Windows API * // * ........... 省略 * / char * __stdcall my_name UDF_INIT * INITID, UDF_ARGS * ARGS, CHAR * IS_NULL, CHAR * Error) {OutputDebugstringA ("- udf: my_name () is called"); / * call? * / char * me = "my name";

/ * - DEBUGER START ---- * / Char Debugermsg [256] = {0}; Sprintf (Debugermsg, "% S", Me); OutputDebugstringA (DebugerMsg); / * ---- debuger end- --- * /

Return me;}

When you add a similar code in the program, you can start, using this way, even if you don't use the "DEBUGER" mode, you can compile the desired debug information.

Receive debugging information

Receiving debugging information As long as you open the DebugView program, the program main window can return the required debug information in real time.

Other platforms are invited to access the accompanying manual to obtain the corresponding API, and use this way to debug the method is appropriate and will not cause any trouble.

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

New Post(0)