Debugging gdb可以进入某些opencv函数,但不能进入其他opencv函数
我想在opensuse 13.1下用gdb调试Opencv: 我可以进入一些功能,如Debugging gdb可以进入某些opencv函数,但不能进入其他opencv函数,debugging,opencv,gdb,step,Debugging,Opencv,Gdb,Step,我想在opensuse 13.1下用gdb调试Opencv: 我可以进入一些功能,如imshow,waitKey,但我不能进入其他功能,如imread,namedWindow,它显示: 29 image = cv::imread(name); (gdb) s std::allocator<char>::allocator (this=0x7fffffffdc7f) at /usr/src/debug/gcc-4.8.1-20130909/obj-x86_64
imshow
,waitKey
,但我不能进入其他功能,如imread
,namedWindow
,它显示:
29 image = cv::imread(name);
(gdb) s
std::allocator<char>::allocator (this=0x7fffffffdc7f)
at /usr/src/debug/gcc-4.8.1-20130909/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/allocator.h:113
113 allocator() throw() { }
您应该在gdb提示符中再次
完成
和步骤
这是因为当您第一次进入时,您会进入std::string
构造函数代码(它是imread
的第一个参数)。这不是您想要的,所以只需再次执行当前帧的步骤。请注意,此过程可能会在同一行代码上发生多次,具体取决于函数的参数以及传递参数的方式
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
Mat image;
image = imread( "LinuxLogo.jpg", 1 );
if ( !image.data )
{
printf("No image data \n");
return -1;
}
namedWindow("Display Image", CV_WINDOW_AUTOSIZE );
imshow("Display Image", image);
waitKey(0);
return 0;
}
OpencvDebugLibDir=/home/ry/lib
CFLAGS=-g -I$(OpencvDebugLibDir)/include/opencv -I$(OpencvDebugLibDir)
LIBS=$(OpencvDebugLibDir)/lib
test4:test4.cpp
g++ $(CFLAGS) -o $@ $< -L$(LIBS) -lopencv_highgui -lopencv_core -Wl,-rpath=/home/ry/lib/lib
gdb test4 -d /home/ry/learn/opencv/install/OpenCV/opencv-2.4.9/modules/core/src -d /home/ry/learn/opencv/install/OpenCV/opencv-2.4.9/modules/highgui/src