In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Debugging method of MySQL UDF-debugview (to) [@ more@]
The debugging mode of Mysql UDF
The UDF of MYSQL is essentially a dynamic link library that does not need to set an entry point (* Nix calls it a shared library). It can be said that there is a personal method for debugging DLL. Now let me introduce a very simple and easy-to-use debugging method. This method directly uses windows api, language independent, development tool independent, project type independent, and typical three no debugging methods. Moreover, the debugging method we discuss here supports remote debugging, which is very practical for those who are unable to master the original debugger of the development tool but are eager to find program errors.
First of all, we need to download the receiver, of course, those who are willing to write their own. In bugview.shtml "> http://www.sysinternals.com/ntw2k/freeware/debugview.shtml. We can know from the debugview manual that this tool supports WIN9X/nt series and kernel debugging! because the API it calls can only receive one char * type parameter, sometimes we need to use the organic combination of other functions to generate human readable hints.
In order to reduce the complexity, take the discussion from Delphi.ktop.com.tw/topic.ASP?TOPIC_ID=35166 "> http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=35166 as an example to explain how I use the tools here for debugging.
1 simply output one line of information, and output a simple message at the beginning of debugging so that we can know where debug is.
Add the following line to the program code as needed
OutputDebugStringA ("--UDF:my_name () is called")
In this way, I know that the my_name I defined is used by the customer, and then I have to care about the return value.
2 output return value
There are many ways to output return values, which can be combined freely. The ultimate goal of free combination is to pass a valid char * type parameter to WiNDOWS API. Here simply take the C language character control function as an example.
Example:
# include / * function-sprintf * /
# include / * attach windows api * /
/ *. Omit * /
Char* _ stdcall my_name (UDF_INIT * initid, UDF_ARGS * args, char* is_null, char* error)
{
OutputDebugStringA ("--UDF:my_name () called"); / * called? , /
Char * me = "my name"
/ *-debuger start----*/
Char debugermsg [256] = {0}
Sprintf (debugermsg, "% s", me)
OutputDebugStringA (debugermsg)
/ *-debuger end----*/
Return me
}
When similar code is added to the program, debugging can begin, and in this way you can still get the debugging information you need even if you don't use the "debuger" mode of compilation.
Receive debugging information
To receive debugging information, you only need to open the debugview program, and the main window of the program can return the debugging information you need in real time.
For other platforms, please refer to the manual for the corresponding api. Debugging in this way will not cause any trouble.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.