MySQL UDF调试方式debugview_MySQL
MySQL的UDF实质就是一个不需要设置入口点的动态连接库(*Nix称之为共享库)。对于DLL的调试可谓个人有个法。现在我介绍一下一个非常简单的易用的调试方法。这一方法直接利用Windows API,语言无关、开发工具无关、项目类型无关,典型的三无调试方法。并且,我们从这里讨论的调试方法支持远程调试,对于一时无法掌握开发工具原本调试器而又急于寻找程序错误的朋友此方法非常实用!
首先我们需要下载接收端,当然有心人也可以自己写一个。在 http://www.sysinternals.com/ntw2k/freeware/debugview.shtml 。透过debugview手册我们可以知道这个工具支持win9x/nt系列,并且支持内核调试!由于其调用的API均只能接收一个char * 类型参数,所以有些时候我们需要利用其他的函数有机组合产生人性可读提示。
为了减少复杂程度简单的以来自 http://Delphi.ktop.com.tw/topic.ASP?TOPIC_ID=35166 讨论为例,讲解我是如何利用这里工具进行调试的。
1 简单输出一行信息,在调试开始时输出一条简单的信息便于我们了解debug到什么地方了。
在程序代码中根据需要加入下边一行:
OutputDebugStringA("--UDF:my_name()被调用");
这样一来我就知道我定义的my_name被客户用到了,接着我要关心返回值如何。
2 输出返回值
输出返回值方法很多,可以自由组合。自由组合的最终目的是将一个有效的 char * 类型参数传递给WiNDOWS API。这里简单的以C语言字符控制函数为例。
例子:
#include /* 函数- sprintf */ #include /* 挂接windows api */ /* ...........省略 */ char* __stdcall my_name(UDF_INIT *initid,
UDF_ARGS *args, char *is_null, char *error) { OutputDebugStringA("--UDF:my_name()被调用"); /* 调用了?*/ char *me = "my name"; /*---- debuger start----*/ char debugermsg[256]={0}; sprintf(debugermsg, "%s", me); OutputDebugStringA(debugermsg); /*---- debuger end----*/ return me; }
当在程序中加入了类似代码那么调试就可以开始了,利用这种方式即便不使用"debuger"方式编译仍然可以得到所需的调试信息。
接收调试信息
接收调试信息只要打开debugview程序即可,程序主窗口可以实时返回所需要的调试信息。
其它平台请自行查阅手册获得对应的api,利用这种方式调试方法适当并不会造成任何困扰。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



When creating a virtual machine, you will be asked to select a disk type, you can select fixed disk or dynamic disk. What if you choose fixed disks and later realize you need dynamic disks, or vice versa? Good! You can convert one to the other. In this post, we will see how to convert VirtualBox fixed disk to dynamic disk and vice versa. A dynamic disk is a virtual hard disk that initially has a small size and grows in size as you store data in the virtual machine. Dynamic disks are very efficient at saving storage space because they only take up as much host storage space as needed. However, as disk capacity expands, your computer's performance may be slightly affected. Fixed disks and dynamic disks are commonly used in virtual machines

This AI-assisted programming tool has unearthed a large number of useful AI-assisted programming tools in this stage of rapid AI development. AI-assisted programming tools can improve development efficiency, improve code quality, and reduce bug rates. They are important assistants in the modern software development process. Today Dayao will share with you 4 AI-assisted programming tools (and all support C# language). I hope it will be helpful to everyone. https://github.com/YSGStudyHards/DotNetGuide1.GitHubCopilotGitHubCopilot is an AI coding assistant that helps you write code faster and with less effort, so you can focus more on problem solving and collaboration. Git

On March 3, 2022, less than a month after the birth of the world's first AI programmer Devin, the NLP team of Princeton University developed an open source AI programmer SWE-agent. It leverages the GPT-4 model to automatically resolve issues in GitHub repositories. SWE-agent's performance on the SWE-bench test set is similar to Devin, taking an average of 93 seconds and solving 12.29% of the problems. By interacting with a dedicated terminal, SWE-agent can open and search file contents, use automatic syntax checking, edit specific lines, and write and execute tests. (Note: The above content is a slight adjustment of the original content, but the key information in the original text is retained and does not exceed the specified word limit.) SWE-A

Go language development mobile application tutorial As the mobile application market continues to boom, more and more developers are beginning to explore how to use Go language to develop mobile applications. As a simple and efficient programming language, Go language has also shown strong potential in mobile application development. This article will introduce in detail how to use Go language to develop mobile applications, and attach specific code examples to help readers get started quickly and start developing their own mobile applications. 1. Preparation Before starting, we need to prepare the development environment and tools. head

Android development is a busy and exciting job, and choosing a suitable Linux distribution for development is particularly important. Among the many Linux distributions, which one is most suitable for Android development? This article will explore this issue from several aspects and give specific code examples. First, let’s take a look at several currently popular Linux distributions: Ubuntu, Fedora, Debian, CentOS, etc. They all have their own advantages and characteristics.

Based on the continuous optimization of large models, LLM agents - these powerful algorithmic entities have shown the potential to solve complex multi-step reasoning tasks. From natural language processing to deep learning, LLM agents are gradually becoming the focus of research and industry. They can not only understand and generate human language, but also formulate strategies, perform tasks in diverse environments, and even use API calls and coding to Build solutions. In this context, the introduction of the AgentQuest framework is a milestone. It not only provides a modular benchmarking platform for the evaluation and advancement of LLM agents, but also provides researchers with a Powerful tools to track and improve the performance of these agents at a more granular level

"Understanding VSCode: What is this tool used for?" 》As a programmer, whether you are a beginner or an experienced developer, you cannot do without the use of code editing tools. Among many editing tools, Visual Studio Code (VSCode for short) is very popular among developers as an open source, lightweight, and powerful code editor. So, what exactly is VSCode used for? This article will delve into the functions and uses of VSCode and provide specific code examples to help readers

As a fast and efficient programming language, Go language is widely popular in the field of back-end development. However, few people associate Go language with front-end development. In fact, using Go language for front-end development can not only improve efficiency, but also bring new horizons to developers. This article will explore the possibility of using the Go language for front-end development and provide specific code examples to help readers better understand this area. In traditional front-end development, JavaScript, HTML, and CSS are often used to build user interfaces
