Debugging Problem in Gdb
Dear All,
I have written a program with FFMPEG API(This a library for video/audio manipulation) I have tried to debug the executable file using DDD(which uses 'gdb' itself) To make it simple, I am trying to see where in the ffmpeg source code, a function (namely "avcodec_decode_video()")referes to. I put a breakpoint on the function name, and use "step" to debug. But, when it reaches the line containing the function, I get the following message: http://i43.tinypic.com/6ej436.jpg I wanted to know which of these is the source of this error; 1) I have done some mistakes installing ffmpeg (i.e. wrong ./configure options [I think this is not the case, since I've disabled all optimization options]) 2) I have problem with "root" privileges (since the libraries are at "use/local/lib")(note I tried "sudo ddd executable_filename" instead of "ddd executable_filename", and i get an error in the beginnig of debugging which says : http://i39.tinypic.com/311ozyq.png ) 3) I am using gcc(in compiling the file)wrongly (I compile it like: Code:
gcc -o executable_filename myCCode.c -g -lavutil -lavformat -lavcodec -lz )(Note that the program compiles correctly, and works when I'm not debugging) I appreciate your help on this, cuz it has made me stuck in working on a project. Though, this is not an ffmpeg forum, I am attaching the source code, in case anybody with knowledge of ffmpeg wants to take a look. My C Code |
Quote:
Debugging library code is quite tricky. You need to know how to build the library from source with debugging information included. You will probably need to use the "-L" option to gcc to override the library include path with the path to your debugging libraries. |
Quote:
Well, I have the source code for the library, since it is an oopen-source one. To build it with debugging information, I followed the following instructions: Quote:
But I still had the problem with debugging that it says "Cannot access memory at address ****" So, first of all, are you sure the cause of this error is that I have errors in building the library, and it still doesn't have the debug information? Second, since I am using "./configure"+"make"+"make install" to build the library, how should I override the library include path with the path to my debugging libraries? |
Quote:
Quote:
Did you tell "make" to use the "-g" option for compiling and linking? Code:
$ make CFLAGS=-g LDFLAGS-g Code:
$ gcc -o executable_filename myCCode.c -g -L/usr/local/lib -lavutil -lavformat -lavcodec -lz |
Quote:
I appreciate it. Seems that the problem was with having two versions in /usr/lib and /usr/local/lib, the latter had debug information, but I was using the former all the time. I included -L/usr/local/lib, and it goes inside the code now. Thnaks agiain. |
Quote:
|
All times are GMT -5. The time now is 07:30 PM. |