On date Friday 2009-01-02 16:20:14 -0500, Franco Amato encoded:
> 2009/1/2 Franco Amato <[email protected]>
> > 2009/1/2 Michael Tison <[email protected]>
[...]
> Hi valgrind discovered that this simply check give to me a seg fault
> void MovieRecorderBase::CloseAudioEncoder()
> {
>   if(m_audioStream->codec->codec) //here I get seg fault...is it a
> nightmare?

m_audioStream->codec (actually a codec context) is NULL/invalid and
you're trying to access it, this shouldn't happen and looks like a
logic error in your code.

>     avcodec_close(m_audioStream->codec);
> 
>   ...more code...
> }
> 
> I'm really confused and I don't know how to debug with gdb as I don't have
> an active project
> written with visual studio but a list of files edited with emacs and
> compiled with g++

You don't need a project to debug with GDB, so you're sparing yourself
all of that M$ish non-portable bloat, and emacs offers you a direct
interface to GDB. But you may want to try cedet for emacs which
provides a complete development/debugging environment.

[...]
> >> At this point it seems you just need to go over it with a debugger and
> >> watch the stream's codec context.
> >
> >
> > Working under Linux and never used gdb...:-(

Follows just a quick crash-course tutorial on the GDB:

1) at first you need to compile your code with -g and -O0. Since you
may need to debug libav* then you may need to compile FFmpeg and
friends with --enable-debug=3, --disable-optimizations and
--disable-stripping.

2) M-x gdb and set the name of the program to debug when requested, a
buffer with the gdb prompt where you're meant to type gdb commands
should appear.

3) set the args if any with "set args <my fine args>" at the prompt

4) type run

5) at this point the program should crash, type bt and move in the
backtrace backward up until you find out where the error is, use the
frame command (use frame <frame number>), emacs should automatically
display to you the corresponding code in some buffer.

6) set eventually some breakpoint (clicking on the left of the code
where you want to set the breakpoint, a red circle should appear on
the left border of the buffer), also learn how to use the break,
enable, and disable commands. the "help" command is your friend.

7) practice and learn more about GDB/debugging, GDB is an invaluable
tool when debugging complex/not-so-complex programs.
 
> > Meanwhile thanx

Regards.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to