ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:
where I have used the names of the required libraries and -g for being debuggable
)(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
I put a breakpoint on the function name, and use "step" to debug.
You cannot step into the source code for a library unless
The library was built with debugging information included.
You have the source code for the library.
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.
Last edited by David1357; 12-22-2009 at 09:47 AM.
Reason: Changed "library was build" to "library was built".
You cannot step into the source code for a library unless
The library was build with debugging information included.
You have the source code for the library.
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.
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:
....You need to tell libav's makefile to
add "-g" to all calls to gcc, and tell the makefile not to run "strip" on the library when you are done. Also, its handy not to get lost in
assembly code and you want your debugger to generally follow the source
line-by-line, so might as well disable optimizations while you're at it.
And, you do this with the configure command, which generates the makefiles
for you.
I configured the library on linux with the above mentioned options, and then did a "make" , "make install".
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?
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?
Do you have two versions of the library installed? Is there a version in "/usr/lib" and your debug version in "/usr/local/lib"?
Quote:
Originally Posted by akm3
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?
Did you run "configure" with the specified options?
Did you tell "make" to use the "-g" option for compiling and linking?
Code:
$ make CFLAGS=-g LDFLAGS-g
Did you pass the path to your debug libraries to GCC?
Thanks a lot for your help.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.