在 Windows 上调试 ODBC 驱动程序的最佳方法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/91398/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:14:11  来源:igfitidea点击:

Best way to debug an ODBC driver on Windows

windowsodbc

提问by Mathias

What is the best way to debug a custom ODBC driver on Windows? A former member of our team wrote the driver so we have the source available.

在 Windows 上调试自定义 ODBC 驱动程序的最佳方法是什么?我们团队的一位前成员编写了驱动程序,因此我们有可用的源代码。

How do you attach a debugger to the driver? Or is it easier to just add "trace prints" to the driver to see what is going on?

如何将调试器附加到驱动程序?或者更容易向驱动程序添加“跟踪打印”以查看发生了什么?

回答by Mathias

The best solution i found so far is a combination of trace prints and breakpoints (int 3) compiled into the driver.

到目前为止,我发现的最佳解决方案是将跟踪打印和断点 (int 3) 组合到驱动程序中。

Trace prints for general debug information and the breakpoints for pieces of the code where I need to more thoroughly investigate the inner state of the driver.

跟踪打印一般调试信息和代码片段的断点,我需要更彻底地调查驱动程序的内部状态。

回答by Milan Babu?kov

You can debug any ODBC driver by activating the logging for it via the Control Panel.

您可以通过控制面板激活日志记录来调试任何 ODBC 驱动程序。

Just go to driver's properties, activate the logging and set the target log file - and then set up another program to read from it interactively, so you can see what's going on.

只需转到驱动程序的属性,激活日志记录并设置目标日志文件 - 然后设置另一个程序以交互方式读取它,这样您就可以看到发生了什么。

回答by Grey Panther

As far as I know, ODBC drivers are just DLL's which implement a specific set of functions. So if you have the sources available, you can use Visual Studio to debug it. Here is an article which seems to be something in the right directions: Debugging DLL Projects in Visual Studio 2005.

据我所知,ODBC 驱动程序只是实现一组特定功能的 DLL。因此,如果您有可用的源代码,则可以使用 Visual Studio 对其进行调试。这是一篇似乎在正确方向上的文章:Debugging DLL Projects in Visual Studio 2005

回答by Florian

Supportingly to VS you could use WireSharkto see what the ODCB driver is sending to the DB.

支持 VS,您可以使用WireShark查看 ODCB 驱动程序发送到数据库的内容。