Current Issue Cover
开源跨平台的图像可视化调试器设计

张远辉, 谢波, 许昌(中国计量学院机电工程学院, 杭州 310018)

摘 要
目的 在调试C/C++图像处理程序时,如何以可视化的形式观察被调试程序中的图像变量,对于调试过程尤为关键。目前尚未有跨多操作系统平台的图像可视化调试器可供使用,该款开源跨平台的图像可视化调试器的设计与实现弥补了此领域的不足。方法 利用GDB(GNU debugger)调试器的Python接口,将被调试程序中的图像变量对应的内存字节序列转化成Python下的2维数组,并采用Matplotlib库加以显示,整个图像显示线程独立于GDB的文本字符交互主线程。结果 在Windows、Linux、Mac系统中分别进行实验,均可实现图像变量的显示、缩放、平移、像素数值查看、保存等多种功能,并使得GDB的命令行保持非阻塞模式运行。结论 开源跨平台的图像可视化调试器的设计,满足了不同操作系统平台下图像程序的开发调试需求,弥补了当前GDB调试图像程序功能的不足,提高了图像处理程序的开发和调试效率。
关键词
Open-source and cross-platform image debugger visualizer design

Zhang Yuanhui, Xie Bo, Xu Chang(College of Mechanical and Electrical Engineering, China Jiliang University, Hangzhou 310018, China)

Abstract
Objective In the process of debugging a C/C++ image-processing program, the debugger must have the ability to visualize the in-memory image data. Given that no study has yet to present an image debugger visualizer that can work in multiple-operation systems, an open-source, cross-platform image debugger visualizer design is proposed to fill the research gap. Method We utilize the Python interface of the GDB debugger, translate the byte array fetched from the debugged program to a Python two-dimensional array object, and visualize the array by using the Matplotlib library. The visualization process is executed in a worker thread, along with the traditional GDB text-based interface. Experiments are performed on Windows, Linux, and Mac Systems. Result Results show that the debugger has various features, such as zooming, panning the image, showing the pixel value of the specified position of the image, saving the image, and keeping the GDB text command line interface in a state where it can work interactively. Conclusion The debugger design meets the requirements of developing and debugging an image program in different operating system platforms, thus compensating for the deficiencies of the GDB debugger in terms of image debugging ability, and significantly improving the efficiency of development and debugging.
Keywords

订阅号|日报