help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inoltra: Re: debug mex file in octave


From: Riccardo Corradini
Subject: Inoltra: Re: debug mex file in octave
Date: Wed, 25 Oct 2006 14:28:33 +0200 (CEST)

Nota: allegato messaggio inoltrato.


__________________________________________________
Do You Yahoo!?
Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto 
spazio gratuito per i tuoi file e i messaggi 
http://mail.yahoo.it 
--- Begin Message --- Subject: Re: debug mex file in octave Date: Wed, 25 Oct 2006 14:27:17 +0200 (CEST)
I found this on the web


Using gdb to debug your extensions

gdb can be used to debug DEFUN_DLD functions. There
are N preliminary steps one should during the
compilations phase.

    * compile all of the code with -g or -ggdb
    * compile all the code that you want to step
through and examine variables in with -O0
    * make sure that the linker is not stripping
symbol names

With that done, it the shared objects (.oct files)
should be ready to go. The debugger can simply be
started with 'gdb octave' assuming it is in your path.
However, the DEFUN_DLD has not been loaded and
therefore gdb cannot set any of the break points or
examine it at all. The following steps are not the
only solution, but I find them to be effective:

    * start debugging with 'gdb octave' or whatever
the correct command is for your environment
    * 'run' octave
    * after the octave prompt appears, display the
help for your dynamic function. That is, if your
function is called 'myfunc.oct', call 'help myfunc'.
This will load your dynamic funtion into octave space
and gdb without tickling the bug
    * ctrl-c will then return you to the gdb prompt
    * set break points inside of your DEFUN_DLD and
have fun

If you find that gdb is not pointing to the line that
is being executed or the that the flow of the program
is not as expected, then make sure you used the -O0
switch. Octave normally uses the -O2 switch which
optimizes the code making it less inituitive for
debugging.

Is it possible to have a simple example ?
Thanks a lot for your help

Cheers
Riccardo 
--- frank wang <address@hidden> ha scritto: 

> Hi,
> 
> I have downloaded octave 2.9.9 for Fedora and using
> mkoctfile compiled an
> cpp code. The compile process went very well without
> any problem. However, I
> need to debug the code. So I starts gdb octave. gdb
> echos message such as:
>  (no debugging symbol was found)
> using host libthread_db library
> "/lib/libthread_db.so.1"
> 
> then I tried to set a breakpoint by:
> 
> b fft_mx512.cpp:40
> 
> Then gdb echos:
> 
> No symbol table is loaded. Use the "file" command
> 
> I tried to use file command as:
> 
> file fft_mx512.mex
> 
> gdb echos:
> Reading symbols from path/fft_mx512.mex...done.
> 
> then I set the break point by:
> 
> b fft_mx512.cpp:40
> 
> then I run the octave by:
> run
> 
> Then gdb got segmentation fault. The message is
> Starting program: path/fft_mx512.mex
> breakpoing 1 at ox36277c: file fft_mx512.cpp, line
> 40.
> warning: shared library handler failed to enable
> breakpoint
> Reading symbols from shared object read from target
> memory....done.
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000001 in ?? ()
> (gdb)
> 
> Can anyone help me to figure out how to debug my
> code in octave? I remember
> that I build an old version octave 2.9,7 sometimes
> ago and I can easily to
> debug mex file created by my c code. I actually also
> used gdb to debug
> octave code. However, since building octave for me
> is very difficult(too
> many dependency on external packages), so I decided
> to use the prebuild
> octave for Fedora. But I need to debug my code.
> 
> Thanks
> 
> Frank
> > _______________________________________________
> Help-octave mailing list
> address@hidden
>
https://www.cae.wisc.edu/mailman/listinfo/help-octave
> 


__________________________________________________
Do You Yahoo!?
Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto 
spazio gratuito per i tuoi file e i messaggi 
http://mail.yahoo.it 

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]