Gdb can go into some opencv function, but cannot go into some other opencv functions

I want to debug Opencv with gdb under opensuse 13.1:

I can enter into a function, for example imshow

, waitKey

but I can not join the others, such as imread

, namedWindow

it shows:

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

      

here are my steps:

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;
}

      

my makefile:

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

      

run 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

      

+3


source to share


1 answer


You should finish

and step

again at the gdb prompt.



This is because the first time you enter, you step into the constructor code std::string

(this is the first parameter imread

). This is not what you want, so just end this current frame again. Note that this process can occur multiple times in the same line of code, depending on the function arguments and how they are passed.

+1


source







All Articles