3

opensuse 13.1 で gdb を使用して Opencv をデバッグしたい:

、のような関数にステップインできますがimshowwaitKey、 のような他の関数にステップインすることはできません。次のようimreadnamedWindow表示されます。

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() { }

ここに私のステップがあります:

test4.cpp:

#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 を実行します。

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
4

1 に答える 1